Skip to content

"Corresponding file cannot be determined" printout when another LSP server exists #80

@YanzhaoW

Description

@YanzhaoW

Problem

When using other LSPs, such as csspell_ls, using switch_source_header always results in a printout of

Corresponding file cannot be determined.

This is due to that csspell_ls, as a LSP for spell checking, can't find the source or header file.

Possible solutions

Change

https://github.com/p00f/clangd_extensions.nvim/blob/b67cc417d9020fb4b83d46662351b4d16894905e/lua/clangd_extensions/utils.lua#L3-L8

to

function M.buf_request_method(method, params, handler, bufnr)
    local clients = vim.lsp.get_clients({ bufnr = bufnr, method = method })
    for _, client in pairs(clients) do
        if client.name == "clangd" then
            client:request(method, params, handler, bufnr)
            return
        end
    end
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions