From fee237476c3cc697c53cbcbdd5135c8f0478fe18 Mon Sep 17 00:00:00 2001 From: Bryan Ramos Date: Sun, 28 May 2023 20:27:37 -0400 Subject: [PATCH] Rework to get LSPs working, they're working now. --- .../dotfiles/nvim/lua/config/autocmds.lua | 26 ++++++++ homeConfig/dotfiles/nvim/lua/plugins/core.lua | 65 ++++++++++++------- homeConfig/home.nix | 11 ++++ 3 files changed, 78 insertions(+), 24 deletions(-) diff --git a/homeConfig/dotfiles/nvim/lua/config/autocmds.lua b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua index 27e9e06..68822be 100644 --- a/homeConfig/dotfiles/nvim/lua/config/autocmds.lua +++ b/homeConfig/dotfiles/nvim/lua/config/autocmds.lua @@ -1,3 +1,29 @@ -- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here +local lsp = require('lsp-zero').preset({}) + +lsp.on_attach(function(client, bufnr) + lsp.default_keymaps({buffer = bufnr}) +end) + +-- When you don't have mason.nvim installed +-- You'll need to list the servers installed in your system +lsp.setup_servers({ + 'tsserver', + 'eslint', + 'hls', + 'pyright', + 'nil_ls', + 'volar', + 'cssls', + 'html', + 'jsonls', + 'diagnosticls', + 'lua_ls' +}) + +-- (Optional) Configure lua language server for neovim +require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls()) + +lsp.setup() diff --git a/homeConfig/dotfiles/nvim/lua/plugins/core.lua b/homeConfig/dotfiles/nvim/lua/plugins/core.lua index d3ead8c..429687b 100644 --- a/homeConfig/dotfiles/nvim/lua/plugins/core.lua +++ b/homeConfig/dotfiles/nvim/lua/plugins/core.lua @@ -14,29 +14,46 @@ return { end, }, - { - "neovim/nvim-lspconfig", - ---@class PluginLspOpts - opts = { - ---@type lspconfig.options - servers = { - html = {}, - cssls = {}, - jsonls = {}, - marksman = {}, - tsserver = {}, - tailwindcss = {}, - volar = {}, + {'williamboman/mason.nvim', enabled = false }, + +{ + 'VonHeikemen/lsp-zero.nvim', + branch = 'v2.x', + dependencies = { + -- LSP Support + {'neovim/nvim-lspconfig'}, -- Required + {'williamboman/mason-lspconfig.nvim'}, -- Optional - lua_ls = {}, - - nil_ls = {}, - pyright = {}, - - --hls = {}, - rust_analyzer = {}, - diagnosticls = {}, - }, - }, - }, + -- Autocompletion + {'hrsh7th/nvim-cmp'}, -- Required + {'hrsh7th/cmp-nvim-lsp'}, -- Required + {'L3MON4D3/LuaSnip'}, -- Required + } +} + +-- { +-- "neovim/nvim-lspconfig", +-- ---@class PluginLspOpts +-- opts = { +-- ---@type lspconfig.options +-- servers = { +-- html = {}, +-- cssls = {}, +-- jsonls = {}, +-- marksman = {}, +-- tsserver = {}, +-- tailwindcss = {}, +-- volar = {}, +-- +-- lua_ls = {}, +-- +-- nil_ls = {}, +-- pyright = {}, +-- +-- --hls = {}, +-- rust_analyzer = {}, +-- diagnosticls = {}, +-- }, +-- }, +-- }, } diff --git a/homeConfig/home.nix b/homeConfig/home.nix index fa4c9d6..8f97cf5 100644 --- a/homeConfig/home.nix +++ b/homeConfig/home.nix @@ -77,6 +77,17 @@ cargo python3 python311Packages.pip + +# LSPs + nodePackages.vscode-langservers-extracted + nodePackages.prettier + nodePackages.typescript-language-server + nodePackages.diagnostic-languageserver + nodePackages.volar + nodePackages.pyright + haskell-language-server + nil + sumneko-lua-language-server ]; # PROGRAM CONFIGS