From 88e8fc47c15982d57ab5b23071137c92bfd53d99 Mon Sep 17 00:00:00 2001 From: Marc Pervaz Boocha Date: Tue, 1 Apr 2025 21:18:19 +0530 Subject: Add LSP config --- .config/nvim/lsp/clangd.lua | 23 +++++++++++++++++++++++ .config/nvim/lsp/cssls.lua | 11 +++++++++++ .config/nvim/lsp/gopls.lua | 21 +++++++++++++++++++++ .config/nvim/lsp/html.lua | 11 +++++++++++ .config/nvim/lsp/jsonls.lua | 10 ++++++++++ .config/nvim/lsp/lua_ls.lua | 32 ++++++++++++++++++++++++++++++++ .config/nvim/lsp/mesonlsp.lua | 9 +++++++++ .config/nvim/lsp/ruff.lua | 10 ++++++++++ .config/nvim/lsp/ts_ls.lua | 39 +++++++++++++++++++++++++++++++++++++++ 9 files changed, 166 insertions(+) create mode 100644 .config/nvim/lsp/clangd.lua create mode 100644 .config/nvim/lsp/cssls.lua create mode 100644 .config/nvim/lsp/gopls.lua create mode 100644 .config/nvim/lsp/html.lua create mode 100644 .config/nvim/lsp/jsonls.lua create mode 100644 .config/nvim/lsp/lua_ls.lua create mode 100644 .config/nvim/lsp/mesonlsp.lua create mode 100644 .config/nvim/lsp/ruff.lua create mode 100644 .config/nvim/lsp/ts_ls.lua diff --git a/.config/nvim/lsp/clangd.lua b/.config/nvim/lsp/clangd.lua new file mode 100644 index 0000000..4f0b351 --- /dev/null +++ b/.config/nvim/lsp/clangd.lua @@ -0,0 +1,23 @@ +return { + cmd = { 'clangd' }, + filetypes = { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto' }, + root_markers = { + '.clangd', + '.clang-tidy', + '.clang-format', + 'compile_commands.json', + 'compile_flags.txt', + 'meson.build', + }, + settings = { + clangd = { + InlayHints = { + Designators = true, + Enabled = true, + ParameterNames = true, + DeducedTypes = true, + }, + fallbackFlags = { "-std=c++20" }, + }, + } +} diff --git a/.config/nvim/lsp/cssls.lua b/.config/nvim/lsp/cssls.lua new file mode 100644 index 0000000..10b60ec --- /dev/null +++ b/.config/nvim/lsp/cssls.lua @@ -0,0 +1,11 @@ +return { + cmd = { 'vscode-css-language-server', '--stdio' }, + filetypes = { 'css', 'scss', 'less' }, + init_options = { provideFormatter = true }, + root_markers = { 'package.json' }, + settings = { + css = { validate = true }, + scss = { validate = true }, + less = { validate = true }, + }, +} diff --git a/.config/nvim/lsp/gopls.lua b/.config/nvim/lsp/gopls.lua new file mode 100644 index 0000000..e3d00bc --- /dev/null +++ b/.config/nvim/lsp/gopls.lua @@ -0,0 +1,21 @@ +return { + cmd = { 'gopls' }, + filetypes = { 'go', 'gomod', 'gowork', 'gotmpl' }, + root_markers = { + 'go.work', + 'go.mod', + }, + settings = { + gopls = { + hints = { + rangeVariableTypes = true, + parameterNames = true, + constantValues = true, + assignVariableTypes = true, + compositeLiteralFields = true, + compositeLiteralTypes = true, + functionTypeParameters = true, + }, + }, + } +} diff --git a/.config/nvim/lsp/html.lua b/.config/nvim/lsp/html.lua new file mode 100644 index 0000000..cc769d5 --- /dev/null +++ b/.config/nvim/lsp/html.lua @@ -0,0 +1,11 @@ +return { + cmd = { 'vscode-html-language-server', '--stdio' }, + filetypes = { 'html', 'templ' }, + root_markers = { 'package.json' }, + settings = {}, + init_options = { + provideFormatter = true, + embeddedLanguages = { css = true, javascript = true }, + configurationSection = { 'html', 'css', 'javascript' }, + }, +} diff --git a/.config/nvim/lsp/jsonls.lua b/.config/nvim/lsp/jsonls.lua new file mode 100644 index 0000000..234cc94 --- /dev/null +++ b/.config/nvim/lsp/jsonls.lua @@ -0,0 +1,10 @@ +return { + cmd = { 'vscode-json-language-server', '--stdio' }, + filetypes = { 'json', 'jsonc' }, + init_options = { + provideFormatter = true, + }, + root_marker = {}, + single_file_support = true, +} + diff --git a/.config/nvim/lsp/lua_ls.lua b/.config/nvim/lsp/lua_ls.lua new file mode 100644 index 0000000..92e92fc --- /dev/null +++ b/.config/nvim/lsp/lua_ls.lua @@ -0,0 +1,32 @@ +return { + cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, + root_markers = { + '.luarc.json', + '.luarc.jsonc', + '.luacheckrc', + '.stylua.toml', + 'stylua.toml', + 'selene.toml', + 'selene.yml', + }, + settings = { + Lua = { + runtime = { + version = 'LuaJIT' + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true) + }, + completion = { + callSnippet = 'Replace', + }, + diagnostics = { + disable = { 'missing-fields' } + }, + hint = { + enable = true + } + }, + } +} diff --git a/.config/nvim/lsp/mesonlsp.lua b/.config/nvim/lsp/mesonlsp.lua new file mode 100644 index 0000000..6e7dd5d --- /dev/null +++ b/.config/nvim/lsp/mesonlsp.lua @@ -0,0 +1,9 @@ +return { + cmd = { 'mesonlsp', '--lsp' }, + filetypes = { 'meson' }, + root_markers = { + 'meson.build', + 'meson_options.txt', + 'meson.options' + }, +} diff --git a/.config/nvim/lsp/ruff.lua b/.config/nvim/lsp/ruff.lua new file mode 100644 index 0000000..0d174b3 --- /dev/null +++ b/.config/nvim/lsp/ruff.lua @@ -0,0 +1,10 @@ +return { + cmd = { 'ruff', 'server' }, + filetypes = { 'python' }, + root_marker = { + 'pyproject.toml', + 'ruff.toml', + '.ruff.toml' + }, + single_file_support = true, +} diff --git a/.config/nvim/lsp/ts_ls.lua b/.config/nvim/lsp/ts_ls.lua new file mode 100644 index 0000000..860951b --- /dev/null +++ b/.config/nvim/lsp/ts_ls.lua @@ -0,0 +1,39 @@ +return { + init_options = { hostInfo = 'neovim' }, + cmd = { 'typescript-language-server', '--stdio' }, + filetypes = { + 'javascript', + 'javascriptreact', + 'javascript.jsx', + 'typescript', + 'typescriptreact', + 'typescript.tsx', + }, + root_markers = { 'tsconfig.json', 'jsconfig.json', 'package.json'}, + settings = { + typescript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = false, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + javascript = { + inlayHints = { + includeInlayParameterNameHints = "all", + includeInlayParameterNameHintsWhenArgumentMatchesName = false, + includeInlayFunctionParameterTypeHints = true, + includeInlayVariableTypeHints = true, + includeInlayVariableTypeHintsWhenTypeMatchesName = false, + includeInlayPropertyDeclarationTypeHints = true, + includeInlayFunctionLikeReturnTypeHints = true, + includeInlayEnumMemberValueHints = true, + }, + }, + } +} -- cgit v1.2.3-70-g09d2