From 6eb0d74ec0a6b06620b50d42ee580d37f3084612 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sun, 5 Jan 2025 12:06:18 -0800 Subject: [PATCH] feat: Add language servers --- nix/neovim-overlay.nix | 5 +++- nvim/lsp/emmet-language-server.lua | 5 +++- nvim/lsp/lua-language-server.lua | 2 +- nvim/lsp/nixd.lua | 24 ++++++++++++++++++++ nvim/lsp/phpactor.lua | 10 ++++++++ nvim/lsp/stylelint-lsp.lua | 29 ++++++++++++++++++++++++ nvim/lsp/taplo.lua | 5 ++++ nvim/lsp/vscode-css-language-server.lua | 12 ++++++++++ nvim/lsp/vscode-html-language-server.lua | 11 +++++++++ nvim/lua/lsp.lua | 6 +++++ 10 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 nvim/lsp/nixd.lua create mode 100644 nvim/lsp/phpactor.lua create mode 100644 nvim/lsp/stylelint-lsp.lua create mode 100644 nvim/lsp/taplo.lua create mode 100644 nvim/lsp/vscode-css-language-server.lua create mode 100644 nvim/lsp/vscode-html-language-server.lua diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 033b531..502204a 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -143,6 +143,10 @@ with final.pkgs.lib; let emmet-language-server lua-language-server nixd + phpactor + stylelint-lsp + taplo + vscode-langservers-extracted # html, css, json, eslint # Linters biome @@ -157,7 +161,6 @@ with final.pkgs.lib; let php84Packages.php-cs-fixer nodePackages.prettier rustywind - taplo shfmt stylelint stylua diff --git a/nvim/lsp/emmet-language-server.lua b/nvim/lsp/emmet-language-server.lua index 2f1899c..3b33a2d 100644 --- a/nvim/lsp/emmet-language-server.lua +++ b/nvim/lsp/emmet-language-server.lua @@ -1,17 +1,20 @@ return { cmd = { 'emmet-language-server', '--stdio' }, filetypes = { + 'blade', 'css', 'eruby', 'html', + 'htmlangular', 'htmldjango', 'javascriptreact', 'less', + 'liquid', 'pug', 'sass', 'scss', 'typescriptreact', - 'htmlangular', + 'vue', }, root_markers = { '.git' }, } diff --git a/nvim/lsp/lua-language-server.lua b/nvim/lsp/lua-language-server.lua index 1a3fe1b..a9106e7 100644 --- a/nvim/lsp/lua-language-server.lua +++ b/nvim/lsp/lua-language-server.lua @@ -1,6 +1,6 @@ return { - filetypes = { 'lua' }, cmd = { 'lua-language-server' }, + filetypes = { 'lua' }, root_markers = { '.luarc.json', '.luarc.jsonc', diff --git a/nvim/lsp/nixd.lua b/nvim/lsp/nixd.lua new file mode 100644 index 0000000..178f28c --- /dev/null +++ b/nvim/lsp/nixd.lua @@ -0,0 +1,24 @@ +return { + cmd = { 'nixd' }, + filetypes = { 'nix' }, + root_markers = { 'flake.nix', '.git' }, + + settings = { + nixd = { + formatting = { + command = { 'alejandra' }, + }, + options = { + nixos = { + expr = '(builtins.getFlake "/home/marley/marleyos").nixosConfigurations.nyx.options', + }, + ['home-manager'] = { + expr = '(builtins.getFlake "/home/marley/marleyos").homeConfigurations."marley@nyx".options', + }, + ['nix-darwin'] = { + expr = '(builtins.getFlake "/home/marley/marleyos").darwinConfigurations.mairley.options', + }, + }, + }, + }, +} diff --git a/nvim/lsp/phpactor.lua b/nvim/lsp/phpactor.lua new file mode 100644 index 0000000..65ddafd --- /dev/null +++ b/nvim/lsp/phpactor.lua @@ -0,0 +1,10 @@ +return { + cmd = { 'phpactor', 'language-server' }, + filetypes = { 'php', 'blade' }, + root_markers = { + 'composer.json', + '.git', + '.phpactor.json', + '.phpactor.yml', + }, +} diff --git a/nvim/lsp/stylelint-lsp.lua b/nvim/lsp/stylelint-lsp.lua new file mode 100644 index 0000000..cd59152 --- /dev/null +++ b/nvim/lsp/stylelint-lsp.lua @@ -0,0 +1,29 @@ +return { + cmd = { 'stylelint-lsp', '--stdio' }, + filetypes = { + 'css', + 'less', + 'scss', + 'sugarss', + 'vue', + 'wxss', + }, + root_markers = { + '.stylelintrc', + '.stylelintrc.cjs', + '.stylelintrc.js', + '.stylelintrc.json', + '.stylelintrc.yaml', + '.stylelintrc.yml', + 'stylelint.config.cjs', + 'stylelint.config.js', + }, + + settings = { + stylelintplus = { + autoFixOnFormat = true, + validateOnSave = true, + validateOnType = false, + }, + }, +} diff --git a/nvim/lsp/taplo.lua b/nvim/lsp/taplo.lua new file mode 100644 index 0000000..d1a3757 --- /dev/null +++ b/nvim/lsp/taplo.lua @@ -0,0 +1,5 @@ +return { + cmd = { 'taplo', 'lsp', 'stdio' }, + filetypes = { 'toml' }, + root_markers = { '.git' }, +} diff --git a/nvim/lsp/vscode-css-language-server.lua b/nvim/lsp/vscode-css-language-server.lua new file mode 100644 index 0000000..054e6ec --- /dev/null +++ b/nvim/lsp/vscode-css-language-server.lua @@ -0,0 +1,12 @@ +return { + cmd = { 'vscode-css-language-server', '--stdio' }, + filetypes = { 'css', 'scss', 'less' }, + root_markers = { 'package.json', '.git' }, + + init_options = { provideFormatter = true }, + settings = { + css = { validate = true }, + scss = { validate = true }, + less = { validate = true }, + }, +} diff --git a/nvim/lsp/vscode-html-language-server.lua b/nvim/lsp/vscode-html-language-server.lua new file mode 100644 index 0000000..09c5a32 --- /dev/null +++ b/nvim/lsp/vscode-html-language-server.lua @@ -0,0 +1,11 @@ +return { + cmd = { 'vscode-html-language-server', '--stdio' }, + filetypes = { 'html', 'templ', 'liquid' }, + root_markers = { 'package.json', '.git' }, + + init_options = { + provideFormatter = true, + embeddedLanguages = { css = true, javascript = true }, + configurationSection = { 'html', 'css', 'javascript' }, + }, +} diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua index af5ca60..5b9e766 100644 --- a/nvim/lua/lsp.lua +++ b/nvim/lua/lsp.lua @@ -83,6 +83,12 @@ vim.lsp.enable({ 'bash-language-server', 'emmet-language-server', 'lua-language-server', + 'nixd', + 'phpactor', + 'stylelint-lsp', + 'taplo', + 'vscode-css-language-server', + 'vscode-html-language-server', }) -- Keymaps -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --