Skip to content

Commit

Permalink
chore: refactor lsp config
Browse files Browse the repository at this point in the history
Former-commit-id: 8439001
  • Loading branch information
silveiralexf committed Mar 16, 2024
1 parent d8589e6 commit 893016e
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 54 deletions.
44 changes: 44 additions & 0 deletions nvim/lua/lsp/config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"bash",
"dockerfile",
"go",
"gomod",
"gosum",
"gowork",
"hcl",
"helm",
"html",
"java",
"javascript",
"json",
"json5",
"jsonc",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"terraform",
"tsx",
"typescript",
"vim",
"vue",
"yaml",
})
end,
vim.filetype.add({
extension = { rasi = "rasi" },
pattern = {
[".*/waybar/config"] = "jsonc",
[".*/mako/config"] = "dosini",
[".*/kitty/*.conf"] = "bash",
[".*/hypr/.*%.conf"] = "hyprlang",
},
}),
},
}
27 changes: 27 additions & 0 deletions nvim/lua/lsp/servers/json.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
codelens = {
enabled = true,
},
servers = {
jsonls = {
-- lazy-load schemastore when needed
on_new_config = function(new_config)
new_config.settings.json.schemas = new_config.settings.json.schemas or {}
vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
end,
settings = {
json = {
format = {
enable = true,
},
validate = { enable = true },
},
},
},
},
},
},
}
11 changes: 11 additions & 0 deletions nvim/lua/lsp/servers/python.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ return {
},
},
},
{
"neovim/nvim-lspconfig",
opts = {
codelens = {
enabled = true,
},
servers = {
ruff_lsp = {},
},
},
},
},
},
}
54 changes: 0 additions & 54 deletions nvim/lua/lsp/init.lua → nvim/lua/lsp/servers/yaml.lua
Original file line number Diff line number Diff line change
@@ -1,61 +1,11 @@
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
vim.list_extend(opts.ensure_installed, {
"bash",
"dockerfile",
"go",
"gomod",
"gosum",
"gowork",
"hcl",
"helm",
"html",
"java",
"javascript",
"json",
"json5",
"jsonc",
"lua",
"markdown",
"markdown_inline",
"python",
"query",
"regex",
"terraform",
"tsx",
"typescript",
"vim",
"yaml",
})
end,
},
{
"neovim/nvim-lspconfig",
opts = {
codelens = {
enabled = true,
},
servers = {
---
--- JSON/YAML
---
jsonls = {
-- lazy-load schemastore when needed
on_new_config = function(new_config)
new_config.settings.json.schemas = new_config.settings.json.schemas or {}
vim.list_extend(new_config.settings.json.schemas, require("schemastore").json.schemas())
end,
settings = {
json = {
format = {
enable = true,
},
validate = { enable = true },
},
},
},
yamlls = {
-- Have to add this for yamlls to understand that we support line folding
capabilities = {
Expand Down Expand Up @@ -89,10 +39,6 @@ return {
},
},
},
---
--- Rust
---
ruff_lsp = {},
},
},
},
Expand Down

0 comments on commit 893016e

Please sign in to comment.