Skip to content

Remap file paths between LSP server and Vim #1524

Open
@antekone

Description

@antekone

I'm trying to use clangd installed in a podman container. I've configured it so that running the language server is done by the "podman run" commandline:

au User lsp_setup call lsp#register_server({ 'name': 'clangd', 'cmd': ['/usr/bin/podman', 'run', '-v', getcwd().':'.getcwd(), '--rm', '-i', 'a500dev', 'clangd-17', '--background-index', '--compile-commands-dir='.getcwd(), '--clang-tidy', '--query-driver=/opt/m68k-amigaos/bin/*'], 'allowlist': ['cpp'], })

But the (obvious) problem is that file paths for the system headers is different inside the container and in Vim.

I can mount any container's directory to anywhere on my host, with an exception that most of the time it will not be the same path, so I'm wondering: does vim-lsp support filename remapping from/to what the LSP generates/expects?

For example, some function that would convert a path sent to the LSP, and another function that would convert a path got from LSP? That would probably be enough for me (I think) to use an LSP installed inside podman container.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions