neovim / nvim-lspconfig

Quickstart configs for Nvim LSP
Apache License 2.0
10.62k stars 2.08k forks source link

Markdown error message #2034

Closed ignamartinoli closed 2 years ago

ignamartinoli commented 2 years ago

Description

I used Mason to install marksman. After opening a file I receive an enormous error message

Neovim version

NVIM v0.7.2 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3

Nvim-lspconfig version

It's the last, I don't know how to see the hash

Operating system and version

Gentoo Base System release 2.8

Affected language servers

marksman

Steps to reproduce

  1. Opened a Markdown file

Actual behavior

After opening the file this message fills the screen

Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp.lua:955: RPC[Error] code_name = Interna
lError, message = "No folders configured in workspace: { ProcessId = Some 14849\
  ClientInfo = Some { Name = \"Neovim\"\
                      Version = Some \"0.7.2\" }\
  RootPath = None\
  RootUri = None\
  InitializationOptions = Some (seq [])\
  Capabilities =\
   Some\
     { Workspace =\
        Some\
          { ApplyEdit = Some true\
            WorkspaceEdit =\
             Some { DocumentChanges = None\
                    ResourceOperations = Some [|Rename; Create; Delete|]\
                    FailureHandling = None\
                    NormalizesLineEndings = None\
                    ChangeAnnotationSupport = None }\
            DidChangeConfiguration = None\
            DidChangeWatchedFiles = None\
            Symbol =\
             Some\
               { DynamicRegistration = Some false\
                 SymbolKind =\
                  Some\
                    { ValueSet =\
                       Some\
                         [|File; Module; Namespace; Package; Class; Method;\
                           Property; Field; Constructor; Enum; Interface;\
                           Function; Variable; Constant; String; Number; Boolean;\
                           Array; Object; Key; Null; EnumMember; Struct; Event;\
                           Operator; TypeParameter|] } }\
            SemanticTokens = None }\
       TextDocument =\
        Some\
          { Synchronization = Some { DynamicRegistration = Some false\
                                     WillSave = Some false\
                                     WillSaveWaitUntil = Some false\
                                     DidSave = Some true }\
            PublishDiagnostics =\
             { RelatedInformation = Some true\
               TagSupport = Some { ValueSet = [|Unnecessary; 2|] } }\
            Completion =\
             Some\
               { DynamicRegistration = Some false\
                 CompletionItem =\
                  Some\
                    { SnippetSupport = Some true\
                      CommitCharactersSupport = Some true\
                      DocumentationFormat = Some [|\"markdown\"; \"plaintext\"|] }\
                 CompletionItemKind =\
                  Some\
                    { ValueSet =\
                       Some\
                         [|Text; Method; Function; Constructor; Field; Variable;\
                           Class; Interface; Module; Property; Unit; Value; Enum;\
                           Keyword; Snippet; Color; File; Reference; Folder;\
                           EnumMember; Constant; Struct; Event; Operator;\
                           TypeParameter|] }\
                 ContextSupport = Some false }\
            Hover = Some { DynamicRegistration = Some false\
                           ContentFormat = Some [|\"markdown\"; \"plaintext\"|] }\
            SignatureHelp =\
             Some\
               { DynamicRegistration = Some false\
                 SignatureInformation =\
                  Some\
                    { DocumentationFormat = Some [|\"markdown\"; \"plaintext\"|] } }\
            References = Some { DynamicRegistration = Some false }\
            DocumentHighlight = Some { DynamicRegistration = Some false }\
            DocumentSymbol =\
             Some\
               { DynamicRegistration = Some false\
                 SymbolKind =\
                  Some\
                    { ValueSet =\
                       Some\
                         [|File; Module; Namespace; Package; Class; Method;\
                           Property; Field; Constructor; Enum; Interface;\
                           Function; Variable; Constant; String; Number; Boolean;\
                           Array; Object; Key; Null; EnumMember; Struct; Event;\
                           Operator; TypeParameter|] }\
                 HierarchicalDocumentSymbolSupport = Some true }\
            Formatting = None\
            RangeFormatting = None\
            OnTypeFormatting = None\
            Definition = Some { DynamicRegistration = None }\
            CodeAction =\
             Some\
               { DynamicRegistration = Some false\
                 CodeActionLiteralSupport =\
                  Some\
                    { CodeActionKind =\
                       { ValueSet =\
                          [|\"\"; \"Empty\"; \"QuickFix\"; \"Refactor\";\
                            \"RefactorExtract\"; \"RefactorInline\";\
                            \"RefactorRewrite\"; \"Source\"; \"SourceOrganizeImports\";\
                            \"quickfix\"; \"refactor\"; \"refactor.extract\";\
                            \"refactor.inline\"; \"refactor.rewrite\"; \"source\";\
                            \"source.organizeImports\"|] } }\
                 IsPreferredSupport = None\
                 DisabledSupport = None\
                 DataSupport = Some true\
                 ResolveSupport = Some { Properties = [|\"edit\"|] }\
                 HonorsChangeAnnotations = None }\
            CodeLens = None\
            DocumentLink = None\
            Rename = Some { DynamicRegistration = Some false }\
            FoldingRange = None\
            SelectionRange = None\
            SemanticTokens = None\
            InlayHint = None }\
       InlayHint = None\
       Experimental = None }\
  trace = Some \"off\"\
  WorkspaceFolders = None }" data = vim.empty_dict()
