neovim / neovim

Vim-fork focused on extensibility and usability
https://neovim.io
Other
82.22k stars 5.62k forks source link

TSServer is not working #13508

Closed parker789 closed 3 years ago

parker789 commented 3 years ago

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

- language server name/version:

:LspInstallInfo { tsserver = { bin_dir = "/home/xxx/.cache/nvim/lspconfig/tsserver/node_modules/.bin", binaries = { ["typescript-language-server"] = "/home/xxx/.cache/nvim/lspconfig/tsserver/node_modules/.bin/typescript-language-server" }, install_dir = "/home/xxx/.cache/nvim/lspconfig/tsserver", is_installed = true } }


- Operating system/version:
`Linux xxx 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64 GNU/Linux`

<details>
<summary>nvim -c ":checkhealth nvim lspconfig"</summary>

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $COLORTERM='truecolor'

## tmux
  - OK: escape-time: 1
  - INFO: Checking stuff
  - OK: focus-events: on
  - INFO: $TERM: tmux-256color

health#lspconfig#check
========================================================================
## Checking language server protocol configuration
  - INFO: tsserver: configuration checked.

</details>

<details>
<summary>lsp.log</summary>

[ WARN ] 2020-12-10T18:37:29-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/implementation is not supported by any of the servers registered for the current buffer"
[ WARN ] 2020-12-10T18:37:59-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/declaration is not supported by any of the servers registered for the current buffer"

[ WARN ] 2020-12-10T18:50:14-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/documentSymbol is not supported by any of the servers registered for the current buffer"

[ WARN ] 2020-12-10T18:57:04-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/declaration is not supported by any of the servers registered for the current buffer"
[ WARN ] 2020-12-10T18:57:06-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/documentSymbol is not supported by any of the servers registered for the current buffer"

[ WARN ] 2020-12-10T18:58:40-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/declaration is not supported by any of the servers registered for the current buffer"
[ WARN ] 2020-12-10T18:58:42-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/documentSymbol is not supported by any of the servers registered for the current buffer"

[ INFO ] 2020-12-10T19:08:32-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:978 ] "exit_handler"  {}

[ INFO ] 2020-12-10T19:09:01-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:311 ] "Starting RPC client"   {  args = { "--stdio" },  cmd = "/home/xxx/.cache/nvim/lspconfig/tsserver/node_modules/.bin/typescript-language-server",  extra = {}}
[ DEBUG ] 2020-12-10T19:09:01-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:609 ]    "LSP[tsserver]" "initialize_params" {  capabilities = {    callHierarchy = {      dynamicRegistration = false,      <metatable> = <1>{        __tostring = <function 1>      }    },    textDocument = {      codeAction = {        codeActionLiteralSupport = {          codeActionKind = {            valueSet = { "", "RefactorInline", "source.organizeImports", "quickfix", "QuickFix", "Refactor", "Source", "RefactorRewrite", "refactor.inline", "RefactorExtract", "source", "SourceOrganizeImports", "refactor", "Empty", "refactor.rewrite", "refactor.extract" },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        dynamicRegistration = false,        <metatable> = <table 1>      },      completion = {        completionItem = {          commitCharactersSupport = false,          deprecatedSupport = false,          documentationFormat = { "markdown", "plaintext" },          preselectSupport = false,          snippetSupport = false,          <metatable> = <table 1>        },        completionItemKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },          <metatable> = <table 1>        },        contextSupport = false,        dynamicRegistration = false,        <metatable> = <table 1>      },      declaration = {        linkSupport = true,        <metatable> = <table 1>      },      definition = {        linkSupport = true,        <metatable> = <table 1>      },      documentHighlight = {        dynamicRegistration = false,        <metatable> = <table 1>      },      documentSymbol = {        dynamicRegistration = false,        hierarchicalDocumentSymbolSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      hover = {        contentFormat = { "markdown", "plaintext" },        dynamicRegistration = false,        <metatable> = <table 1>      },      implementation = {        linkSupport = true,        <metatable> = <table 1>      },      references = {        dynamicRegistration = false,        <metatable> = <table 1>      },      rename = {        dynamicRegistration = false,        prepareSupport = true,        <metatable> = <table 1>      },      signatureHelp = {        dynamicRegistration = false,        signatureInformation = {          documentationFormat = { "markdown", "plaintext" },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      synchronization = {        didSave = true,        dynamicRegistration = false,        willSave = false,        willSaveWaitUntil = false,        <metatable> = <table 1>      },      typeDefinition = {        linkSupport = true,        <metatable> = <table 1>      },      <metatable> = <table 1>    },    workspace = {      applyEdit = true,      configuration = true,      symbol = {        dynamicRegistration = false,        hierarchicalWorkspaceSymbolSupport = true,        symbolKind = {          valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 },          <metatable> = <table 1>        },        <metatable> = <table 1>      },      workspaceFolders = true,      <metatable> = <table 1>    }  },  initializationOptions = vim.empty_dict(),  processId = 7993,  rootPath = "/home/xxx/dev/3cclone",  rootUri = "file:///home/xxx/dev/3cclone",  trace = "off",  workspaceFolders = { {      name = "/home/xxx/dev/3cclone",      uri = "file:///home/xxx/dev/3cclone"    } }}
[ DEBUG ] 2020-12-10T19:09:01-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:388 ]    "rpc.send.payload"  {  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      callHierarchy = {        dynamicRegistration = false,        <metatable> = <1>{          __tostring = <function 1>        }      },      textDocument = {        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "RefactorInline", "source.organizeImports", "quickfix", "QuickFix", "Refactor", "Source", "RefactorRewrite", "refactor.inline", "RefactorExtract", "source", "SourceOrganizeImports", "refactor", "Empty", "refactor.rewrite", "refactor.extract" },              <metatable> = <table 1>            },            <metatable> = <table 1>          },          dynamicRegistration = false,          <metatable> = <table 1>        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = false,            documentationFormat = { "markdown", "plaintext" },            preselectSupport = false,            snippetSupport = false,            <metatable> = <table 1>          },          completionItemKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 },            <metatable> = <table 1>          },          contextSupport = false,          dynamicRegistration = false,          <metatable> = <table 1>        },        declaration = {          linkSupport = true,          <metatable> = <table 1>        },        definition = {          linkSupport = true,          <metatable> = <table 1>        },        documentHighlight = {          dynamicRegistration = false,          <metatable> = <table 1>        },        documentSymbol = {          dynamicRegistration = false,          hierarchicalDocumentSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = false,          <metatable> = <table 1>        },        implementation = {          linkSupport = true,          <metatable> = <table 1>        },        references = {          dynamicRegistration = false,          <metatable> = <table 1>        },        rename = {          dynamicRegistration = false,          prepareSupport = true,          <metatable> = <table 1>        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            documentationFormat = { "markdown", "plaintext" },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = false,          willSaveWaitUntil = false,          <metatable> = <table 1>        },        typeDefinition = {          linkSupport = true,          <metatable> = <table 1>        },        <metatable> = <table 1>      },      workspace = {        applyEdit = true,        configuration = true,        symbol = {          dynamicRegistration = false,          hierarchicalWorkspaceSymbolSupport = true,          symbolKind = {            valueSet = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 },            <metatable> = <table 1>          },          <metatable> = <table 1>        },        workspaceFolders = true,        <metatable> = <table 1>      }    },    initializationOptions = vim.empty_dict(),    processId = 7993,    rootPath = "/home/xxx/dev/3cclone",    rootUri = "file:///home/xxx/dev/3cclone",    trace = "off",    workspaceFolders = { {        name = "/home/xxx/dev/3cclone",        uri = "file:///home/xxx/dev/3cclone"      } }  }}
[ DEBUG ] 2020-12-10T19:09:01-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ]    "decoded"   {  error = {    code = -32603,    message = "Request initialize failed with message: Couldn't find 'tsserver' executable or 'tsserver.js' module"  },  id = 1,  jsonrpc = "2.0"}
[ WARN ] 2020-12-10T19:09:34-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:85 ]  "method textDocument/documentSymbol is not supported by any of the servers registered for the current buffer"
[ DEBUG ] 2020-12-10T19:09:34-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:297 ]   "default_handler"   "textDocument/documentSymbol"   {  err = {    code = -32601,    message = "method textDocument/documentSymbol is not supported by any of the servers registered for the current buffer",    <metatable> = {      __tostring = <function 1>    }  },  params = 0}
[ INFO ] 2020-12-10T19:09:54-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp.lua:978 ] "exit_handler"  {}

