justinmahar / SublimeCSAutocompletePlus

CoffeeScript autocompletions and more!
172 stars 12 forks source link

Methods of "global" object #12

Open degorov opened 11 years ago

degorov commented 11 years ago

Using keywords file as you suggested in previous discussion is not very comfortable - it pops up without using Ctrl+Tab and is annoying. Keywords (undefined...) and class names (Number...) are good at keywords file, but methods are definitely not :(

So, again :) Maybe Ctrl+Tab on "nothing" should pop-up the list of them?

decodeURI(encURI)
decodeURIComponent(encURI)
encodeURI(URI)
encodeURIComponent(str)
eval(str)
isFinite(num)
isNaN(val)
parseFloat(str)
parseInt(str)
parseInt(str, radix)

I don't think we must bother about some extra logic here - those methods can be used anywhere. If completions[] array is empty after all - let's fill the completions[] array with global methods. Something like this in coffee_utils.py ?

+    if not completions:
+        # Suggest globals
+        ......

    # Remove all duplicates
    completions = list(set(completions))
    # Sort
    completions.sort()
    return completions

And global methods will just be added to CoffeeComplete Plus Built-In Types.sublime-settings file.