Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Volar crashes shortly after after startup #706

Closed
WhyNotHugo opened this issue Nov 17, 2021 · 20 comments
Closed

Volar crashes shortly after after startup #706

WhyNotHugo opened this issue Nov 17, 2021 · 20 comments
Labels

Comments

@WhyNotHugo
Copy link
Contributor

Volar seems to start fine, shows a few diagnostics, and then dies after a second or two.

I'm running it containerised (via podman). I looked at #514, but I'm not convinced I'm seeing the same issue.

This is all of neovim's debug output for the LSP:

[START][2021-11-17 18:23:37] LSP logging initiated
[INFO][2021-11-17 18:23:37] .../vim/lsp/rpc.lua:258	"Starting RPC client"	{  args = { "container", "run", "--interactive", "--network=none", "--workdir=/home/hugo/clones/gitlab.com/fotus/photostore/vue3", "--volume=/home/hugo/clones/gitlab.com/fotus/photostore/vue3:/home/hugo/clones/gitlab.com/fotus/photostore/vue3:ro", "volar" },  cmd = "podman",  extra = {}}
[DEBUG][2021-11-17 18:23:37] .../vim/lsp/rpc.lua:339	"rpc.send"	{  id = 1,  jsonrpc = "2.0",  method = "initialize",  params = {    capabilities = {      callHierarchy = {        dynamicRegistration = false      },      textDocument = {        codeAction = {          codeActionLiteralSupport = {            codeActionKind = {              valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }            }          },          dataSupport = true,          dynamicRegistration = false,          resolveSupport = {            properties = { "edit" }          }        },        completion = {          completionItem = {            commitCharactersSupport = false,            deprecatedSupport = false,            documentationFormat = { "markdown", "plaintext" },            preselectSupport = false,            snippetSupport = false          },          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 }          },          contextSupport = false,          dynamicRegistration = false        },        declaration = {          linkSupport = true        },        definition = {          linkSupport = true        },        documentHighlight = {          dynamicRegistration = false        },        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 }          }        },        hover = {          contentFormat = { "markdown", "plaintext" },          dynamicRegistration = false        },        implementation = {          linkSupport = true        },        publishDiagnostics = {          relatedInformation = true,          tagSupport = {            valueSet = { 1, 2 }          }        },        references = {          dynamicRegistration = false        },        rename = {          dynamicRegistration = false,          prepareSupport = true        },        signatureHelp = {          dynamicRegistration = false,          signatureInformation = {            activeParameterSupport = true,            documentationFormat = { "markdown", "plaintext" },            parameterInformation = {              labelOffsetSupport = true            }          }        },        synchronization = {          didSave = true,          dynamicRegistration = false,          willSave = false,          willSaveWaitUntil = false        },        typeDefinition = {          linkSupport = true        }      },      window = {        showDocument = {          support = false        },        showMessage = {          messageActionItem = {            additionalPropertiesSupport = false          }        },        workDoneProgress = true      },      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 }          }        },        workspaceEdit = {          resourceOperations = { "rename", "create", "delete" }        },        workspaceFolders = true      }    },    clientInfo = {      name = "Neovim",      version = "0.6.0"    },    initializationOptions = {      documentFeatures = {        documentColor = false,        documentFormatting = {          defaultPrintWidth = 100        },        documentSymbol = true,        foldingRange = true,        linkedEditingRange = true,        selectionRange = true      },      languageFeatures = {        callHierarchy = true,        codeAction = true,        codeLens = true,        completion = {          defaultAttrNameCase = "kebabCase",          defaultTagNameCase = "both"        },        definition = true,        diagnostics = true,        documentHighlight = true,        documentLink = true,        hover = true,        references = true,        rename = true,        renameFileRefactoring = true,        schemaRequestService = true,        semanticTokens = false,        signatureHelp = true,        typeDefinition = true      },      typescript = {        serverPath = "/home/hugo/clones/gitlab.com/fotus/photostore/vue3/node_modules/typescript/lib/tsserverlibrary.js"      }    },    processId = 1117809,    rootPath = "/home/hugo/clones/gitlab.com/fotus/photostore/vue3",    rootUri = "file:///home/hugo/clones/gitlab.com/fotus/photostore/vue3",    trace = "off",    workspaceFolders = { {        name = "/home/hugo/clones/gitlab.com/fotus/photostore/vue3",        uri = "file:///home/hugo/clones/gitlab.com/fotus/photostore/vue3"      } }  }}
[DEBUG][2021-11-17 18:23:37] .../lua/vim/lsp.lua:871	"LSP[null-ls]"	"server_capabilities"	{  codeActionProvider = true,  completionProvider = {    allCommitCharacters = {},    completionItem = {      labelDetailsSupport = true    },    resolveProvider = false,    triggerCharacters = { ".", ":", "-" }  },  documentFormattingProvider = true,  documentRangeFormattingProvider = true,  executeCommandProvider = true,  textDocumentSync = {    change = 1,    openClose = true,    save = true  }}
[INFO][2021-11-17 18:23:37] .../lua/vim/lsp.lua:872	"LSP[null-ls]"	"initialized"	{  resolved_capabilities = {    call_hierarchy = false,    code_action = true,    code_lens = false,    code_lens_resolve = false,    completion = true,    declaration = false,    document_formatting = true,    document_highlight = false,    document_range_formatting = true,    document_symbol = false,    execute_command = true,    find_references = false,    goto_definition = false,    hover = false,    implementation = false,    rename = false,    signature_help = false,    signature_help_trigger_characters = {},    text_document_did_change = 1,    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 = false,    workspace_folder_properties = {      changeNotifications = false,      supported = false    },    workspace_symbol = false  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:446	"rpc.receive"	{  id = 1,  jsonrpc = "2.0",  result = {    capabilities = {      callHierarchyProvider = true,      codeActionProvider = {        codeActionKinds = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.fixAll", "source.organizeImports" },        resolveProvider = true      },      codeLensProvider = {        resolveProvider = true      },      completionProvider = {        resolveProvider = true,        triggerCharacters = { ".", '"', "'", "`", "/", "<", "@", "#", " ", "<", ":", "@", ".", "/", ".", "@", "/", '"', ":" }      },      definitionProvider = true,      documentFormattingProvider = true,      documentHighlightProvider = true,      documentLinkProvider = {        resolveProvider = false      },      documentSymbolProvider = true,      executeCommandProvider = {        commands = { "volar.server.executeConvertToKebabCase", "volar.server.executeConvertToPascalCase", "volar.html-to-pug", "volar.pug-to-html", "volar.use-setup-sugar", "volar.unuse-setup-sugar", "volar.use-ref-sugar", "volar.unuse-ref-sugar", "volar.show-references" }      },      foldingRangeProvider = true,      hoverProvider = true,      linkedEditingRangeProvider = true,      referencesProvider = true,      renameProvider = {        prepareProvider = true      },      selectionRangeProvider = true,      signatureHelpProvider = {        retriggerCharacters = { ")" },        triggerCharacters = { "(", ",", "<" }      },      textDocumentSync = 2,      typeDefinitionProvider = true,      workspace = {        fileOperations = {          willRename = {            filters = { {                pattern = {                  glob = "**/*.vue"                }              }, {                pattern = {                  glob = "**/*.js"                }              }, {                pattern = {                  glob = "**/*.ts"                }              }, {                pattern = {                  glob = "**/*.jsx"                }              }, {                pattern = {                  glob = "**/*.tsx"                }              }, {                pattern = {                  glob = "**/*.json"                }              } }          }        }      }    }  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:339	"rpc.send"	{  jsonrpc = "2.0",  method = "initialized",  params = vim.empty_dict()}
[DEBUG][2021-11-17 18:23:39] .../lua/vim/lsp.lua:871	"LSP[volar]"	"server_capabilities"	{  callHierarchyProvider = true,  codeActionProvider = {    codeActionKinds = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.fixAll", "source.organizeImports" },    resolveProvider = true  },  codeLensProvider = {    resolveProvider = true  },  completionProvider = {    resolveProvider = true,    triggerCharacters = { ".", '"', "'", "`", "/", "<", "@", "#", " ", "<", ":", "@", ".", "/", ".", "@", "/", '"', ":" }  },  definitionProvider = true,  documentFormattingProvider = true,  documentHighlightProvider = true,  documentLinkProvider = {    resolveProvider = false  },  documentSymbolProvider = true,  executeCommandProvider = {    commands = { "volar.server.executeConvertToKebabCase", "volar.server.executeConvertToPascalCase", "volar.html-to-pug", "volar.pug-to-html", "volar.use-setup-sugar", "volar.unuse-setup-sugar", "volar.use-ref-sugar", "volar.unuse-ref-sugar", "volar.show-references" }  },  foldingRangeProvider = true,  hoverProvider = true,  linkedEditingRangeProvider = true,  referencesProvider = true,  renameProvider = {    prepareProvider = true  },  selectionRangeProvider = true,  signatureHelpProvider = {    retriggerCharacters = { ")" },    triggerCharacters = { "(", ",", "<" }  },  textDocumentSync = 2,  typeDefinitionProvider = true,  workspace = {    fileOperations = {      willRename = {        filters = { {            pattern = {              glob = "**/*.vue"            }          }, {            pattern = {              glob = "**/*.js"            }          }, {            pattern = {              glob = "**/*.ts"            }          }, {            pattern = {              glob = "**/*.jsx"            }          }, {            pattern = {              glob = "**/*.tsx"            }          }, {            pattern = {              glob = "**/*.json"            }          } }      }    }  }}
[INFO][2021-11-17 18:23:39] .../lua/vim/lsp.lua:872	"LSP[volar]"	"initialized"	{  resolved_capabilities = {    call_hierarchy = true,    code_action = {      codeActionKinds = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.fixAll", "source.organizeImports" },      resolveProvider = true    },    code_lens = true,    code_lens_resolve = true,    completion = true,    declaration = false,    document_formatting = true,    document_highlight = true,    document_range_formatting = false,    document_symbol = true,    execute_command = true,    find_references = true,    goto_definition = true,    hover = true,    implementation = false,    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 = false  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:339	"rpc.send"	{  jsonrpc = "2.0",  method = "textDocument/didOpen",  params = {    textDocument = {      languageId = "vue",      text = "<script setup lang=\"ts\">\n// This starter template is using Vue 3 <script setup> SFCs\n// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup\nimport HelloWorld from './components/HelloWorld.vue'\n</script>\n\n<template>\n  <img alt=\"Vue logo\" src=\"./assets/logo.png\" />\n  <HelloWorld msg=\"Hello Vue 3 + TypeScript + Vite\" />\n</template>\n\n<style>\n#app {\n  font-family: Avenir, Helvetica, Arial, sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  text-align: center;\n  color: #2c3e50;\n  margin-top: 60px;\n}\n</style>\n",      uri = "file:///home/hugo/clones/gitlab.com/fotus/photostore/vue3/src/App.vue",      version = 0    }  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:446	"rpc.receive"	{  id = 0,  jsonrpc = "2.0",  method = "workspace/configuration",  params = {    items = { {        section = "js/ts.implicitProjectConfig"      }, {        section = "javascript.implicitProjectConfig"      } }  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:456	"server_request: callback result"	{  result = { vim.NIL, vim.NIL },  status = true}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:339	"rpc.send"	{  id = 0,  jsonrpc = "2.0",  result = { vim.NIL, vim.NIL }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:446	"rpc.receive"	{  id = 1,  jsonrpc = "2.0",  method = "window/workDoneProgress/create",  params = {    token = "0c7a079c-9559-4888-8bdd-a05231f1655d"  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:456	"server_request: callback result"	{  result = vim.NIL,  status = true}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:339	"rpc.send"	{  id = 1,  jsonrpc = "2.0",  result = vim.NIL}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:446	"rpc.receive"	{  id = 2,  jsonrpc = "2.0",  method = "workspace/configuration",  params = {    items = { {        scopeUri = "file:///home/hugo/clones/gitlab.com/fotus/photostore/vue3/src/App.vue.template.css",        section = "css"      } }  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:456	"server_request: callback result"	{  result = { vim.NIL },  status = true}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:339	"rpc.send"	{  id = 2,  jsonrpc = "2.0",  result = { vim.NIL }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:446	"rpc.receive"	{  id = 3,  jsonrpc = "2.0",  method = "workspace/configuration",  params = {    items = { {        scopeUri = "file:///home/hugo/clones/gitlab.com/fotus/photostore/vue3/src/App.vue.0.css",        section = "css"      } }  }}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:456	"server_request: callback result"	{  result = { vim.NIL },  status = true}
[DEBUG][2021-11-17 18:23:39] .../vim/lsp/rpc.lua:339	"rpc.send"	{  id = 3,  jsonrpc = "2.0",  result = { vim.NIL }}
[INFO][2021-11-17 18:23:44] .../lua/vim/lsp.lua:1236	"exit_handler"	{ {    _null_ls_setup = true,    _on_attach = <function 1>,    attached_buffers = { true },    cancel_request = <function 2>,    config = {      _on_attach = <function 3>,      autostart = false,      capabilities = {        callHierarchy = {          dynamicRegistration = false        },        textDocument = {          codeAction = {            codeActionLiteralSupport = {              codeActionKind = {                valueSet = { "", "Empty", "QuickFix", "Refactor", "RefactorExtract", "RefactorInline", "RefactorRewrite", "Source", "SourceOrganizeImports", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }              }            },            dataSupport = true,            dynamicRegistration = false,            resolveSupport = {              properties = { "edit" }            }          },          completion = {            completionItem = {              commitCharactersSupport = false,              deprecatedSupport = false,              documentationFormat = { "markdown", "plaintext" },              preselectSupport = false,              snippetSupport = false            },            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 }            },            contextSupport = false,            dynamicRegistration = false          },          declaration = {            linkSupport = true          },          definition = {            linkSupport = true          },          documentHighlight = {            dynamicRegistration = false          },          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 }            }          },          hover = {            contentFormat = { "markdown", "plaintext" },            dynamicRegistration = false          },          implementation = {            linkSupport = true          },          publishDiagnostics = {            relatedInformation = true,            tagSupport = {              valueSet = { 1, 2 }            }          },          references = {            dynamicRegistration = false          },          rename = {            dynamicRegistration = false,            prepareSupport = true          },          signatureHelp = {            dynamicRegistration = false,            signatureInformation = {              activeParameterSupport = true,              documentationFormat = { "markdown", "plaintext" },              parameterInformation = {                labelOffsetSupport = true              }            }          },          synchronization = {            didSave = true,            dynamicRegistration = false,            willSave = false,            willSaveWaitUntil = false          },          typeDefinition = {            linkSupport = true          }        },        window = {          showDocument = {            support = false          },          showMessage = {            messageActionItem = {              additionalPropertiesSupport = false            }          },          workDoneProgress = true        },        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 }            }          },          workspaceEdit = {            resourceOperations = { "rename", "create", "delete" }          },          workspaceFolders = true        }      },      cmd = { "nvim" },      cwd = "/home/hugo/clones/gitlab.com/fotus/photostore",      filetypes = { "javascript", "typescript", "typescriptreact", "javascriptreact", "vue", "python", "sh", "zsh", "html", "scss", "json", "graphql", "less", "markdown", "yaml", "css", "lua" },      flags = {        debounce_text_changes = 250      },      get_language_id = <function 4>,      handlers = <1>{},      init_options = vim.empty_dict(),      log_level = 2,      message_level = 2,      name = "null-ls",      on_attach = <function 5>,      on_exit = <function 6>,      on_init = <function 7>,      root_dir = "/home/hugo/clones/gitlab.com/fotus/photostore",      settings = vim.empty_dict(),      workspace_folders = <2>{ {          name = "/home/hugo/clones/gitlab.com/fotus/photostore",          uri = "file:///home/hugo/clones/gitlab.com/fotus/photostore"        } },      <metatable> = <3>{        __tostring = <function 8>      }    },    handlers = <table 1>,    id = 1,    initialized = true,    is_stopped = <function 9>,    messages = {      messages = {},      name = "null-ls",      progress = {},      status = {}    },    name = "null-ls",    notify = <function 10>,    offset_encoding = "utf-16",    request = <function 11>,    request_sync = <function 12>,    requests = {},    resolved_capabilities = {      call_hierarchy = false,      code_action = true,      code_lens = false,      code_lens_resolve = false,      completion = true,      declaration = false,      document_formatting = true,      document_highlight = false,      document_range_formatting = true,      document_symbol = false,      execute_command = true,      find_references = false,      goto_definition = false,      hover = false,      implementation = false,      rename = false,      signature_help = false,      signature_help_trigger_characters = {},      text_document_did_change = 1,      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 = false,      workspace_folder_properties = {        changeNotifications = false,        supported = false      },      workspace_symbol = false    },    rpc = {      handle = {        is_closing = <function 13>,        kill = <function 14>      },      notify = <function 15>,      pid = 5001,      request = <function 16>    },    server_capabilities = {      codeActionProvider = true,      completionProvider = {        allCommitCharacters = {},        completionItem = {          labelDetailsSupport = true        },        resolveProvider = false,        triggerCharacters = { ".", ":", "-" }      },      documentFormattingProvider = true,      documentRangeFormattingProvider = true,      executeCommandProvider = true,      textDocumentSync = {        change = 1,        openClose = true,        save = true      }    },    stop = <function 17>,    supports_method = <function 18>,    workspaceFolders = <table 2>,    workspace_did_change_configuration = <function 19>  } }

I'm actualy just using the same project generated via npm init vite@latest, and the picking vue-ts. I haven't made any changes to it.

This is the Dockerfile for the container I'm using:

FROM alpine:3.13.5

RUN apk add --no-cache  nodejs npm
RUN npm install -g @volar/server

CMD [ "volar-server", "--stdio" ]

Any hints on what could be up?

@WhyNotHugo
Copy link
Contributor Author

I've intercepted all stdin and stdout:

stdin:

Content-Length: 3431

{"params":{"trace":"off","workspaceFolders":[{"uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/fotus\/photostore\/vue3","name":"\/home\/hugo\/clones\/gitlab.com\/fotus\/photostore\/vue3"}],"capabilities":{"window":{"workDoneProgress":true,"showDocument":{"support":false},"showMessage":{"messageActionItem":{"additionalPropertiesSupport":false}}},"callHierarchy":{"dynamicRegistration":false},"textDocument":{"references":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":true,"tagSupport":{"valueSet":[1,2]}},"typeDefinition":{"linkSupport":true},"rename":{"dynamicRegistration":false,"prepareSupport":true},"declaration":{"linkSupport":true},"codeAction":{"dataSupport":true,"resolveSupport":{"properties":["edit"]},"dynamicRegistration":false,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","Empty","QuickFix","Refactor","RefactorExtract","RefactorInline","RefactorRewrite","Source","SourceOrganizeImports","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"completion":{"contextSupport":false,"completionItem":{"commitCharactersSupport":false,"deprecatedSupport":false,"snippetSupport":false,"preselectSupport":false,"documentationFormat":["markdown","plaintext"]},"dynamicRegistration":false,"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]}},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true,"documentationFormat":["markdown","plaintext"]}},"documentHighlight":{"dynamicRegistration":false},"definition":{"linkSupport":true},"documentSymbol":{"hierarchicalDocumentSymbolSupport":true,"dynamicRegistration":false,"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]}},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"implementation":{"linkSupport":true},"synchronization":{"didSave":true,"willSave":false,"dynamicRegistration":false,"willSaveWaitUntil":false}},"workspace":{"workspaceFolders":true,"symbol":{"hierarchicalWorkspaceSymbolSupport":true,"dynamicRegistration":false,"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]}},"workspaceEdit":{"resourceOperations":["rename","create","delete"]},"applyEdit":true,"configuration":true}},"processId":1188405,"initializationOptions":{"documentFeatures":{"documentColor":false,"foldingRange":true,"documentSymbol":true,"selectionRange":true,"linkedEditingRange":true,"documentFormatting":{"defaultPrintWidth":100}},"typescript":{"serverPath":"\/home\/hugo\/clones\/gitlab.com\/fotus\/photostore\/vue3\/node_modules\/typescript\/lib\/tsserverlibrary.js"},"languageFeatures":{"typeDefinition":true,"references":true,"semanticTokens":false,"rename":true,"documentHighlight":true,"documentLink":true,"codeAction":true,"callHierarchy":true,"completion":{"defaultTagNameCase":"both","defaultAttrNameCase":"kebabCase"},"definition":true,"signatureHelp":true,"diagnostics":true,"renameFileRefactoring":true,"hover":true,"codeLens":true,"schemaRequestService":true}},"rootUri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/fotus\/photostore\/vue3","clientInfo":{"name":"Neovim","version":"0.6.0"},"rootPath":"\/home\/hugo\/clones\/gitlab.com\/fotus\/photostore\/vue3"},"method":"initialize","jsonrpc":"2.0","id":1}Content-Length: 52