</details>

### Actual behaviour

`:lua vim.lsp.buf.document_symbol()`

E5108: Error executing lua /usr/local/share/nvim/runtime/lua/vim/lsp/handlers.lua:302: RPC[Error] code_name = MethodNotFound, message =
"method textDocument/documentSymbol is not supported by any of the servers registered for the current buffer"

`:lua print(vim.inspect(vim.lsp.buf_get_clients()))`

{}

### Expected behaviour

It works! :)
teto commented 3 years ago

apparently the server doesn't support textDocument/documentSymbol so nothing we can do there.

parker789 commented 3 years ago

@teto - shouldn't my :lua print(vim.inspect(vim.lsp.buf_get_clients())) command output the language server, instead of just {}? It seems that the problem here isn't with your comment, but with the fact that tsserver isn't actually loading?

teto commented 3 years ago

the log shows it can't start tsserver apparently.

[ DEBUG ] 2020-12-10T19:09:01-0500 ] /usr/local/share/nvim/runtime/lua/vim/lsp/rpc.lua:489 ] "decoded" { error = { code = -32603, message = "Request initialize failed with message: Couldn't find 'tsserver' executable or 'tsserver.js' module" }, id = 1, jsonrpc = "2.0"}
parker789 commented 3 years ago

Yeah, and I haven't installed anything manually. This is all using :LspInstall tsserver, which from the output in my initial post shows that it's installed correctly

teto commented 3 years ago

I recommand to install tsserver on your own. lspconfig tries to do too much and I hope we can get rid of LspInstall tsserver.

parker789 commented 3 years ago

Seems that it was a simple issue in that I didn't have typescript installed globally: npm install -g typescript. It'd probably be helpful to add that into the documentation for setting things up!

With your last comment, I'd gladly install tsserver manually, but is there documentation regarding setting binary paths, or would everything have to be in my path?

teto commented 3 years ago

that's the thing, there are just so many ways and every setup is different that we can't ensure LspInstall SERVER works. Either the server binary is in PATH and yhou can just reference its name or it's not and you have to use the full path. business as usual :)

parker789 commented 3 years ago

;) haha, yep. thanks