Skip to content

Commit

Permalink
set dictionary class using helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
atomi committed Jun 25, 2012
1 parent 8639943 commit bd1a5f7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 1 addition & 2 deletions ColdFusion.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// disables the verbose ColdFusion tag completions
"verbose_tag_completions": true,

// dictionary currently only accepts cf10
// planned are cfmlbd7, railo1, cf7, cf8, or cf9
// cf7, cf8, cf9, or cf10
"dictionary": "cf10"
}
24 changes: 13 additions & 11 deletions coldfusiontagcompletions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import sublime
import sublime_plugin

SETTINGS = sublime.load_settings('ColdFusion.sublime-settings')

def get_class():
kls = "taglib." + SETTINGS.get("dictionary") + ".tags"
parts = kls.split('.')
module = ".".join(parts[:-1])
m = __import__( module )
for comp in parts[1:]:
m = getattr(m, comp)
return m

class ColdFusionTagComplete(sublime_plugin.EventListener):
cflib = get_class()()
valid_scopes_tags = ["meta.tag.inline.cfml", "meta.tag.block.other.cfml", "meta.tag.block.function.cfml", "meta.tag.block.flow-control.cfml", "meta.tag.block.exceptions.cfml"]


Expand All @@ -27,14 +40,3 @@ def on_query_completions(self, view, prefix, locations):
if completions == []:
return
return (completions, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)

def get_class( kls ):
parts = kls.split('.')
module = ".".join(parts[:-1])
m = __import__( module )
for comp in parts[1:]:
m = getattr(m, comp)
return m

cflib = get_class('taglib.cf10.tags')()

0 comments on commit bd1a5f7

Please sign in to comment.