Skip to content

Commit

Permalink
CFLIB now pulls udfs in. Also removes the carraige return "CR" from d…
Browse files Browse the repository at this point in the history
…isplaying at the end of everyline.
  • Loading branch information
tkelley committed Sep 17, 2013
1 parent 2e3b686 commit fca7f71
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions coldfusion-plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ class ShowCflibCommand(sublime_plugin.WindowCommand):
cflib_category_url = r"http://www.cflib.org/api/api.cfc?method=getlibraries&returnformat=json"
cflib_udfs_url = r"http://www.cflib.org/api/api.cfc?method=getudfs&returnformat=json&libraryid="
cflib_udf_url = r"http://www.cflib.org/api/api.cfc?method=getudf&returnFormat=json&udfid="
libIndex = -1

def run(self):
global libs, udfs
Expand All @@ -169,6 +170,7 @@ def run(self):
sublime.set_timeout(lambda:self.window.show_quick_panel([[v] for k, v in (libs)], self.on_select_library), 10)

def on_select_library(self, index):
self.libIndex = index
if index == -1:
return
if not index in udfs:
Expand All @@ -179,7 +181,7 @@ def on_select_udf(self, index):
if index == -1:
self.run()
else:
code = str(self.fetch_json(self.cflib_udf_url + str(udfs[index][0][0]))['CODE'])
code = str(self.fetch_json(self.cflib_udf_url + str(udfs[self.libIndex][index][0]))['CODE'])
self.window.active_view().run_command("insert_udf", {"code":code})

def fetch_json(self,url):
Expand All @@ -190,7 +192,7 @@ def fetch_json(self,url):
class InsertUdfCommand(sublime_plugin.TextCommand):
def run(self, edit, code):
for region in self.view.sel():
self.view.replace(edit, region, code)
self.view.replace(edit, region, code.replace("\r",""))


# *****************************************************************************************
Expand Down

0 comments on commit fca7f71

Please sign in to comment.