Open cameron-martin opened 9 months ago
After spending some time implementing this, I realised that running build/test commands cannot be done by the LSP since it needs to open in a terminal in the editor. Hence the IDE extension needs to handle this part. I think having the LSP supply the codelenses is useful still though.
On second thoughts, maybe this shouldn't be the responsibility of the language server, but instead the responsibility of the build server. Currently there is no way for the build server to tell the client the locations of build targets, but maybe there should be.
I'm really not sure. I don't think it's unreasonable for the LSP to have enough hooks that the starlark context object can do it, but build server would be "better".
After playing around with the build server protocol implementation for bazel, it doesn't seem to be in its prime time yet. I agree that having this in the LSP doesn't seem unreasonable, and quite a few other language servers have this feature.
I've opened up a draft PR here if you're interested in contributions of this feature: https://github.com/facebookexperimental/starlark-rust/pull/107
It would be nice to have support for codelens in the LSP, e.g. to build, test or run a particular target. This includes support for running the resulting command. The running of the commands would need to be implementation-specific, as would I imagine the gathering of the codelens items themselves.