sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

lsp broken

airtonix opened this issue · comments

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

  • LSP: 1.18.0
  • Sublime Text: 4134

Server Test Run

  • exit code: 1
  • output
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

  • command
[
  "~/.asdf/shims/node", 
  "${server_path}", 
  "--stdio"
]
  • shell command
/home/zenobius/.asdf/shims/node "/home/zenobius/.cache/sublime-text-3/Package Storage/LSP-typescript/17.7.1/typescript-language-server/node_modules/typescript-language-server/lib/cli.js" --stdio
  • selector
source.js, source.jsx, source.ts, source.tsx
  • priority_selector
source.js, source.jsx, source.ts, source.tsx
  • init_options
{
  "locale": "en", 
  "logVerbosity": "normal", 
  "maxTsServerMemory": 0, 
  "npmLocation": "", 
  "plugins": [], 
  "preferences": {
    "allowIncompleteCompletions": true, 
    "allowRenameOfImportPath": true, 
    "allowTextChangesInNewFiles": true, 
    "displayPartsForJSDoc": true, 
    "generateReturnInDocTemplate": true, 
    "includeAutomaticOptionalChainCompletions": true, 
    "includeCompletionsForImportStatements": true, 
    "includeCompletionsForModuleExports": true, 
    "includeCompletionsWithClassMemberSnippets": true, 
    "includeCompletionsWithInsertText": true, 
    "includeCompletionsWithObjectLiteralMethodSnippets": true, 
    "includeCompletionsWithSnippetText": true, 
    "jsxAttributeCompletionStyle": "auto", 
    "providePrefixAndSuffixTextForRename": true, 
    "useLabelDetailsInCompletionEntries": true
  }
}
  • settings
{
  "diagnostics": {
    "ignoredCodes": []
  }, 
  "javascript": {
    "format": {
      "insertSpaceAfterCommaDelimiter": true, 
      "insertSpaceAfterConstructor": false, 
      "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true, 
      "insertSpaceAfterKeywordsInControlFlowStatements": true, 
      "insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false, 
      "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, 
      "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, 
      "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, 
      "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, 
      "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, 
      "insertSpaceAfterSemicolonInForStatements": true, 
      "insertSpaceAfterTypeAssertion": false, 
      "insertSpaceBeforeAndAfterBinaryOperators": true, 
      "insertSpaceBeforeFunctionParenthesis": false, 
      "insertSpaceBeforeTypeAnnotation": false, 
      "placeOpenBraceOnNewLineForControlBlocks": false, 
      "placeOpenBraceOnNewLineForFunctions": false, 
      "semicolons": "ignore", 
      "trimTrailingWhitespace": true
    }, 
    "inlayHints": {
      "includeInlayEnumMemberValueHints": false, 
      "includeInlayFunctionLikeReturnTypeHints": false, 
      "includeInlayFunctionParameterTypeHints": false, 
      "includeInlayParameterNameHints": "none", 
      "includeInlayParameterNameHintsWhenArgumentMatchesName": false, 
      "includeInlayPropertyDeclarationTypeHints": false, 
      "includeInlayVariableTypeHints": false
    }
  }, 
  "typescript": {
    "format": {
      "insertSpaceAfterCommaDelimiter": true, 
      "insertSpaceAfterConstructor": false, 
      "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true, 
      "insertSpaceAfterKeywordsInControlFlowStatements": true, 
      "insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false, 
      "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false, 
      "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": true, 
      "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false, 
      "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false, 
      "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false, 
      "insertSpaceAfterSemicolonInForStatements": true, 
      "insertSpaceAfterTypeAssertion": false, 
      "insertSpaceBeforeAndAfterBinaryOperators": true, 
      "insertSpaceBeforeFunctionParenthesis": false, 
      "insertSpaceBeforeTypeAnnotation": false, 
      "placeOpenBraceOnNewLineForControlBlocks": false, 
      "placeOpenBraceOnNewLineForFunctions": false, 
      "semicolons": "insert", 
      "trimTrailingWhitespace": true
    }, 
    "inlayHints": {
      "includeInlayEnumMemberValueHints": false, 
      "includeInlayFunctionLikeReturnTypeHints": false, 
      "includeInlayFunctionParameterTypeHints": false, 
      "includeInlayParameterNameHints": "all", 
      "includeInlayParameterNameHintsWhenArgumentMatchesName": false, 
      "includeInlayPropertyDeclarationTypeHints": false, 
      "includeInlayVariableTypeHints": true
    }
  }
}
  • env
{
  "PATH": "/home/zenobius/.asdf/shims:/home/zenobius/.asdf/shims:"
}

Active view

  • File name
/home/zenobius/Projects/Work/Reckon/Github/reckon-frontend/infrastructure/config/config.ts
  • Settings
{
  "auto_complete_selector": "meta.tag, source - comment - string.quoted.double.block - string.quoted.single.block - string.unquoted.heredoc", 
  "lsp_active": null, 
  "syntax": "Packages/JavaScript/TypeScript.sublime-syntax"
}
  • base scope
source.ts

Project / Workspace

  • folders
[
  "/home/zenobius/Projects/Work/Reckon/Github/reckon-frontend"
]
  • is project: False

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

  • /home/zenobius/.asdf/shims
  • /home/zenobius/.asdf/bin
  • /home/zenobius/Applications
  • /home/zenobius/.local/share/bin
  • /home/zenobius/.local/bin
  • /usr/lib64/qt-3.3/bin
  • /usr/lib64/ccache
  • /usr/local/sbin
  • /usr/local/bin
  • /root/.android/android-sdk-linux/build-tools/23.0.2
  • /root/.android/android-sdk-linux/tools/
  • /root/.android/android-sdk-linux/build-tools/
  • /root/.android/android-sdk-linux/platform-tools/
  • /usr/sbin
  • /usr/bin
  • /sbin
  • /bin
  • /usr/games
  • /var/lib/snapd/snap/bin
  • /home/zenobius/Projects/Mine/Github/clusterfiles
  • /home/zenobius/.local/share/android/sdk/emulator
  • /home/zenobius/.local/share/android/sdk/tools
  • /home/zenobius/.local/share/android/sdk/tools/bin
  • /home/zenobius/.local/share/android/sdk/platform-tools
  • /home/zenobius/Projects/Mine/Github/clusterfiles

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

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.

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.

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.

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.