Sublime Forum

Completions package

#1

I have completion files available at my GitHub for CSS, JavaScript, jQuery, PHP and Python. Feedback, however, is hard to come by, but I believe a few have found them useful.

I’m considering placing some, or all, on Package Control. Would you recommend them as separate items? If I bundle them all together then most people won’t require them all and they are more likely to conflict with the users’ other plug-ins/defaults. Is there a way to install the package but then disable specific completion files (other than just deleting the file(s))?

I might **not **do this with CSS as they would be confused with the defaults, and mine are perhaps a little quirky anyway.
I put a lot of effort into my PHP completions and they are much better (more up to date) than the defaults. However, it would require the user to delete the default PHP completion file(s).

I welcome advice, suggestions and/or feedback :smile:. Andy.

0 Likes

#2

If you separate them, when installing all of them, will that be slower than having all of them together? If it’s basically the same, I would publish them separately.

0 Likes

#3

Thank you for your response. I suspect the difference would be very minimal. Andy.

0 Likes

#4

As always u have my complete support. Your completions are awesome! I use almost all of that.

P. S. Ok useless comment on this subject XD

0 Likes

#5

[quote=“Fed03”]As always u have my complete support. Your completions are awesome! I use almost all of that.

P. S. Ok useless comment on this subject XD[/quote]

Thank you very much - nice that my efforts are appreciated :smile:

0 Likes

#6

My JavaScript and jQuery completions are now available via **PackageControl **as AndyJS, and Python completions and help as AndyPython.

The jQuery completions require a jQuery syntax file (there’s one available via PackageControl) and for you to select jQuery as the syntax from the list at the bottom-right. Or, if you want both the JS and jQuery completions available all the time, then you could modify the jQuery completion-file’s source to just “source.js”.

If you prefer to use another packages’ jQuery snippets, and just want my JS completions, then you could delete my jQuery completions file. (If you don’t use jQuery then you could just leave as-is, as the file will be ignored.) The file is likely to be re-installed, though, on a future update or ST build.

My Python package includes a *simple *help system for many standard methods and functions. Just assign a key-binding for these, such as:

{ "keys": "shift+f1"], "command": "py_help" }

I put a lot of effort into PHP completions. It is much more up to date and complete than the standard completions, and many extension libraries are block-commented by default, so that they don’t clutter the completions-list. But I haven’t put it on PackageControl as it would require you to delete/move the standard completions file.

0 Likes

#7

[quote=“agibsonsw”]

I put a lot of effort into PHP completions. It is much more up to date and complete than the standard completions, and many extension libraries are block-commented by default, so that they don’t clutter the completions-list. But I haven’t put it on PackageControl as it would require you to delete/move the standard completions file.[/quote]

I was thinking about lately, maybe we could request to jonh (I don’t know how) to add a simple behaviour to sublime.
Likewise the sublime settings files in the user folder overrride the default ones maybe he could add the same for completions…it would be awesome

0 Likes

#8

Assuming the default PHP completions file has not been updated for quite a while, I would be happy for Jon to replace it with my version. It would help, though, if anyone using my version would confirm that it is *better * (more up-to-date and complete) and doesn’t have any mistakes.

0 Likes

#9

Just tried AndyJS,
with this plugin default autocomplete of words and functions that already exists in *.js file, stop working.
Any ideas why?

0 Likes

#10

[quote=“Sinled”]Just tried AndyJS,
with this plugin default autocomplete of words and functions that already exists in *.js file, stop working.
Any ideas why?[/quote]

Mmm hadn’t noticed this before. It shouldn’t really interfere as it is *just *a completions file. Maybe they will come back if you close/re-start ST, or edit the file for a while.

The items seem to appear if I type enough letters. Maybe someone else has an idea :question: . Sorry, Andy.

0 Likes

#11

It seems i found root of the problem, and it is “unnecessary characters”, such as spaces, tabs and parentheses in completion trigger.

And what is interesting, when i created sublime-snippet, similar to completion - it works fine with parentheses and spaces in

