atom / atom-languageclient

Language Server Protocol support for Atom (the basis of Atom-IDE)
https://ide.atom.io/
MIT License
389 stars 78 forks source link

Use definition to indicate out-of-project files with server support #253

Closed alexheretic closed 4 years ago

alexheretic commented 5 years ago

Language servers can support out of project files, ie RLS dependencies which cargo puts somewhere in ~/.cargo/. However, currently ide-rust cannot support any LSP functionality for dependency sources or the rust std library because atom-languageclient does not know these files may be of interest to the RLS.

This change optionally uses textDocument/definition responses to imply a server's support of the returned out-of-project source directories.

When matching a the editor's file path to a server these implications are taken into account if we cannot otherwise find a server from the path.

The method serversSupportDefinitionDestinations(): boolean is overridden by the client concrete class to opt into this behaviour.

Fixes #244

Using this technique is very effective for ide-rust

This feature is also available in my fork:

"dependencies": {
  "atom-languageclient": "github:alexheretic/atom-languageclient#build",
}