clausreinke / typescript-tools

(repo no longer active) Tools related to the TypeScript language
Apache License 2.0
266 stars 29 forks source link

Error detected while processing function TSSstart #31

Closed arnm closed 10 years ago

arnm commented 10 years ago

I try to run the TSSstarthere in vim but I get the following:

starting TSS, loading app/scripts/app.ts... ['tss', 'app/scripts/app.ts'] Error detected while processing function TSSstart...TSSshowErrors: line 16: TSS not running

I'm on Manjaro Linux (Arch based)

copied this into my .vimrc

au BufRead,BufNewFile *.ts setlocal filetype=typescript set rtp+=/usr/lib/node_modules/typescript-tools/

it runs fine in in the terminal if I type the 'tss' command but not in the latest version of Vim

clausreinke commented 10 years ago

I can't test on Linux, but it is a bit strange that this error shows up so late - aren't there any error message before this one? Something is going wrong when trying to run the tss script (no shell is used to run it, so it being on the PATH is not sufficient). You can try setting g:TSS to include the full path, and to run it via the node executable, something like let g:TSS=["node","<path to tss.js>"].

noisysocks commented 10 years ago

Having the exact same issue. I'm running OS X 10.9, and have removed all other vim plugins and have set g:TSS to ["/usr/local/bin/tss"].

If I set g:TSS to ["/usr/local/bin/node", "/usr/local/lib/node_modules/typescript-tools/bin/tss.js"], then when I run :TSSstarthere it hangs on "starting TSS, loading blah.ts...".

clausreinke commented 10 years ago

The "starting .." line is the last Vim output before diving into node (via python). Just to rule out configuration issues in the Vim/python interface, could you try (in Vim):

:py import subprocess
:py print(subprocess.check_output(["node","--version"]))

(should print the node version number)

noisysocks commented 10 years ago

Yep, it printed v0.10.26.

clausreinke commented 10 years ago

curiouser and curiouser.. so when you run TSSstarthere with blah.ts open, it hangs directly after starting TSS, but when you run tss blah.ts on the commandline, it works? And both times the same version of tss and node?

Presumably, the following works, too?

:py print(subprocess.check_output(["node","<path-to>/typescript-tools/bin/tss.js","--version"],stderr=subprocess.STDOUT))

I'm momentarily out of ideas on how this could be, and I cannot debug on either of your platforms.

noisysocks commented 10 years ago

That's right. And yes, both same versions. And yes, that code successfully prints out 0.2.2-1, the same as tss --version does in the command line.

I'll give you the output of vim --version in case it gives you any ideas. It has the python feature though so not sure what it could be.

I inserted a print("hello") statement into the plugin. When running :TSSstarthere, it is not printed. Any ideas?

command! -nargs=1 TSSstart call TSSstart(<f-args>)
command! TSSstarthere call TSSstart(expand("%"))
function! TSSstart(projectroot)
echomsg "starting TSS, loading ".a:projectroot."..."
python <<EOF
print("hello")
import subprocess
import vim
import json
clausreinke commented 10 years ago

The python feature is about Vim calling into python (needs python installed). Vim plugins use it to keep an external subprocess alive and communicate with it (so tss doesn't have to reload your project every time you need some info). If you have the python feature and those :py(thon) commands worked, the only other thing from :version that might help is the version of the python dll.

If the :python commands we talked about earlier worked and your print doesn't, you may have several instances of the tss plugin (one you've modified, another one that your vim is loading). You can check which plugins have been loaded with :scriptnames.

noisysocks commented 10 years ago

Hi Claus. I confirmed that all of that was working, and that the correct scripts were appearing in :scriptnames.

While playing around, I removed the shell=True option from the call to subprocess.Popen and now everything works for me! Weird, though – any idea what's happening? The documentation for subprocess.Popen isn't giving me any clues, and I don't see why running this command through the system's shell would be any different.

clausreinke commented 10 years ago

Argh.. I hadn't noticed how old your tss version is (npm installed, I assume) - that was fixed months ago (slight differences in python's interpretation of subprocess calls on different platforms #18). You can use the github version for now, and I'm going to publish a newer version (~TS1.0) to npm over the next days.

noisysocks commented 10 years ago

Ah! Thanks for your help, Claus.