sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin
MIT License
132 stars 11 forks source link

Best way to have a project-specific server path (yarn pnp sdk) #187

Closed saveman71 closed 1 year ago

saveman71 commented 1 year ago

I'm trying to use yarn pnp, so my globally installed typescript has no idea of how the packages are installed.

Yarn offers what they call SDKs (https://yarnpkg.com/getting-started/editor-sdks) to work around this issue. It creates a new executable you can call instead of the one globally installed (other positive effect: the version is guaranteed to be exactly the same as the one you use in the project, and not some old one you installed globally years ago).

The path of the server is .yarn/sdks/typescript/bin/tsserver.

For now I add my absolute path before, this works OK while I work only on that project. How to set it, so it's relative to the project ?

saveman71 commented 1 year ago

NVM figured it out myself:

  "initializationOptions": {
    "tsserver.path": "${project_root}/.yarn/sdks/typescript/bin/tsserver",
  },