Skip to content

Commit d96c771

Browse files
authored
feat(lsp): add sonarlint-nvim (#1526)
* feat(lsp): add sonarlint-nvim * use opts instead of config * add xml and php
1 parent 2758407 commit d96c771

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# sonarlint.nvim
2+
3+
A community plugin that integrates [SonarLint](https://github.com/SonarSource/sonarlint-language-server) language server for static code analysis and linting.
4+
5+
## Configured Languages
6+
7+
- C/C++
8+
- Docker
9+
- Go
10+
- HTML/CSS
11+
- Java
12+
- JavaScript/TypeScript
13+
- PHP
14+
- Python
15+
- XML
16+
17+
**Repository:** <https://gitlab.com/schrieveslaach/sonarlint.nvim>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
local analyzers_path = vim.fn.stdpath "data" .. "/mason/packages/sonarlint-language-server/extension/analyzers/"
2+
3+
local sonarlint_ft = {
4+
"c",
5+
"cpp",
6+
"css",
7+
"docker",
8+
"go",
9+
"html",
10+
"java",
11+
"javascript",
12+
"javascriptreact",
13+
"php",
14+
"python",
15+
"typescript",
16+
"typescriptreact",
17+
"xml",
18+
"yaml.docker-compose",
19+
}
20+
21+
---@type LazySpec
22+
return {
23+
"https://gitlab.com/schrieveslaach/sonarlint.nvim",
24+
optional = true,
25+
ft = sonarlint_ft,
26+
specs = {
27+
{
28+
"williamboman/mason-lspconfig.nvim",
29+
optional = true,
30+
opts = function(_, opts)
31+
opts.ensure_installed =
32+
require("astrocore").list_insert_unique(opts.ensure_installed, { "sonarlint-language-server" })
33+
end,
34+
},
35+
{
36+
"WhoIsSethDaniel/mason-tool-installer.nvim",
37+
optional = true,
38+
opts = function(_, opts)
39+
local astrocore = require "astrocore"
40+
opts.ensure_installed = astrocore.list_insert_unique(opts.ensure_installed, { "sonarlint-language-server" })
41+
end,
42+
},
43+
},
44+
opts = {
45+
server = {
46+
cmd = {
47+
"sonarlint-language-server",
48+
"-stdio",
49+
"-analyzers",
50+
analyzers_path .. "sonargo.jar",
51+
analyzers_path .. "sonarhtml.jar",
52+
analyzers_path .. "sonariac.jar",
53+
analyzers_path .. "sonarjava.jar",
54+
analyzers_path .. "sonarjavasymbolicexecution.jar",
55+
analyzers_path .. "sonarjs.jar",
56+
analyzers_path .. "sonarphp.jar",
57+
analyzers_path .. "sonarpython.jar",
58+
analyzers_path .. "sonarxml.jar",
59+
},
60+
},
61+
filetypes = sonarlint_ft,
62+
},
63+
}

0 commit comments

Comments
 (0)