0 Likes

#12

[quote=“Sinled”]It seems i found root of the problem, and it is “unnecessary characters”, such as spaces, tabs and parentheses in completion trigger.

And what is interesting, when i created sublime-snippet, similar to completion - it works fine with parentheses and spaces in [/quote]

Thank you. It must be the brackets, as there are no spaces and the tab (\t) is used to separate the trigger from the description. This will affect my other completion files as well - but not my Python completions.

I don’t think I’ll edit the files though… At least, not just yet. Andy.

0 Likes

#13

I could correct this by converting to a .py completions file, similar to my Python completions. This has the advantage that I could include ‘Default’ for the file/standard completions - which is a nice touch :sunglasses:.

I might tackle this at the weekend. Andy.

0 Likes

#14

Has this been solved?

I’m having trouble with a completions file with a list of strings that contain spaces, points, parentheses, etc.

0 Likes

Add snippet description in sublime-completions file
#15

[quote=“pier”]Has this been solved?

I’m having trouble with a completions file with a list of strings that contain spaces, points, parentheses, etc.[/quote]

Don’t know if you’ve resolved this yet, but I can resolve it by converting my completions file to a .py using on_query_completions (similar to my Python completions) and deliberately appending the default (file) completions to the returned completions list. My issue relates to brackets () rather than spaces or dots, but I believe it would solve for these as well.

You could also remove the spaces, etc., from the trigger and make use of the \t description for your completions.

[code] “completions”:

    { "trigger": "action\tform", "contents": "action=\"$1\"$0" },
    { "trigger": "abbr", "contents": "abbr=\"$1\"$0" },[/code]

Doing so also allows you to re-use the same trigger (‘import’) for similar completions.

0 Likes

#16

Well it turned out that the problem was more complex than just removing some special characters.

To make it short, when my sublime-completions file is short it works as expected, even with special characters. But when the file is long, anything but letters makes auto complete ignore words buffer from current file. I already tried using tabs with /t but it didn’t work. Word buffer was ignored… I will try again, maybe I was doing something wrong as I’m auto generating the sublime-completion file.

So in my AS3 sublime-completions I have like 4 “addchild” triggers, and because I can’t add special characters to the trigger nor a description to the snippet, I don’t know which snippet I will trigger…

I filled a bug report here
sublimetext.userecho.com/topic/1 … rd-buffer/

I filled a feature request to add descriptions to snippets in sublime-completions
sublimetext.userecho.com/topic/1 … -triggers/

I hope someone (Jon Skinner) will notice this and make something about it… although it seems there aren’t many people complaining about it.

I know nothing about Python, but I will take a look at your idea. Thanks.

0 Likes

#17

It is backslash \t that separates the description.

We can already add descriptions to snippets using .

There is a max-filesize setting to display completions, but it is set very large by default:

// The maximum file size where auto complete will be automatically triggered. "auto_complete_size_limit": 4194304,
[This refers to the current view-size (I believe).]

If you are auto-generating completions (presumably using on_query_completions?) then you can reinstate the default completions by adding them to your completions list:

compl_default = [view.extract_completions(prefix)] compl_default = (item + "\tDefault", item) for sublist in compl_default for item in sublist if len(item) > 3] # flatten compl_default = list(set(compl_default)) # make unique compl_full = list(completions) compl_full.extend(compl_default) compl_full.sort() return (compl_full, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)
I do this in my Python completions file. Andy.

0 Likes

#18

My bad, it is a typo… but I used a blackslash when doing the completions file.

Yes, but not on completions files AFAIK… I tried adding a description parameter but didn’t work.

{ "trigger": "yeah" , "contents": "Yeah($1);" , "description" : "This is a great snippet" }

Thanks for the code. I’m generating a text file from AS3 based on an xml describing Adobe’s classes and methods, not auto generating the completions in real time using python. It seems I will have to study some python. :smile:

0 Likes

#19
{ "trigger": "coords\tArea", "contents": "coords" }
0 Likes