stack traceback:
        [C]: in function 'assert'
        /usr/share/nvim/runtime/lua/vim/lsp.lua:955: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

After closing Neovim I receive the message on the terminal

Client 1 quit with exit code 143 and signal 0

Expected behavior

File opened without issues

Minimal config

-- the provided config made neovim crazy, downloading in loop Treesitter sources, I paste my lsp config, I use nvim-cmp for completion
local cmp = require 'cmp_nvim_lsp'
local lsp = require 'lspconfig'
-- local nav = require 'nvim-navic'-- TODO: when update
local tel = require 'telescope.builtin'

local servers = {
    arduino_language_server = {
        -- TODO: configure
    },
    asm_lsp = {},
    awk_ls = {},
    bashls = {},
    clangd = {},
    clojure_lsp = {},
    csharp_ls = {},
    cssls = {},
    dockerls = {},
    elixirls = {},
    elmls = {},
    erlangls = {},
    eslint = {},
    fortls = {},
    fsautocomplete = {},
    gopls = {},
    -- hls = {
    --  -- TODO: get `ghcup` merged on Gentoo
    --  settings = {
    --      haskell = {
    --          formattingProvider = ""
    --      }
    --  }
    -- },
    html = {},
    -- TODO: idris2_lsp
    jdtls = {},
    jsonls = {},
    julials = {},
    kotlin_language_server = {},
    lemminx = {},
    marksman = {},
    perlnavigator = {},
    pyright = {},
    reason_ls = {},
    rust_analyzer = {},
    serve_d = {},
    sqls = {},
    sumneko_lua = {
        settings = {
            Lua = {
                runtime = {
                    version = 'LuaJIT'
                },
                diagnostics = {
                    globals = { 'use', 'vim' }
                },
                format = {
                    enable = false
                }
            }
        }
    },
    -- prolog_lsp = {
    --  -- TODO: make work
    --  cmd = {
    --      'swipl',
    --      '-g', 'use_module(library(lsp_server)).',
    --      '-g', 'lsp_server:main',
    --      '-t', 'halt',
    --      '--', 'stdio'
    --  },
    --  filetypes = 'prolog',
    --  settings = {}
    -- },
    taplo = {},
    texlab = {
        settings = {
            texlab = {
                latexFormatter = 'texlab',
                build = { onSave = true }
            }
        }
    },
    tsserver = {},
    vuels = {}
}

local signs = {
    DiagnosticSignError = '',
    DiagnosticSignHint = '',
    DiagnosticSignInfo = '',
    DiagnosticSignWarn = '',
    LightBulbSign = ''
}
for type, icon in pairs(signs) do
    vim.fn.sign_define(type, { text = icon, texthl = type, linehl = type, numhl = type })
end

vim.diagnostic.config {
    float = {
        border = 'rounded',
        header = '',
        prefix = ''
    },
    severity_sort = true,
    virtual_text = false
}
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
    pattern = '*',
    callback = function () vim.diagnostic.open_float(nil, { focus = false }) end
})

for server, config in pairs(servers) do
    config = vim.tbl_deep_extend('keep', config, {
        capabilities = cmp.update_capabilities(vim.lsp.protocol.make_client_capabilities()),
        on_attach = function (client, bufnr)
            -- nav.attach(client, bufnr) -- TODO: after update

            vim.keymap.set('n', 'ga', vim.lsp.buf.code_action)
            vim.keymap.set('n', 'gd', tel.diagnostics)
            -- vim.keymap.set('n', 'gi', function () tel.lsp_definitions { jump_type = 'never' } end)
            vim.keymap.set('n', 'gi', tel.lsp_implementations)
            vim.keymap.set('n', 'gr', tel.lsp_references)
            vim.keymap.set('n', 'gs', tel.spell_suggest)
            vim.keymap.set('n', 'rn', vim.lsp.buf.rename)
        end,
        -- root_dir = function () return vim.fn.getcwd() end,
        -- root_dir = function(fname)
        --   return nvim_lsp.util.root_pattern(
        --       'build.gradle', 'pom.xml', '.git'
        --   )(fname) or vim.fn.getcwd()
        -- end
        single_file_support = true
    })

    lsp[server].setup(config)
end

LSP log

https://gist.github.com/ignamartinoli/eef3538557ac2c4d35b2b6f712e0e4d7

ignamartinoli commented 2 years ago

Solved removing single_file_support