Skip to content

Commit

Permalink
Add syntax exclusions. Also adds prefrence menu and settings file.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpidan committed Apr 6, 2017
1 parent 2a12577 commit bc8319b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions All Autocomplete.sublime-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
// An array of syntaxes to exclude from checking. Can be partial string, like "css"
// "exclude_scopes_from_complete_triggers": [
// "css",
// "scss"
// ]
}
35 changes: 35 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children": [
{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children": [
{
"caption": "All Autocomplete",
"children": [
{
"command": "open_file",
"args": {
"file": "${packages}/SublimeAllAutocomplete/All Autocomplete.sublime-settings"
},
"caption": "Settings – Default"
},
{
"command": "open_file",
"args": {
"file": "${packages}/User/All Autocomplete.sublime-settings"
},
"caption": "Settings – User"
}
]
}
]
}
]
}
]
9 changes: 9 additions & 0 deletions all_views_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import time
from os.path import basename

settings = sublime.load_settings('All Autocomplete.sublime-settings')
exclude_scopes = settings.get("exclude_scopes_from_complete_triggers", [])

# limits to prevent bogging down the system
MIN_WORD_SIZE = 3
MAX_WORD_SIZE = 50
Expand All @@ -19,6 +22,12 @@
class AllAutocomplete(sublime_plugin.EventListener):

def on_query_completions(self, view, prefix, locations):

# bypass if in ignored syntax list
for exclude_scope in exclude_scopes:
if view.scope_name(locations[0]).find(exclude_scope) != -1:
return

words = []

# Limit number of views but always include the active view. This
Expand Down

0 comments on commit bc8319b

Please sign in to comment.