{"params":{},"method":"initialized","jsonrpc":"2.0"}Content-Length: 824

{"params":{"textDocument":{"uri":"file:\/\/\/home\/hugo\/clones\/gitlab.com\/fotus\/photostore\/vue3\/src\/App.vue","languageId":"vue","version":0,"text":"<script setup lang=\"ts\">\n\/\/ This starter template is using Vue 3 <script setup> SFCs\n\/\/ Check out https:\/\/v3.vuejs.org\/api\/sfc-script-setup.html#sfc-script-setup\nimport HelloWorld from '.\/components\/HelloWorld.vue'\n<\/script>\n\n<template>\n  <img alt=\"Vue logo\" src=\".\/assets\/logo.png\" \/>\n  <HelloWorld msg=\"Hello Vue 3 + TypeScript + Vite\" \/>\n<\/template>\n\n<style>\n#app {\n  font-family: Avenir, Helvetica, Arial, sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n  text-align: center;\n  color: #2c3e50;\n  margin-top: 60px;\n}\n<\/style>\n"}},"method":"textDocument\/didOpen","jsonrpc":"2.0"}Content-Length: 45

{"result":[null,null],"jsonrpc":"2.0","id":0}Content-Length: 38

{"result":null,"jsonrpc":"2.0","id":1}Content-Length: 40

