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

bug: No LSP client found that supports symbols #236

Closed
adoyle-h opened this issue Mar 29, 2023 · 7 comments
Closed

bug: No LSP client found that supports symbols #236

adoyle-h opened this issue Mar 29, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@adoyle-h
Copy link

Neovim version (nvim -v)

v0.8.3

Operating system/version

MacOS 12.2

Output of :AerialInfo

Aerial Info

Filetype: go
Configured backends:
lsp (supported) (attached)
treesitter (supported)
markdown (not supported) [Filetype is not markdown]
Show symbols: Array, Boolean, Class, Constant, Constructor, Enum, EnumMember, Event, Field, File, Function, Interface, Key, Method, Mod
ule, Namespace, Null, Number, Object, Operator, Property, String, Struct, TypeParameter, Variable

Describe the bug

It sometimes show the warning "No LSP client found that supports symbols" when I opened a ".go" file.
But the LSP of golang is attached, and the aerial is working well in the same buffer.

:LspInfo

CleanShot 2023-03-29 at 21 13 17@2x

Steps To Reproduce

I don't know.

Expected Behavior

Do not notify this warning.

Minimal example file

No response

Minimal init.lua

No response

Additional context

No response

@adoyle-h adoyle-h added the bug Something isn't working label Mar 29, 2023
@stevearc
Copy link
Owner

stevearc commented Apr 1, 2023

Hard to tell exactly what's happening from this description, but I found where some of the LSP logic could potentially disagree and cause a conflict. Can you try with this patch and see if it fixes it? If not, can you provide some more information? Things like

  • What are all of the LSP clients that are attached to the buffer?
  • When does the message appear? (when the file is opened? When you open aerial? Randomly while editing the file?)

@tomtomjhj
Copy link
Contributor

tomtomjhj commented Apr 18, 2023

I'm still experiencing similar problem when using lsp backend with texlab (backends = { tex = {'lsp'}, }) on the current master.

some observations:

  • texlab is the only LSP client attached
  • Aerial works well most of the time, but after editing for some time, it starts to produce this error.
  • I get "No LSP client found that supports symbols" message whenever I type something in insert mode.
  • Interestingly, the AerialOpen panel works properly: if I add a \section{title}, the new section is displayed in the panel, but it still prints the error message.
