diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-03 10:36:10 +0100 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2025-12-14 23:40:14 +0100 |
| commit | 79f1a457511017c9ad68e4b0aa206f58b6b3a47f (patch) | |
| tree | b6d057a49ff0933be685731f7ea3e51aad46d26e /config/nvim/lua | |
| parent | f1478b23dc185f8fe091c61044eefe3aacbe6ff2 (diff) | |
Add wmap syntax parser. Add swift LSP rules. Improve tranquil light
colors in neovim.
Diffstat (limited to 'config/nvim/lua')
| -rw-r--r-- | config/nvim/lua/lsp.lua | 47 | ||||
| -rw-r--r-- | config/nvim/lua/plugins.lua | 1 | ||||
| -rw-r--r-- | config/nvim/lua/treesitter_config.lua | 1 |
3 files changed, 49 insertions, 0 deletions
diff --git a/config/nvim/lua/lsp.lua b/config/nvim/lua/lsp.lua index 3482564..2c2cbf2 100644 --- a/config/nvim/lua/lsp.lua +++ b/config/nvim/lua/lsp.lua @@ -1,3 +1,7 @@ +local util = require 'lspconfig.util' + +-- JAVASCRIPT FAMILY ----------------------------------------------------------- + vim.lsp.config('ts_ls', { cmd = { 'typescript-language-server', '--stdio' }, filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, @@ -19,6 +23,8 @@ vim.lsp.config('svelte', { }) vim.lsp.enable('svelte') +-- PYTHON ---------------------------------------------------------------------- + vim.lsp.config('pyright', { cmd = { 'pyright-langserver', '--stdio' }, filetypes = { 'python' }, @@ -26,6 +32,8 @@ vim.lsp.config('pyright', { }) vim.lsp.enable('pyright') +-- RUST ------------------------------------------------------------------------ + vim.lsp.config('rust_analyzer', { cmd = { 'rust-analyzer' }, filetypes = { 'rust' }, @@ -55,6 +63,8 @@ vim.lsp.config('rust_analyzer', { }) vim.lsp.enable('rust_analyzer') +-- LUA ------------------------------------------------------------------------- + vim.lsp.config('lua_ls', { cmd = { 'lua-language-server' }, filetypes = { 'lua' }, @@ -62,6 +72,8 @@ vim.lsp.config('lua_ls', { }) vim.lsp.enable('lua_ls') +-- GLEAM------------------------------------------------------------------------ + vim.lsp.config('gleam', { cmd = { 'gleam', 'lsp' }, filetypes = { 'gleam' }, @@ -69,6 +81,41 @@ vim.lsp.config('gleam', { }) 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') + -- Enable inlay hints for Rust when LSP attaches vim.api.nvim_create_autocmd('LspAttach', { callback = function(args) diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 758c5fe..5ace9d1 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -82,6 +82,7 @@ require('lazy').setup({ -- Treesitter 'nvim-treesitter/nvim-treesitter', 'https://git.sr.ht/~rbdr/tree-sitter-api-notation', + 'https://git.sr.ht/~rbdr/tree-sitter-wmap', -- LSP { diff --git a/config/nvim/lua/treesitter_config.lua b/config/nvim/lua/treesitter_config.lua index 16986d6..2502859 100644 --- a/config/nvim/lua/treesitter_config.lua +++ b/config/nvim/lua/treesitter_config.lua @@ -28,6 +28,7 @@ require'nvim-treesitter.configs'.setup { 'toml', 'tsx', 'typescript', + 'wmap', 'yaml' }, |