ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Phalcon​PHP Completions

by james2doyle ST2/ST3

A set of completions for the Phalcon PHP Framework made for Sublime Text 3

Labels phalcon, php

Details

Installs

  • Total 13K
  • Win 8K
  • OS X 2K
  • Linux 3K
Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31
Windows 3 1 8 6 4 5 11 2 8 6 5 4 4 7 2 3 5 6 5 0 3 4 4 3 5 4 10 0 1 6 7 4 7 4 6 5 4 6 6 4 8 8 2 2 11 6
OS X 1 0 2 2 0 1 1 0 0 1 1 0 1 0 0 1 0 0 2 1 0 1 0 0 1 2 0 0 0 1 2 0 0 1 0 1 1 0 0 2 0 1 0 0 0 0
Linux 0 2 1 0 0 2 1 1 0 3 0 1 0 0 2 2 0 1 1 3 1 0 0 1 1 0 1 1 0 2 3 2 3 0 3 1 0 1 1 2 2 0 1 1 3 3

Readme

Source
raw.​githubusercontent.​com

phalconphp-completions

A ton of completions for Phalcon PHP 1.3.*. There are 414 total right now. This is pretty much a copy-paste from my sublime-node-snippets repo.

testing example

Installing

Drop this folder in your Sublime Text packages directory.

Package Control

Just look for phalconphp-completions on Package Control. It is called “Node Completions” on the site, but comes up as “phalconphp-completions”.

Manual

  • Open the Commands Palette (command+shift+p)
  • Package Control: Add Repository
  • Past in this repos URL
  • Press Enter
  • Open the palette again
  • press enter on “phalconphp-completions”
  • watch it install

Using

Pressing \ (backslash) or : will end the snippet lookup.

You will have better results if you pretend the slashes and colons aren't needed. So if you are looking for Phalcon\Text::increment, you would type phalcontextincrement and you would see the results coming up.

See the GIF above!

Building

I went to each page of the node docs, and copied the functions. Then I wrote a converter to take each function and convert it to a snippet.

For Example, this line:

Phalcon\Text::endsWith($str, $end, $ignoreCase)

Is going to get converted to:

Phalcon\\Text::endsWith(\\$${1:str}, \\$${2:end}, \\$${3:ignoreCase});${0}

sources.txt

This file is cool. It is just a line-by-line output of the Phalcon docs functions. This is the file that is raked over to generate the snippets.

Running The Build

Just run node build.js and it will rake the sources.txt file and then write the new snippet in the snippets folder.

Everything before the first ( will be used as the filename.

Adding New Snippets

Here is how I quickly got all these snippets. First I went to the docs for the class, and I looked to see what the code examples were wrapped in.

For the all the docs pages, the methods and properties are show in a p.method-signature element. So to quickly get the list, I ran the following code:

Array.prototype.slice.call(document.querySelectorAll(".method-signature"), 0).map(function(item){
  return item.textContent.trim();
}).join("\n");

Then copied the output, added the class in front (replacing the type info), and pasted it in the sources.txt file. Done!

Contributing

Just add (or edit) a line in the source file. Then run node build.js to generate the new snippets.

License

The MIT License

Copyright © 2015 James Doyle james2doyle@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.