rgieseke / ta-coffeescript

CoffeeScript module for Textadept.
http://rgieseke.github.com/ta-coffeescript/
3 stars 0 forks source link

Enabling the module? #1

Open girvo opened 9 years ago

girvo commented 9 years ago

Hey there.

Silliest question in the world, but how do I enable the module? I've cloned it into ~/.textadept/modules but I can't seem to get the annotations on error to trigger; Do I have to add something to my init.lua?

girvo commented 9 years ago

Ah, I see what's happening (sort of) -- on OS X, for some reason Textadept isn't looking at the /usr/local/bin path for binaries, so it's not finding coffee; this became apparent when I told it compile.

I symlinked the binary to /bin/ temporarily, and it compiled, but it's still not triggering the on-save event. Any ideas?

rgieseke commented 9 years ago

The command line options have changed … last year. There should be a workaround possible using the -p option or switching to coffeelint

--- a/init.lua
+++ b/init.lua
@@ -45,11 +45,11 @@ events.connect(events.FILE_AFTER_SAVE,
       local buffer = buffer
       buffer:annotation_clear_all()
       local filename = buffer.filename:iconv(_CHARSET, 'UTF-8')
-      local command = 'coffee -c -l '..filename
+      local command = 'coffee -p '..filename
       local p = io.popen(command..' 2>&1')
       local out = p:read('*all')
       p:close()
-      if out then
+      if out and out:match(filename) then
         local line, msg = out:match('.-:(%d+):%d-:(.+)')
         if line then
           line = line - 1 -- Scintilla line numbers start from 0.