I am a Vim user and would like to use Sonarlint with the new vim9 LSP plugin.
The coc-sonarlint plugin for CoC works quite well. I am trying to use the same arguments here to run it with the Vim9 LSP, but am getting the following output
It seems like the workspace is not set up correctly and the compile_command.json is not provided. Unfortunately I can’t find proper documentation on sonarlint-ls.
Here is the issue I’ve created in the Vim9 LSP repo, where you can see which arguments I am using. Maybe something is missing.
Hi there @jclsn, thanks for your interest in SonarLint
Disclaimer: I have zero experience with CoC or Vim9
Line from SonarLint Language Server output Failed to initialize workspace folders could mean a range of things, and TBH I don’t think it would be related to not having a path to compile commands
We are currently improving the log messages to include the actual stacktrace of what failed. You should be able to see more complete logs once we merge this PR.
Yes, I expected that, since Vim is more of a niche IDE. Nonetheless there are plugins that support the Language Server Protocol also used by VSCode. So yes it would be great if the logging and documentation on how to talk to the Sonarlint server improved. I also have to admit that the Vim9 LSP plugin hasn’t fully matured yet. So it might not send the right commands to the server.
For inspiration, here is the initialization options passed from VSCode client to the SonarLint Language Server. And here is where sonarlint.pathToCompileCommands is first read, but it is not required until analysis of related language file is triggered.
The general behavior is the following: on startup, the client sends an initialize request to the Language Server, which includes the initializationOptions linked above. Once everything is initialized, the client sends a didChangeConfiguration notification to the Language Server, providing all settings on the client side, including the pathToCompileCommands.
Thanks, but I think I do lack the skills to get this working. The CoC or Neovim plugins which exist are heavily based on the VSCode plugin and I have literally zero skills in Typescript nor am I motivated to learn it. I was hoping I could provide a workspaceConfig and initializationOptions and be done, but it seems I would have to write code to get this to work.
By default, we trigger analysis on file open, so whenever the client sends a textDocument/didOpen notification to the language server.
In VSCode, there is a "sonarlint.trace.server": "verbose" user setting you can use to trace all LSP communication between the client and the language server. Maybe you can give it a go in your environment as well.