{"result":[null],"jsonrpc":"2.0","id":2}Content-Length: 40

{"result":[null],"jsonrpc":"2.0","id":3}

stdout:

Content-Length: 1494

{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"textDocumentSync":2,"selectionRangeProvider":true,"foldingRangeProvider":true,"linkedEditingRangeProvider":true,"documentSymbolProvider":true,"documentFormattingProvider":true,"referencesProvider":true,"definitionProvider":true,"typeDefinitionProvider":true,"callHierarchyProvider":true,"hoverProvider":true,"renameProvider":{"prepareProvider":true},"workspace":{"fileOperations":{"willRename":{"filters":[{"pattern":{"glob":"**/*.vue"}},{"pattern":{"glob":"**/*.js"}},{"pattern":{"glob":"**/*.ts"}},{"pattern":{"glob":"**/*.jsx"}},{"pattern":{"glob":"**/*.tsx"}},{"pattern":{"glob":"**/*.json"}}]}}},"signatureHelpProvider":{"triggerCharacters":["(",",","<"],"retriggerCharacters":[")"]},"completionProvider":{"triggerCharacters":[".","\"","'","`","/","<","@","#"," ","<",":","@",".","/",".","@","/","\"",":"],"resolveProvider":true},"executeCommandProvider":{"commands":["volar.server.executeConvertToKebabCase","volar.server.executeConvertToPascalCase","volar.html-to-pug","volar.pug-to-html","volar.use-setup-sugar","volar.unuse-setup-sugar","volar.use-ref-sugar","volar.unuse-ref-sugar","volar.show-references"]},"documentHighlightProvider":true,"documentLinkProvider":{"resolveProvider":false},"codeLensProvider":{"resolveProvider":true},"codeActionProvider":{"codeActionKinds":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.fixAll","source.organizeImports"],"resolveProvider":true}}}}Content-Length: 169

{"jsonrpc":"2.0","id":0,"method":"workspace/configuration","params":{"items":[{"section":"js/ts.implicitProjectConfig"},{"section":"javascript.implicitProjectConfig"}]}}Content-Length: 124

{"jsonrpc":"2.0","id":1,"method":"window/workDoneProgress/create","params":{"token":"242cb0c5-7731-4d09-ab88-a6b6aebf082b"}}Content-Length: 194

{"jsonrpc":"2.0","id":2,"method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/hugo/clones/gitlab.com/fotus/photostore/vue3/src/App.vue.template.css","section":"css"}]}}Content-Length: 187

