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

Switch Header/Source for clangd #265

Closed
theHamsta opened this issue Jun 7, 2020 · 1 comment
Closed

Switch Header/Source for clangd #265

theHamsta opened this issue Jun 7, 2020 · 1 comment

Comments

@theHamsta
Copy link
Member

theHamsta commented Jun 7, 2020

This snippet may be useful for users of clangd

-- in lsp-ext.lua
M = {}

M.switch_header_source = function()
    vim.lsp.buf_request(
        0,
        "textDocument/switchSourceHeader",
        vim.lsp.util.make_text_document_params(),
        function(err, _, result, _, _)
            if err then
                print(err)
            else
                vim.cmd('e '..vim.uri_to_fname(result))
            end
        end
    )
end

return M
-- in your lua config
vim.cmd [[
    command! SwitchHeaderSource lua require "lsp-ext".switch_header_source()
]]

Is something like this in the scope of nvim-lsp? Maybe we could put this in the documentation in the README.

@theHamsta
Copy link
Member Author

Ooops: someone was faster: #263

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

No branches or pull requests

1 participant