Hi, and apologies if this is the wrong place for this, but I’ve been trying to setup the TypeScript LSP for a while and it seems to be throwing an error.
I’m running:
NVIM v0.5.0-dev+1123-g3fbff98cf
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
I created a very basic new index.ts file and a tsconfig.json in a new directory and it looks like the typescript lsp server is installed and attached properly from what I can tell.
None of the functions like :lua vim.lsp.buf.definition()
seem to be having any effect. I’ve also enabled debugging and have added the log output below.
LSP Logs
[ INFO ] 2021-03-06T05:35:47-0800 ] ...unt_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:311 ] "Starting RPC client" { args = { "--stdio" }, cmd = "typescript-language-server", extra = {}}
[ DEBUG ] 2021-03-06T05:35:47-0800 ] .../.mount_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp.lua:633 ] "LSP[tsserver]" "initialize_params" { capabilities = { callHierarchy = { dynamicRegistration = false, <metatable> = <1>{ __tostring = <function 1> } }, textDocument = { codeAction = { codeActionLiteralSupport = { codeActionKind = { valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }, <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> }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 }, <metatable> = <table 1> }, <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> }, window = { showDocument = { support = false, <metatable> = <table 1> }, showMessage = { messageActionItem = { additionalPropertiesSupport = false, <metatable> = <table 1> }, <metatable> = <table 1> }, workDoneProgress = true, <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> } }, clientInfo = { name = "Neovim", version = "0.5.0" }, initializationOptions = vim.empty_dict(), processId = 30089, rootPath = "/home/alex/Documents/lsp-test", rootUri = "file:///home/alex/Documents/lsp-test", trace = "off", workspaceFolders = { { name = "/home/alex/Documents/lsp-test", uri = "file:///home/alex/Documents/lsp-test" } }}
[ DEBUG ] 2021-03-06T05:35:47-0800 ] ...unt_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "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 = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }, <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> }, publishDiagnostics = { relatedInformation = true, tagSupport = { valueSet = { 1, 2 }, <metatable> = <table 1> }, <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> }, window = { showDocument = { support = false, <metatable> = <table 1> }, showMessage = { messageActionItem = { additionalPropertiesSupport = false, <metatable> = <table 1> }, <metatable> = <table 1> }, workDoneProgress = true, <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> } }, clientInfo = { name = "Neovim", version = "0.5.0" }, initializationOptions = vim.empty_dict(), processId = 30089, rootPath = "/home/alex/Documents/lsp-test", rootUri = "file:///home/alex/Documents/lsp-test", trace = "off", workspaceFolders = { { name = "/home/alex/Documents/lsp-test", uri = "file:///home/alex/Documents/lsp-test" } } }}
[ DEBUG ] 2021-03-06T05:35:47-0800 ] ...unt_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:492 ] "decoded" { id = 1, jsonrpc = "2.0", result = { capabilities = { callsProvider = true, codeActionProvider = true, completionProvider = { resolveProvider = true, triggerCharacters = { ".", '"', "'", "/", "@", "<" } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentRangeFormattingProvider = true, documentSymbolProvider = true, executeCommandProvider = { commands = { "_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = true, signatureHelpProvider = { triggerCharacters = { "(", ",", "<" } }, textDocumentSync = 2, typeDefinitionProvider = true, workspaceSymbolProvider = true } }}
[ DEBUG ] 2021-03-06T05:35:47-0800 ] ...unt_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { jsonrpc = "2.0", method = "initialized", params = { [true] = 6 }}
[ DEBUG ] 2021-03-06T05:35:47-0800 ] .../.mount_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp.lua:660 ] "LSP[tsserver]" "server_capabilities" { callsProvider = true, codeActionProvider = true, completionProvider = { resolveProvider = true, triggerCharacters = { ".", '"', "'", "/", "@", "<" } }, definitionProvider = true, documentFormattingProvider = true, documentHighlightProvider = true, documentRangeFormattingProvider = true, documentSymbolProvider = true, executeCommandProvider = { commands = { "_typescript.applyWorkspaceEdit", "_typescript.applyCodeAction", "_typescript.applyRefactoring", "_typescript.organizeImports", "_typescript.applyRenameFile" } }, foldingRangeProvider = true, hoverProvider = true, implementationProvider = true, referencesProvider = true, renameProvider = true, signatureHelpProvider = { triggerCharacters = { "(", ",", "<" } }, textDocumentSync = 2, typeDefinitionProvider = true, workspaceSymbolProvider = true}
[ INFO ] 2021-03-06T05:35:47-0800 ] .../.mount_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp.lua:661 ] "LSP[tsserver]" "initialized" { resolved_capabilities = { call_hierarchy = false, code_action = true, completion = true, declaration = false, document_formatting = true, document_highlight = true, document_range_formatting = true, document_symbol = true, execute_command = true, find_references = true, goto_definition = true, hover = true, implementation = true, rename = true, signature_help = true, signature_help_trigger_characters = { "(", ",", "<" }, text_document_did_change = 2, text_document_open_close = true, text_document_save = true, text_document_save_include_text = false, text_document_will_save = false, text_document_will_save_wait_until = false, type_definition = true, workspace_folder_properties = { changeNotifications = false, supported = false }, workspace_symbol = true }}
[ DEBUG ] 2021-03-06T05:35:47-0800 ] ...unt_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:391 ] "rpc.send.payload" { jsonrpc = "2.0", method = "textDocument/didOpen", params = { textDocument = { languageId = "typescript", text = "const a = { z: 19 };\n\nconsole.log(a);\n", uri = "file:///home/alex/Documents/lsp-test/index.ts", version = 0 } }}
[ ERROR ] 2021-03-06T05:35:48-0800 ] ...unt_vimcskqip/usr/share/nvim/runtime/lua/vim/lsp/rpc.lua:458 ] "rpc" "typescript-language-server" "stderr" "(node:30097) UnhandledPromiseRejectionWarning: Error: write EPIPE\n at afterWriteDispatched (internal/stream_base_commons.js:78:25)\n at writeGeneric (internal/stream_base_commons.js:73:3)\n at Socket._writeGeneric (net.js:714:5)\n at Socket._write (net.js:726:8)\n at doWrite (_stream_writable.js:415:12)\n at writeOrBuffer (_stream_writable.js:399:5)\n at Socket.Writable.write (_stream_writable.js:299:11)\n at TspClient.sendMessage (/usr/local/lib/node_modules/typescript-language-server/lib/tsp-client.js:100:33)\n at TspClient.request (/usr/local/lib/node_modules/typescript-language-server/lib/tsp-client.js:68:14)\n at LspServer.<anonymous> (/usr/local/lib/node_modules/typescript-language-server/lib/lsp-server.js:195:45)\n(node:30097) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)\n(node:30097) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.\n"