aboutsummaryrefslogtreecommitdiff
path: root/config/nvim/lua/lsp.lua
diff options
context:
space:
mode:
authorRuben Beltran del Rio <jj@r.bdr.sh>2026-04-19 23:35:38 +0200
committerRuben Beltran del Rio <jj@r.bdr.sh>2026-05-03 01:40:20 +0200
commit03826ed4582c6daa07b1dcae32a675d49f318c50 (patch)
treefc8273391e473fc45397ed48b6b1af42563e55c7 /config/nvim/lua/lsp.lua
parentcb3048ea88f56fffa43eeb2cf8262e8518c6c0c4 (diff)
Add new languages to neovim
Diffstat (limited to 'config/nvim/lua/lsp.lua')
-rw-r--r--config/nvim/lua/lsp.lua133
1 files changed, 5 insertions, 128 deletions
diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua
index 9838887..f5718c4 100644
--- a/config/nvim/lua/lsp.lua
+++ b/config/nvim/lua/lsp.lua
@@ -1,141 +1,18 @@
local util = require 'lspconfig.util'
--- JAVASCRIPT FAMILY -----------------------------------------------------------
-
-vim.lsp.config('ts_ls', {
- cmd = { 'typescript-language-server', '--stdio' },
- filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' },
- root_markers = { 'package.json', 'tsconfig.json', 'jsconfig.json' }
-})
vim.lsp.enable('ts_ls')
-
-vim.lsp.config('eslint', {
- cmd = { 'vscode-eslint-language-server', '--stdio' },
- filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' },
- root_markers = { '.eslintrc', '.eslintrc.js', '.eslintrc.json', 'package.json' }
-})
vim.lsp.enable('eslint')
-
-vim.lsp.config('svelte', {
- cmd = { 'svelteserver', '--stdio' },
- filetypes = { 'svelte' },
- root_markers = { 'package.json', 'svelte.config.js' }
-})
vim.lsp.enable('svelte')
-
--- PYTHON ----------------------------------------------------------------------
-
-vim.lsp.config('pyright', {
- cmd = { 'pyright-langserver', '--stdio' },
- filetypes = { 'python' },
- root_markers = { 'pyproject.toml', 'setup.py', 'requirements.txt' }
-})
vim.lsp.enable('pyright')
-
--- RUST ------------------------------------------------------------------------
-
-vim.lsp.config('rust_analyzer', {
- cmd = { 'rust-analyzer' },
- filetypes = { 'rust' },
- root_markers = { 'Cargo.toml', 'rust-project.json' },
- settings = {
- ['rust-analyzer'] = {
- imports = {
- granularity = {
- group = "module",
- },
- prefix = "self",
- },
- cargo = {
- buildScripts = {
- enable = true,
- },
- },
- procMacro = {
- enable = true
- },
- checkOnSave = {
- enable = true,
- command = "clippy"
- }
- },
- },
-})
vim.lsp.enable('rust_analyzer')
-
--- LUA -------------------------------------------------------------------------
-
-vim.lsp.config('lua_ls', {
- cmd = { 'lua-language-server' },
- filetypes = { 'lua' },
- root_markers = { '.luarc.json', '.luarc.jsonc', '.luacheckrc', 'stylua.toml', 'selene.toml' },
-})
vim.lsp.enable('lua_ls')
-
--- GLEAM------------------------------------------------------------------------
-
-vim.lsp.config('gleam', {
- cmd = { 'gleam', 'lsp' },
- filetypes = { 'gleam' },
- root_markers = { 'gleam.toml' },
-})
vim.lsp.enable('gleam')
-
--- SWIFT AND THE Cs ------------------------------------------------------------
-
-vim.lsp.config('sourcekit', {
- cmd = { 'sourcekit-lsp' },
- filetypes = { 'swift', 'objc', 'objcpp', 'c', 'cpp' },
- root_dir = function(bufnr, on_dir)
- local filename = vim.api.nvim_buf_get_name(bufnr)
- on_dir(
- util.root_pattern('buildServer.json', '.bsp')(filename)
- or util.root_pattern('*.xcodeproj', '*.xcworkspace')(filename)
- -- better to keep it at the end, because some modularized apps contain multiple Package.swift files
- or util.root_pattern('compile_commands.json', 'Package.swift')(filename)
- or vim.fs.dirname(vim.fs.find('.git', { path = filename, upward = true })[1])
- )
- end,
- get_language_id = function(_, ftype)
- local t = { objc = 'objective-c', objcpp = 'objective-cpp' }
- return t[ftype] or ftype
- end,
- capabilities = {
- workspace = {
- didChangeWatchedFiles = {
- dynamicRegistration = true,
- },
- },
- textDocument = {
- diagnostic = {
- dynamicRegistration = true,
- relatedDocumentSupport = true,
- },
- },
- },
-})
vim.lsp.enable('sourcekit')
-
--- RUBY ------------------------------------------------------------------------
-vim.lsp.config('ruby', {
- cmd = function(dispatchers, config)
- return vim.lsp.rpc.start(
- { 'mise x -- ruby-lsp' },
- dispatchers,
- config and config.root_dir and { cwd = config.cmd_cwd or config.root_dir }
- )
- end,
- filetypes = { 'ruby', 'eruby' },
- root_markers = { 'Gemfile', '.git' },
- init_options = {
- formatter = 'auto',
- },
- reuse_client = function(client, config)
- config.cmd_cwd = config.root_dir
- return client.config.cmd_cwd == config.cmd_cwd
- end,
-})
-vim.lsp.enable('ruby')
+vim.lsp.enable('ruby_lsp')
+vim.lsp.enable('hls')
+vim.lsp.enable('julials')
+vim.lsp.enable('r_language_server')
+vim.lsp.enable('leanls')
-- Enable inlay hints for Rust when LSP attaches
vim.api.nvim_create_autocmd('LspAttach', {