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

Trying to understand why my volar lsp is not working #2046

Closed
dongalor opened this issue Oct 22, 2022 · 2 comments
Closed

Trying to understand why my volar lsp is not working #2046

dongalor opened this issue Oct 22, 2022 · 2 comments
Labels
question Further information is requested

Comments

@dongalor
Copy link

Hey there!

I have conscientiously spent several hours researching my problem and am already a little tired

My lsp configuration for vetur

local util = require 'lspconfig/util

local script_path = "/home/user/.nvm/versions/node/v16.18.0/lib/node_modules/@volar/vue-language-server/bin/vue-language-server.js"

local tslib_path = "/home/user/.nvm/versions/node/v16.18.0/lib/node_modules/@vue/cli/node_modules/typescript/lib/tsserverlibrary.js"

lspconfig.volar.setup{
  on_attach = on_attach,
  capabilities = capabilities,
  flags = lsp_flags,
  cmd = {"node", script_path, "--stdio"},
  filetypes = {'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json'},
  root_dir = util.root_pattern("package.json", ".git/");
  init_options = {
    typescript = {
      serverPath = tslib_path
    },
    languageFeatures = {
      references =  true,
      definition = true,
      typeDefinition = true,
      callHierarchy = true,
      hover = true,
      rename = true,
      renameFileRefactoring = true,
      signatureHelp = true,
      codeAction = true,
      completion = {
        defaultTagNameCase = 'both',
        defaultAttrNameCase = 'kebabCase',
        getDocumentNameCasesRequest = false,
        getDocumentSelectionRequest = false,
      },
      schemaRequestService = true,
      documentHighlight = true,
      documentLink = true,
      codeLens = { showReferencesNotification = true },
      semanticTokens = true,
      diagnostics = true,
    },
    documentFeatures = {
      selectionRange = false,
      foldingRange = false,
      linkedEditingRange = true,
      documentSymbol = true,
      documentColor = true,
      documentFormatting = {
        defaultPrintWidth = 100,
        getDocumentPrintWidthRequest = true,
      },
    },
  },
  settings = {
    volar = {
      codeLens = {
        references = true,
        pugTools = true,
        scriptSetupTools = true,
      },
    },
  };
};

lsp.log

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Oct 22, 2022

Please try:

local util = require 'lspconfig/util

local script_path = "/home/user/.nvm/versions/node/v16.18.0/lib/node_modules/@volar/vue-language-server/bin/vue-language-server.js"

- local tslib_path = "/home/user/.nvm/versions/node/v16.18.0/lib/node_modules/@vue/cli/node_modules/typescript/lib/tsserverlibrary.js"
+ local tslib_path = "/home/user/.nvm/versions/node/v16.18.0/lib/node_modules/@vue/cli/node_modules/typescript/lib"

lspconfig.volar.setup{
  on_attach = on_attach,
  capabilities = capabilities,
  flags = lsp_flags,
  cmd = {"node", script_path, "--stdio"},
  filetypes = {'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue', 'json'},
  root_dir = util.root_pattern("package.json", ".git/");
  init_options = {
    typescript = {
-      serverPath = tslib_path
+      tsdk = tslib_path
    },
-    languageFeatures = {
-      references =  true,
-      definition = true,
-      typeDefinition = true,
-      callHierarchy = true,
-      hover = true,
-      rename = true,
-      renameFileRefactoring = true,
-      signatureHelp = true,
-      codeAction = true,
-      completion = {
-        defaultTagNameCase = 'both',
-        defaultAttrNameCase = 'kebabCase',
-        getDocumentNameCasesRequest = false,
-        getDocumentSelectionRequest = false,
-      },
-      schemaRequestService = true,
-      documentHighlight = true,
-      documentLink = true,
-      codeLens = { showReferencesNotification = true },
-      semanticTokens = true,
-      diagnostics = true,
-    },
-    documentFeatures = {
-      selectionRange = false,
-      foldingRange = false,
-      linkedEditingRange = true,
-      documentSymbol = true,
-      documentColor = true,
-      documentFormatting = {
-        defaultPrintWidth = 100,
-        getDocumentPrintWidthRequest = true,
-      },
-    },
  },
  settings = {
    volar = {
      codeLens = {
        references = true,
        pugTools = true,
        scriptSetupTools = true,
      },
    },
  };
};

@dongalor
Copy link
Author

@johnsoncodehk my hero! <3

image

Awesome! Thank you so much!

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

No branches or pull requests

2 participants