You can rename the file and save it in \Packages\JavaScript;Don't type your variable name - instead, type a few letters for the type of object it is (Win, Elem, etc.), or from the method you wish to use, or a combination of these two;Press TAB (or Enter) to accept the completion;Type your variable name (or Tab to accept the default) and continue to press Tab to fill in any other arguments;When an argument is shown like ', this]' it is optional and you can press Delete to remove it;

If you type 'style._' (or an underscore at any time) then the underscore will trigger a list of css properties. Again, you can just type a few letters of the property (without needing to type the underscore).

If you type your variable name followed by a dot '.' then the completion list will only really be useful for standard methods, functions, events, css properties. (If you choose, for example, Window.alert(), then you'll end up with 'yourVariable.window.alert()', and you'll have to press Delete twice to correct it.)

The list is **almost **complete . In particular, it doesn't include HTML5 objects other than those related to Canvas.

Good luck! Andy. (I might produce a simplified version of this..)AndyJSComps.zip (10.4 KB)

However, I wasn't happy with my first version. It requires too much of a change in the way that I code. This is fine for JS, but is likely to be off-putting when switching to other languages. So I have spent many (many..) hours perfecting the (new) attached version. It behaves much more like typical auto-completion. To an extent it is just a word list, but also helps you to complete function arguments.

I'm not sure how it will play with CodeIntel, but perhaps there is an option for that package to disable it just for JS(?).

If you already have a JS completions file you might want to (temporarily) move it out of your JS folder, so you can try my version

You might want to tweak the "auto_complete_delay" property so that the list doesn't appear too quickly.

The completion list shows details like "anchors // Document" to remind us which object it applies to;If you chose the completion 'alert()', for example, and you haven't already typed 'something.' it will automatically pre-pend 'window'. Of course, if you don't like this, then you can just ignore the completion.If you type your variable name, then a '.', and you're not sure what methods/properties are available, then start to type the kind of object it is, as in 'Area' or 'Image'. This should focus the list to specific items for this kind of object. Otherwise, you could start typing 'Element' for more general members. But, of course, you can just type a few letters from the method/property that you want to use.

All style properties are triggered by typing an underscore '_'. I did this to try to push them further down the completion list. However, you don't have to type the underscore if you don't want to

I've made this list as comprehensive as I can. It should include most anything you're likely to need, including all Canvas related features. (Start typing 'Canvas' to focus on these). But there are some omissions:

Some obscure event properties;HTML5 features (other than Canvas);Obsolete, and some deprecated, items;CSS3 properties, and there might be a few missing from CSS 2.2(?);Some obscure Node/DOM items;Some browser specific, or not well-supported, features.

But I still have one or two concerns/ things I need to consider:Local variable names might be pushed further down the list. I'm not sure how much of an issue this might be - if you're typing within a function then you're likely to be *happy *to type your variable name in full (or Ctrl-Space might help);The list is quite long - 800+ lines. (But the PHP version has over 4000 lines!) If it proves to be too slow then it might require a little trimming.

But my main concern is this: because the tab-trigger includes help text - such as 'maxLength // Password/Text' - this means that there will be far more matches appearing in the list than I want. My thoughts are these:

Live with it, because of all the help that it provides!Abbreviate all the object names in the help text, such as 'Pwd', 'Txt', 'Doc' etc. But this means you/me remembering the abbreviations. It might also mean that we end up with some unexpected matches;Remove the help text altogether (and re-order the file) - a tough decision!Try and compact object names; that is, put all specific items relevant to 'Password/Text/TextArea', etc., under the single heading 'Input'. I could consider this, but it just makes the list less helpful, particularly to new coders.

Anyway, I will be very pleased to receive feedback and suggestions. In particular, if I've missed something obvious that should be in the list .

I've only had it ten days, and I've learnt about Snippets, completions, JSON, tmLanguage, TextMate variables, revised the whole of JavaScript and a bit on Regular Expressions.. I'm even intending to read a book I have on Python!

(My only issue is that when I use Replace it also adds a chunk of text left over from a previous document - any idea how I can clear this cache/buffer pl?)

