kate lsp client plugin

Mark Nauwelaerts mark.nauwelaerts at gmail.com
Thu Jul 11 18:12:34 BST 2019


On 11/07/19 07:39, Olivier Goffart wrote:
> Hi Mark,
>
> Thanks for contributing this plugin, I have been trying it with the rust LSP 
> and it works fine. (after i made the two small changes)
>
>
> It was a bit strange to figure out the .json file. So i guess some better UI 
> for that would be nice.
>
> Here is what i have for rust
>
>        "Rust":
>         {
>             "command": 
> "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rls",
>             "root": "/home/user/path/to/project"
>         }
>
>
> The problem is that the root folder must be the folder containing the 
> "Cargo.toml"  file.
> When there are several crates open at once, it is different for every crates.
> I'm not sure how this is supposed to be fixed.
>
Thanks for providing those changes!

*If* the root folder (containing Cargo.toml) is also a (kate) projectBase, e.g. 
because it is the root of a git repo (as is probably the case AFAIK), then the 
following configuration should arrange that (barring some bug ;-) ):

{
         "global":
         {
                 "root": ""
         },
         "servers":
         {
                 "Rust":
                 {
"command": "/home/user/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rls"
                 }
         }
}

The "global" section is inherited by each server part, and a (non-null) "root" 
is interpreted either as an absolute path or a relative path wrt projectBase 
(so, in this case = projectBase). If the Cargo.toml is not in a top-git 
directory, it could be turned into kate project(Base) by adding a .kateproject, 
which should then also work.

For now, that configuration behavior has been documented in code comments.  If 
that behavior/principle turns out to work well, then it obviously requires 
better documentation.  And if possible, have some UI that can convey that 
somehow ...

Regards,
Mark.



More information about the KWrite-Devel mailing list