dense-analysis / dense-analysis/ale

Support filename mapping for language servers

Open
#2,449 6 comments 1 reaction 0 assignees View on GitHub
enhancement LSP
Dominant language
Vim Script
Stars
14k
Forks
1.5k
Avg merge
17h 49m
Merged PRs (30d)
1

Description

Hello! 👋

**The setup**: I am integrating a language server that runs remotely. Ale is able to read/write to the server over a TCP socket.

**The hiccup**: How should Ale handle different project roots for the client and server?

I have the linter defined as:
```vim
call ale#linter#Define('', {
\ 'name': '',
\ 'lsp': 'socket',
\ 'address': 'localhost:7777',
\ 'language': '',
\ 'project_root': '',
\})
```

The outgoing requests are good, but the diagnostic file paths are returned from the server's point of view, e.g.:

`"uri":"file:///"`

These file URIs obviously mean nothing to Ale.

**Guidance** How should this be handled? I'm not sure if the LS protocol provides a way for the server to know the client's project root, so I figured we could try handling it client-side. I was able to get diagnostics working by patching https://github.com/w0rp/ale/blob/fcc2c3ba71afa2a7965f3c1e9ec8c03381178180/autoload/ale/path.vim#L199-L201 to truncate everything up until ``. I was thinking that this could be done dynamically by truncating `len('file://') + len(project_root)`. Is this a reasonable approach? Are there better approaches?

Thanks!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.