diff --git a/init.lua b/init.lua index 8a515b8..dd4c62b 100644 --- a/init.lua +++ b/init.lua @@ -4,3 +4,4 @@ require "user.plugins" require "user.colorscheme" require "user.cmp" require "user.lsp" + diff --git a/lua/user/cmp.lua b/lua/user/cmp.lua index a151214..0ba1fc7 100644 --- a/lua/user/cmp.lua +++ b/lua/user/cmp.lua @@ -102,6 +102,7 @@ cmp.setup { -- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind vim_item.menu = ({ nvim_lsp = "[LSP]", + nvim_lua = "[NVIM_LUA]", luasnip = "[Snippet]", buffer = "[Buffer]", path = "[Path]", @@ -111,6 +112,7 @@ cmp.setup { }, sources = { { name = "nvim_lsp" }, + { name = "nvim_lua" }, { name = "luasnip" }, { name = "buffer" }, { name = "path" }, diff --git a/lua/user/lsp/lsp-installer.lua b/lua/user/lsp/lsp-installer.lua index 2fe4af2..f539050 100644 --- a/lua/user/lsp/lsp-installer.lua +++ b/lua/user/lsp/lsp-installer.lua @@ -21,6 +21,11 @@ lsp_installer.on_server_ready(function(server) opts = vim.tbl_deep_extend("force", sumneko_opts, opts) end + if server.name == "pyright" then + local pyright_opts = require("user.lsp.settings.pyright") + opts = vim.tbl_deep_extend("force", pyright_opts, opts) + end + -- This setup() function is exactly the same as lspconfig's setup function. -- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md server:setup(opts) diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua index 1fffa68..be362c9 100644 --- a/lua/user/lsp/settings/jsonls.lua +++ b/lua/user/lsp/settings/jsonls.lua @@ -1,9 +1,4 @@ -local default_schemas = nil -local status_ok, jsonls_settings = pcall(require, "nlspsettings.jsonls") -if status_ok then - default_schemas = jsonls_settings.get_default_schemas() -end - +-- Find more schemas here: https://www.schemastore.org/json/ local schemas = { { description = "TypeScript compiler configuration file", @@ -168,19 +163,10 @@ local schemas = { }, } -local function extend(tab1, tab2) - for _, value in ipairs(tab2) do - table.insert(tab1, value) - end - return tab1 -end - -local extended_schemas = extend(schemas, default_schemas) - local opts = { settings = { json = { - schemas = extended_schemas, + schemas = schemas, }, }, setup = { diff --git a/lua/user/lsp/settings/pyright.lua b/lua/user/lsp/settings/pyright.lua new file mode 100644 index 0000000..6354274 --- /dev/null +++ b/lua/user/lsp/settings/pyright.lua @@ -0,0 +1,10 @@ +return { + settings = { + + python = { + analysis = { + typeCheckingMode = "off" + } + } + }, +} diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua index 45141e2..17dd7b5 100644 --- a/lua/user/plugins.lua +++ b/lua/user/plugins.lua @@ -56,6 +56,7 @@ return packer.startup(function(use) use "hrsh7th/cmp-cmdline" -- cmdline completions use "saadparwaiz1/cmp_luasnip" -- snippet completions use "hrsh7th/cmp-nvim-lsp" + use "hrsh7th/cmp-nvim-lua" -- snippets use "L3MON4D3/LuaSnip" --snippet engine @@ -64,7 +65,6 @@ return packer.startup(function(use) -- LSP use "neovim/nvim-lspconfig" -- enable LSP use "williamboman/nvim-lsp-installer" -- simple to use language server installer - use "tamago324/nlsp-settings.nvim" -- language server settings defined in json for -- Automatically set up your configuration after cloning packer.nvim -- Put this at the end after all plugins