FYI here is the dump of the texlab client object:
{
  _on_attach = <function 1>,
  attached_buffers = { true,
    [5] = true,
    [10] = true,
    [11] = true,
    [16] = true
  },
  cancel_request = <function 2>,
  commands = {},
  config = {
    _on_attach = <function 3>,
    autostart = true,
    capabilities = {
      textDocument = {
        callHierarchy = {
          dynamicRegistration = false
        },
        codeAction = {
          codeActionLiteralSupport = {
            codeActionKind = {
              valueSet = { "", "quickfix", "refactor", "refactor.extract", "refactor.inline", "refactor.rewrite", "source", "source.organizeImports" }
            }
          },
          dataSupport = true,
          dynamicRegistration = false,
          isPreferredSupport = true,
          resolveSupport = {
            properties = { "edit" }
          }
        },
        completion = {
          completionItem = {
            commitCharactersSupport = true,
            deprecatedSupport = true,
            documentationFormat = { "markdown", "plaintext" },
            insertReplaceSupport = true,
            insertTextModeSupport = {
              valueSet = { 1, 2 }
            },
            labelDetailsSupport = true,
            preselectSupport = true,
            resolveSupport = {
              properties = { "documentation", "detail", "additionalTextEdits" }
            },
            snippetSupport = true,
            tagSupport = {
              valueSet = { 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 }
          },
          completionList = {
            itemDefaults = { "commitCharacters", "editRange", "insertTextFormat", "insertTextMode", "data" }
          },
          contextSupport = true,
          dynamicRegistration = false,
          insertTextMode = 1
        },
        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
        },
        semanticTokens = {
          augmentsSyntaxTokens = true,
          dynamicRegistration = false,
          formats = { "relative" },
          multilineTokenSupport = false,
          overlappingTokenSupport = true,
          requests = {
            full = {
              delta = true
            },
            range = false
          },
          serverCancelSupport = false,
          tokenModifiers = { "declaration", "definition", "readonly", "static", "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary" },
          tokenTypes = { "namespace", "type", "class", "enum", "interface", "struct", "typeParameter", "parameter", "variable", "property", "enumMember", "event", "function", "method", "macro", "keyword", "modifier", "comment", "string", "number", "regexp", "operator", "decorator" }
        },
        signatureHelp = {
          dynamicRegistration = false,
          signatureInformation = {
            activeParameterSupport = true,
            documentationFormat = { "markdown", "plaintext" },
            parameterInformation = {
              labelOffsetSupport = true
            }
          }
        },
        synchronization = {
          didSave = true,
          dynamicRegistration = false,
          willSave = true,
          willSaveWaitUntil = true
        },
        typeDefinition = {
          linkSupport = true
        }
      },
      window = {
        showDocument = {
          support = true
        },
        showMessage = {
          messageActionItem = {
            additionalPropertiesSupport = false
          }
        },
        workDoneProgress = true
      },
      workspace = {
        applyEdit = true,
        configuration = true,
        didChangeWatchedFiles = {
          dynamicRegistration = false,
          relativePatternSupport = true
        },
        semanticTokens = {
          refreshSupport = 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 = { "texlab" },
    cmd_cwd = "/home/user",
    filetypes = { "tex", "plaintex", "bib" },
    flags = {},
    get_language_id = <function 4>,
    handlers = <1>{},
    init_options = vim.empty_dict(),
    log_level = 2,
    message_level = 2,
    name = "texlab",
    on_attach = <function 5>,
    on_exit = <function 6>,
    on_init = <function 7>,
    root_dir = "/home/user",
    settings = {
      texlab = {
        auxDirectory = ".",
        bibtexFormatter = "texlab",
        build = {
          args = { "-pdf", "-interaction=nonstopmode", "-synctex=1", "%f" },
          executable = "latexmk",
          forwardSearchAfter = false,
          onSave = false
        },
        chktex = {
          onEdit = false,
          onOpenAndSave = false
        },
        diagnosticsDelay = 300,
        formatterLineLength = 80,
        forwardSearch = {
          args = {}
        },
        latexFormatter = "latexindent",
        latexindent = {
          modifyLineBreaks = false
        }
      }
    },
    single_file_support = true,
    workspace_folders = <2>{ {
        name = "/home/user",
        uri = "file:///home/user"
      } },
    <metatable> = <3>{
      __tostring = <function 8>
    }
  },
  handlers = <table 1>,
  id = 1,
  initialized = true,
  is_stopped = <function 9>,
  messages = {
    messages = {},
    name = "texlab",
    progress = {},
    status = {}
  },
  name = "texlab",
  notify = <function 10>,
  offset_encoding = "utf-16",
  request = <function 11>,
  request_sync = <function 12>,
  requests = {},
  rpc = {
    is_closing = <function 13>,
    notify = <function 14>,
    request = <function 15>,
    terminate = <function 16>
  },
  server_capabilities = {
    completionProvider = {
      resolveProvider = true,
      triggerCharacters = { "\\", "{", "}", "@", "/", " " }
    },
    definitionProvider = true,
    documentFormattingProvider = true,
    documentHighlightProvider = true,
    documentLinkProvider = {
      resolveProvider = false
    },
    documentSymbolProvider = true,
    executeCommandProvider = {
      commands = { "texlab.cleanAuxiliary", "texlab.cleanArtifacts", "texlab.changeEnvironment" }
    },
    foldingRangeProvider = true,
    hoverProvider = true,
    inlayHintProvider = true,
    referencesProvider = true,
    renameProvider = {
      prepareProvider = true
    },
    textDocumentSync = {
      change = 2,
      openClose = true,
      save = {
        includeText = false
      }
    },
    workspaceSymbolProvider = true
  },
  stop = <function 17>,
  supports_method = <function 18>,
  workspace_did_change_configuration = <function 19>,
  workspace_folders = <table 2>
}

@stevearc
Copy link
Owner

The fact that it seems to still be working is the confusing part. That means that the active buffer continues to have a functioning LSP client with a symbols provider attached to it. The only thing I can think of is maybe something has caused aerial to try to attach to a different buffer somehow, and that buffer doesn't have a client. I've added the buffer number to the error message. If you see it again, can you confirm if the buffer number is the number of the current file?

@adoyle-h
Copy link
Author

adoyle-h commented Apr 21, 2023

@stevearc Sorry for the late response. With latest commit, it shows a warning No LSP client found that supports symbols in buffer when opened two files and close one by :q.

@milanglacier
Copy link

milanglacier commented Apr 30, 2023

I have the same issue, but the problem only happens when use :q! to quit a buffer (I can reproduce the problem with R and go, but not with python, interesting).

It is worth to note that when you use :q! to quit a buffer, the buffer will be detached from the lsp (say a go buffer will detach from gopls after :q!)

I think this might related to how we handle the detach event:

M.on_detach = function(client_id, bufnr)

Besides, I am on the latest commit 07039ea

@milanglacier
Copy link

milanglacier commented May 1, 2023

I find a way to "bypass" this bug:

I find that if I commented out the on_attach specification in my config, then such warning when using :q! to quit a buffer will not happen:

change the config from this:

    require('aerial').setup {
        backends = { 'lsp', 'treesitter', 'markdown' },
        on_attach = function(bufnr)
            bufmap(bufnr, 'n', '<leader>lo', '<cmd>AerialToggle!<CR>', {
                desc = 'lsp symbol outline',
            })
        end,
    }

to this

    require('aerial').setup {
        backends = { 'lsp', 'treesitter', 'markdown' },
        -- on_attach = function(bufnr)
        --     bufmap(bufnr, 'n', '<leader>lo', '<cmd>AerialToggle!<CR>', {
        --         desc = 'lsp symbol outline',
        --     })
        -- end,
    }

then the warnings will not be yielded.

@stevearc
Copy link
Owner

stevearc commented May 3, 2023

I believe this is the same as #249, and is also fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants