sublimelsp / LSP-typescript

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

lsp broken #162

Closed airtonix closed 1 year ago

airtonix commented 1 year ago
LSP-typescript: file:///home/zenobius/.cache/sublime-text-3/Package%20Storage/LSP-typescript/17.7.1/typescript-language-server/node_modules/typescript-language-server/lib/lsp-server.js:165
LSP-typescript:         this.features.definitionLinkSupport = textDocument?.definition?.linkSupport && typescriptVersion.version?.gte(API.v270);
LSP-typescript:                                                            ^
LSP-typescript: 
> asdf current                                                                                                                                                                                                                                                                            
act             0.2.31          /home/zenobius/.tool-versions
age             ______          No version set. Run "asdf <global|shell|local> age <version>"
ansible         ______          No version set. Run "asdf <global|shell|local> ansible <version>"
awscli          2.7.9           /home/zenobius/.tool-versions
aws-copilot     1.19.0          /home/zenobius/.tool-versions
bats            1.6.0           /home/zenobius/Projects/Work/Reckon/Github/reckon-frontend/.tool-versions
bazel           ______          No version set. Run "asdf <global|shell|local> bazel <version>"
direnv          ______          No version set. Run "asdf <global|shell|local> direnv <version>"
earthly         ______          No version set. Run "asdf <global|shell|local> earthly <version>"
flux2           ______          No version set. Run "asdf <global|shell|local> flux2 <version>"
fzf             0.30.0          /home/zenobius/.tool-versions
github-cli      2.14.2          /home/zenobius/.tool-versions
golang          ______          No version set. Run "asdf <global|shell|local> golang <version>"
golangci-lint   ______          No version set. Run "asdf <global|shell|local> golangci-lint <version>"
goreleaser      ______          No version set. Run "asdf <global|shell|local> goreleaser <version>"
gradle          ______          No version set. Run "asdf <global|shell|local> gradle <version>"
java            adoptopenjdk-8.0.322+6 /home/zenobius/.tool-versions
just            ______          No version set. Run "asdf <global|shell|local> just <version>"
k3sup           ______          No version set. Run "asdf <global|shell|local> k3sup <version>"
kubeconform     ______          No version set. Run "asdf <global|shell|local> kubeconform <version>"
kubeval         ______          No version set. Run "asdf <global|shell|local> kubeval <version>"
kustomize       ______          No version set. Run "asdf <global|shell|local> kustomize <version>"
lua             ______          No version set. Run "asdf <global|shell|local> lua <version>"
neovim          stable          /home/zenobius/.tool-versions
nodejs          12.22.1         /home/zenobius/Projects/Work/Reckon/Github/reckon-frontend/.tool-versions
pnpm            5.18.9          /home/zenobius/Projects/Work/Reckon/Github/reckon-frontend/.tool-versions
poetry          ______          No version set. Run "asdf <global|shell|local> poetry <version>"
python          3.9.5 anaconda3-2018.12 /home/zenobius/.tool-versions
ruby            ______          No version set. Run "asdf <global|shell|local> ruby <version>"
rust            ______          No version set. Run "asdf <global|shell|local> rust <version>"
sops            ______          No version set. Run "asdf <global|shell|local> sops <version>"
yarn            1.22.11         /home/zenobius/.tool-versions
yq              ______          No version set. Run "asdf <global|shell|local> yq <version>"
> cat .tool-versions
nodejs 12.22.1
pnpm 5.18.9
bats 1.6.0

Troubleshooting: LSP-typescript

Version

file:///home/zenobius/.cache/sublime-text-3/Package%20Storage/LSP-typescript/17.7.1/typescript-language-server/node_modules/typescript-language-server/lib/lsp-server.js:165
        this.features.definitionLinkSupport = textDocument?.definition?.linkSupport && typescriptVersion.version?.gte(API.v270);
                                                           ^

SyntaxError: Unexpected token '.'
    at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)

Server Configuration

Active view

Project / Workspace

LSP configuration

{
  "diagnostics_gutter_marker": "dot", 
  "diagnostics_highlight_style": {
    "error": "box", 
    "hint": "box", 
    "info": "box", 
    "warning": "box"
  }, 
  "document_highlight_style": "background", 
  "log_debug": true, 
  "log_server": [
    "panel"
  ], 
  "lsp_code_actions_on_save": {
    "source.fixAll": true, 
    "source.fixAll.eslint": true, 
    "source.organizeImports": true
  }, 
  "lsp_format_on_save": true, 
  "show_code_lens": "annotation", 
  "show_diagnostics_panel_on_save": 1, 
  "show_references_in_quick_panel": true
}

System PATH

how do i roll back to a version of lsp-typescript that works with my projects nodejs version?

predragnikolic commented 1 year ago

The node version you are using is nodejs 12.22.1. And the typescript language server after v1 requires minimum node version to be 14.

A) upgrade node to v14 B) let LSP handle the node version, by deleting

[
  "~/.asdf/shims/node", 
  "${server_path}", 
  "--stdio"
]

LSP will prompt you with a modal that has a Install NodeJS button, click that button and that will install the appropriate NodeJS version.

airtonix commented 1 year ago

The node version you are using is nodejs 12.22.1. And the typescript language server after v1 requires minimum node version to be 14.

A) upgrade node to v14 B) let LSP handle the node version, by deleting

[
  "~/.asdf/shims/node", 
  "${server_path}", 
  "--stdio"
]

LSP will prompt you with a modal that has a Install NodeJS button, click that button and that will install the appropriate NodeJS version.

I don't want LSP to handle the node version, it's super important that typechecking/linting/etc in the editor occur on the same nodejs version that the project uses.

rchl commented 1 year ago

No, it's not really important. It's important that the typescript is used from the project. Node version doesn't really make a difference. Or at least i can't think of any specific case where it would make a difference for this server.

rchl commented 1 year ago

And if you don't agree (I've just realized who you are) then install the last version of typescript-language-server that worked with node 12 and replace ${server_path} with a path to it.

joshmfrankel commented 1 month ago

LSP will prompt you with a modal that has a Install NodeJS button, click that button and that will install the appropriate NodeJS version.

This worked well for me 💯. I use asdf-vm as well