{"jsonrpc":"2.0","id":3,"method":"workspace/configuration","params":{"items":[{"scopeUri":"file:///home/hugo/clones/gitlab.com/fotus/photostore/vue3/src/App.vue.0.css","section":"css"}]}}Content-Length: 181

{"jsonrpc":"2.0","method":"$/progress","params":{"token":"242cb0c5-7731-4d09-ab88-a6b6aebf082b","value":{"kind":"begin","title":"Initializing Vue language features (15 features)"}}}Content-Length: 138

{"jsonrpc":"2.0","method":"$/progress","params":{"token":"242cb0c5-7731-4d09-ab88-a6b6aebf082b","value":{"kind":"report","percentage":0}}}Content-Length: 139

{"jsonrpc":"2.0","method":"$/progress","params":{"token":"242cb0c5-7731-4d09-ab88-a6b6aebf082b","value":{"kind":"report","percentage":50}}}Content-Length: 120

{"jsonrpc":"2.0","method":"$/progress","params":{"token":"242cb0c5-7731-4d09-ab88-a6b6aebf082b","value":{"kind":"end"}}}Content-Length: 120

{"jsonrpc":"2.0","method":"$/progress","params":{"token":"242cb0c5-7731-4d09-ab88-a6b6aebf082b","value":{"kind":"end"}}}

