Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Make tide-tsserver-executable use relative paths #59

Closed
nahuel opened this Issue Sep 6, 2016 · 7 comments

Comments

Projects
None yet
3 participants

nahuel commented Sep 6, 2016

If your TS projects always have typescript as an npm devDependency, then it will be nice to do:

(setq tide-tsserver-executable "node_modules/typescript/bin/tsserver")

and make tide always use the local tsserver from each project.

Owner

ananthakumaran commented Sep 12, 2016 edited

@nahuel I just tested it locally, and relative path works fine for me. Tide starts different server for each project, so the config you have mentioned should work fine. I will clarify the documentation bit more. Let me know if you run into any issues.

nahuel commented Sep 14, 2016

Is not working for me, steps to reproduce the problem:

Emacs config:

(setq tide-tsserver-executable "node_modules/typescript/bin/tsserver")  

Project creation:

mkdir /tmp/a
cd /tmp/a
npm init -y
npm install --save-dev typescript
./node_modules/typescript/bin/tsc -init
touch a.ts

Now open /tmp/a/a.ts in emacs, it shows:

(a) Starting tsserver...
File mode specification error: (file-error "Searching for program" "no such file or directory" "node_modules/typescript/bin/tsserver")

using tide-20160830.2120 the error shows when you open the file, using tide-20160911.2207 is showed when you save the file. Or use M-x tide-restart-server to show it

Owner

ananthakumaran commented Sep 15, 2016

I can't reproduce the problem. Maybe I have some config that adds the current default-directory to the exec-path?. Can you provide your emacs version?. I will try to analyze the problem.

lzhoucs commented Sep 25, 2016

I had the exact same issue when I tried to add tide-tsserver-executable. But when I tried adding tide-tsserver-directory, it worked!

 (setq tide-tsserver-directory "node_modules/typescript/lib")

ananthakumaran added a commit that referenced this issue Sep 29, 2016

Owner

ananthakumaran commented Sep 29, 2016

can you try master and see if this problem is fixed? I am expanding the file beforehand, so relative paths should be resolved correctly.

nahuel commented Oct 2, 2016

it seems to work ok with master! thanks @ananthakumaran! Just for future reference, I'm using:

(setq tide-tsserver-executable "node_modules/typescript/bin/tsserver"
      tide-tsserver-directory  "node_modules/typescript/lib")
Owner

ananthakumaran commented Oct 3, 2016

Thanks, I will close this issue. Setting tide-tsserver-directory is not necessary if you set the value of tide-tsserver-executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment