summaryrefslogtreecommitdiff
path: root/lua/user/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'lua/user/lsp')
-rw-r--r--lua/user/lsp/handlers.lua9
-rw-r--r--lua/user/lsp/lsp-installer.lua5
-rw-r--r--lua/user/lsp/null-ls.lua3
-rw-r--r--lua/user/lsp/settings/jsonls.lua33
-rw-r--r--lua/user/lsp/settings/pyright.lua10
5 files changed, 32 insertions, 28 deletions
diff --git a/lua/user/lsp/handlers.lua b/lua/user/lsp/handlers.lua
index fb8b7f8..5792a74 100644
--- a/lua/user/lsp/handlers.lua
+++ b/lua/user/lsp/handlers.lua
@@ -72,13 +72,8 @@ local function lsp_keymaps(bufnr)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", opts)
-- vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>f", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d", '<cmd>lua vim.diagnostic.goto_prev({ border = "rounded" })<CR>', opts)
- vim.api.nvim_buf_set_keymap(
- bufnr,
- "n",
- "gl",
- '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({ border = "rounded" })<CR>',
- opts
- )
+ vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.lsp.diagnostic.open_float()<CR>", opts)
+ vim.api.nvim_buf_set_keymap(bufnr, "n", "gl", "<cmd>lua vim.diagnostic.open_float()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d", '<cmd>lua vim.diagnostic.goto_next({ border = "rounded" })<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>q", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]]
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/null-ls.lua b/lua/user/lsp/null-ls.lua
index 874e19c..b261418 100644
--- a/lua/user/lsp/null-ls.lua
+++ b/lua/user/lsp/null-ls.lua
@@ -1,7 +1,6 @@
local null_ls_status_ok, null_ls = pcall(require, "null-ls")
if not null_ls_status_ok then
return
-end
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
local formatting = null_ls.builtins.formatting
@@ -14,6 +13,6 @@ null_ls.setup({
formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
formatting.black.with({ extra_args = { "--fast" } }),
formatting.stylua,
- -- diagnostics.flake8
+ diagnostics.flake8
},
})
diff --git a/lua/user/lsp/settings/jsonls.lua b/lua/user/lsp/settings/jsonls.lua
index 2ee88db..f4e4abb 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,22 +163,10 @@ local schemas = {
},
}
-local function extend(tab1, tab2)
- if tab2 == nil then
- return tab2
- end
- 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 = {
@@ -198,3 +181,15 @@ local opts = {
}
return opts
+
+local function extend(tab1, tab2)
+ if tab2 == nil then
+ return tab2
+ end
+ for _, value in ipairs(tab2) do
+ table.insert(tab1, value)
+ end
+ return tab1
+end
+
+local extended_schemas = extend(schemas, default_schemas)
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"
+ }
+ }
+ },
+}