There is a lot of good stuff in it, but I'm not foolish enough to say it's complete. I think it is as comprehensive as it can be, for a single file.Of course, the advantage of it being a completions file, rather than a complex Python script, is that you are free to add, delete, move items as you wish.

As mentioned previously, I don't think it will work well with CodeIntel, unless you are able to turn that off just for JavaScript(?).

I removed the term Element, as everything is an element and it won't help narrow a search;Rather than Date it might work better to type day, month, etc., get, set, or to;If manipulating the DOM try words like node, create, append, child, sibling.

All the best and, as before, I would very much appreciate any feedback. Andy.AndyJS3.zip (10.1 KB)

The first thing I stumbled upon is the completion after typing "if" which is "mimeTypes FF ..." (somewhere down the list). Any Ideas why this is happening? If I complete with TAB, undo and TAB again I get "if (true) {};" as expected.

I haven't got your exact behaviour in version 2 or 3. I think it's because ST takes a semi-intelligent approach to suggesting completions. That is, it remembers what you've used previously. To resolve this:

type 'if' and scroll in the completion to select 'if () { }';perhaps start a new js file in the same project and try the first step in this file;type 'if', press escape to dismiss the completions list, and press tab a couple of times.

I notice in the project's workspace file it maintains a list of 'selected-items' for 'auto-complete'. You could try carefully! deleting this to start over, or just the bits that you know are not useful. But make sure that you close the project (or use a different editor) before you amend this file.

Of course, it's possible to remove items, or move them further down, within the completions file - but I would always treat this as a last resort.

Actually, this has resolved a problem I was having when trying to replace text (it was replacing it with a chunk of text from a previous file).

I closed my Project, and open the workspace file that's in my project folder. I delete all of the auto-complete history (leaving just ] ) and did the same for the replace history.Then I closed ST and re-started - Great!

There are other things that can be deleted (carefully) in the workspace file, such as file_history items, which can fix and speed-up things, whe'hay.

That's fine, but if anything at all occurs *after *the text that you're typing it will always put in 'document' . So if you are typing within brackets ( ) then we have an issue. To get around it for the moment we can just type 'alink' and let 'document' be added, or type what we need directly.

I'll need to work on my regex so that it only reads upto the current cursor position. It shouldn't be too tricky, but it might take me a little while. Andy.

I'll need to test it a bit more and then I'll update my file tomorrow.

Basically, it means that typing 'something.testt' should become 'something.testThis', not matter where you type it; that is, even if nested deeply within a statement or brackets. The only time it will (should!) become 'document.testThis' is if you type 'testt' without an initial dot.

This will be my last update, you might be pleased to hear , because I've got this GitHub thing working (link provided in previous post).

I have used abbreviations in the tab triggers by removing the bracketed text shown:Canvas 2(d)CanvasGrad(ient)Func(tion)Hist(ory)Navig(ator)

The purpose of this is to reduce the number of mis-hits when typing, without losing the ability to track down these specific objects. It also reduces the file size very slightly.

I've kept the full words Document, Window, Location, etc., because these terms are so familiar, and abbreviating them doesn't assist searching. However, I've removed the text 'Date' from the triggers. This is because it's much easier to type day, month, time, etc., or get, set, to, UTC. I've kept them for the static functions parse() and UTC() though.

I'm not intending to play with this any more (unless someone points out omissions or mistakes), as I want to play with Python! Regards, Andy.

This would require modifying the 'JavaScript.tmLanguage' file and your chosen theme-file. It's not straight-forward unfortunately . Alternatively, you might find an existing theme that includes specific JS syntax colours. If you find such a theme, you could modify its 'tmTheme' file to change some of the colour-numbers. I don't know which themes include JS colours

This would require modifying the 'JavaScript.tmLanguage' file and your chosen theme-file. It's not straight-forward unfortunately . Alternatively, you might find an existing theme that includes specific JS syntax colours. If you find such a theme, you could modify its 'tmTheme' file to change some of the colour-numbers. I don't know which themes include JS colours