stderr is empty.

@WhyNotHugo
Copy link
Contributor Author

See also neovim/nvim-lspconfig#1436

@johnsoncodehk
Copy link
Member

Yep please track neovim/nvim-lspconfig#1436, thanks.

@WhyNotHugo
Copy link
Contributor Author

Will do. Do you have any hints on debugging crashes tho?

If Volar exited abruptly, how would you to pinpoint the cause? Any suggestions you may have are most welcome!

@sethidden
Copy link
Contributor

sethidden commented Nov 19, 2021

@WhyNotHugo

My spider sense tells me this could have something to do with https://github.com/neovim/nvim-lspconfig/blob/62a275d1050f930eabbf545edd1bdc5aa9372594/lua/lspconfig/volar.lua#L65. In your stdin logs in the nvim-lspconfig issue CTRL+F for "serverPath":

"typescript":{"serverPath":"\/home\/hugo\/clones\/gitlab.com\/fotus\/photostore\/vue3\/node_modules\/typescript\/lib\/tsserverlibrary.js"

Are you sure the above path is available from within the container? I've seen you've only bind-mounted some other folder

  local cmd = { 'podman', 'container', 'run', '--interactive', '--workdir=/home/hugo/tmp/vue3', '--volume=/home/hugo/tmp/vue3:/home/hugo/tmp/vue3', 'volar' } -- needed for elixirls, omnisharp, sumneko_lua

The nvim-lspconfig config for volar launches volar in a way that's dependent on typescript being installed in your project's node_modules

If volar trying to start with tsserverlib.js that's not bound to the container is causing your crash, the solution could be to npm install -g typescript in your host machine, then bind mount your global typescript installation into the Volar container (/home/user/.npm/lib/node_modules/typescript/lib:/typescript) then make nvim-lspconfig (override in setup{}) try to access the typescript installation tsserverlibrary.js file under that mounted path.

The downside is that you'd be using your global typescript instead of your project's local TS version. But you can also try to bind mount the local node_modules/typescript folder too instead of binding the global TS dir.

There's some more about TS detection in the changed files in neovim/nvim-lspconfig#1316 Custom TS Detection section

@mjlbach
Copy link

mjlbach commented Nov 19, 2021

@johnsoncodehk I don't think this is an lspconfig issue, rather an issue with the containerization of Volar. AFAIK volar works fine with lspconfig/the built-in client. My guess would be, as @sethidden has suggested, that it's something to do with needing access to libraries/paths not bind-mounted into the container.

@WhyNotHugo
Copy link
Contributor Author

Sorry, I moved to testing a project in ~/tmp while experimenting and that's why the paths don't match between my first and second comment, but the paths were kept consistently. Several other LSPs work fine with this setup.

I'm using this code to run the container and do the mounting: https://github.com/lspcontainers/lspcontainers.nvim/blob/main/lua/lspcontainers/init.lua the minimal_config is probably easier to reason about tho.

Is there any way to make Volar print an error when exiting, rather than exiting silently?

@sethidden

This comment has been minimized.

@mjlbach
Copy link

mjlbach commented Nov 19, 2021

It might be polluting stdio with the log messages.

@sethidden
Copy link
Contributor

sethidden commented Nov 19, 2021

🤦 right

Really weird issue. Tried debugging the volar server with node (exposed debug port 9229 from the container). Set up "pause on exceptions" but volar just dies without any exception happening

EDIT: Still nothing.
Only thing I've found is that whatever is console.error ing from volar-server dies midway.
Notice it's always Content-Header: xxx then body 3 times, and in the last one you have only Content-Header without the body
image

@johnsoncodehk johnsoncodehk reopened this Nov 20, 2021
@WhyNotHugo
Copy link
Contributor Author

I've tried adding --terminal when starting the container, but it actually dies earlier and logs less. I'm don't think allocating a TTY is correct anyway.

I've been using this wrapper to make sure I capture all stdin/stdout/stderr: https://git.sr.ht/~whynothugo/lspdebugger/tree/main/item/main.go

And this dockerfile:

FROM alpine:3.13.5

RUN apk add --no-cache \
  nodejs \
  npm

# ARG VERSION

RUN npm install -g @volar/server
COPY lspdebugger /usr/bin/lspdebugger

CMD [ "/usr/bin/lspdebugger" ]
# CMD [ "volar-server", "--stdio" ]

@johnsoncodehk
Copy link
Member

Sorry I don't have a clue about this problem for the time being, and I don't even know how to setup reproduce env. It would be helpful if there are some guidelines, I will try to check it when I have time.

Will do. Do you have any hints on debugging crashes tho?

If Volar exited abruptly, how would you to pinpoint the cause? Any suggestions you may have are most welcome!

  1. I will first look for what event the crash came from. Disable all language features and see if it crashes.
    1.a. If the crash no longer occurs, enable the language function one by one to troubleshoot the request that caused the problem.
    1.b. Otherwise, the crash occurs before or after initialization. Remove the logic that caused the rpc message one by one, and check the conditions that caused the crash.
  2. Start with the entry code that caused the crash and execute step by step, looking for the termination point of the program. If the debugger is not available, I may just use require('fs').appendFileSync instead of console.log to find the termination point of the program.

@sethidden
Copy link
Contributor

The mechanism of action is very similar to this: typescript-language-server/typescript-language-server#262

The onInitialize fn receives a params arg, which has params.processId.

The problem is I think that that process (params.processId) just immediately dies inside the container (ie. if I set a breakpoint somewhere then run "top" to see running processes inside the container, there is no process with that processId)

Then the process watcher mentioned in typescript-language-server/typescript-language-server#262 (comment) kills the langserver with signal code 1 when it sees that the processId doesn't exist

@mjlbach
Copy link

mjlbach commented Nov 21, 2021

Can you try with the podman/docker arg --pid=host?

@sethidden
Copy link
Contributor

sethidden commented Nov 21, 2021

Can you try with the podman/docker arg --pid=host?

IT WORKS!!! Thanks!
image
image

Now I kinda feel stupid debugging the actual code for so many hours when it was just a process spawning issue hah

(--network=host is probably unnecessary, I used it for debugging)

@mjlbach
Copy link

mjlbach commented Nov 21, 2021

@WhyNotHugo see #706 (comment)

@mjlbach
Copy link

mjlbach commented Nov 21, 2021

Generally you probably want to do this for containerizing language servers as many servers check the PID of the client that spawned them for self-termination, I think omnisharp does this as well.

@WhyNotHugo
Copy link
Contributor Author

Nice, yes, this works!

I wonder if this auto-detection can be disabled for the LSP through some flag. Other LSPs don't have this detection-of-parent (at least I assume they don't or they'd exit immediately), and this check assumes that the server is running on the same host as the client which isn't always the case.

I appreciate the help debugging this, I don't think I would have ever figured it out.

@WhyNotHugo
Copy link
Contributor Author

Oh, actually, that feature can be disabled by using:

  volar = {
    before_init = function(params)
      params.processId = vim.NIL
    end,
    cmd = lsp_containers.command("volar", { image = "volar" }),
  },

I guess there's not much to be done here. microsoft/vscode-languageserver-node#857 should suffice for improving the experience when other hit this same issue. Feel free to close this.

@johnsoncodehk
Copy link
Member

@sethidden Thank you for your efforts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants