Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for typescript.tsdk with tsserverPath #6

Closed
angelozerr opened this issue Aug 14, 2017 · 3 comments
Closed

Support for typescript.tsdk with tsserverPath #6

angelozerr opened this issue Aug 14, 2017 · 3 comments

Comments

@angelozerr
Copy link

IMHO I think there are 2 problems with the tsserverPath:

  • By default tsserver.bat / tsserver is searched in the %PATH (when you install TypeScript in global npm registry). In my case I had a very old installed TypeScript and I was not able to consume navtree. I think tsserver.bat / tsserver should be searched at first time with require.resolve like this:
try {
    var tsserverPath = require.resolve(".bin/" + (utils.isWindows() ? 'tsserver.cmd' : 'tsserver'));
    this.options.tsserverPath = tsserverPath;        	
}
catch(error) {}

 this.tsServerClient = new tsServerClient_1.TsServerClient({
            tsserverPath: this.options.tsserverPath || (utils.isWindows() ? 'tsserver.cmd' : 'tsserver'),
            logFile: this.options.tsserverLogFile,
            logger: this.logger
        });

It will be more easy to use it with VSCode.

@prabirshrestha
Copy link
Owner

typescript.tsdk is specified in vscode settings file so this wouldn't be the best. If it was in editorconfig then it would be ok. I would rather have --tsserver-path /absolute/path/to/tsserver first and would let each editors implement their own.

I do have plans to add flags that looks something like this. --tsserver-resolve-strategy=vscode,node_modules,global. Given that I have seen lot of people checkin .vscode folder I think it is ok to to support .vscode settings. Might be we can even add custom so that each editor can implement only their resolve strategy. --tsserver-resolve-strategy=custom,vscode,node_modules,global --tsserver-custom-resolver=/path/to/resolve.js.

But first I need to support for basic args --version.

@prabirshrestha
Copy link
Owner

You can now use --tsserver-path to specific the path to tsserver. Need v0.0.14. Make sure to append .cmd for windows as langserver will not append it automatically for you.

C:\tmp\typescript-language-server>typescript-language-server --help

  Usage: typescript-language-server [options]


  Options:

    -V, --version           output the version number
    --stdio                 use stdio
    --node-ipc              use node-ipc
    --socket <port>         use socket. example: --socket=5000
    --tsserver-path <path>  absolute path to tsserver. example: --tsserver-path=c:\tsc\tsserver.cmd
    -h, --help              output usage information

For now I will leave this issue open since I would still like to support --tsserver-resolve-strategy=custom,vscode,node_modules,global --tsserver-custom-resolver=/path/to/resolve.js but this won't be enabled anytime soon. PRs welcomed for this one.

@prabirshrestha
Copy link
Owner

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

No branches or pull requests

2 participants