updated lsp version, added copy to clipboard keybind
This commit is contained in:
@ -62,7 +62,7 @@ cmp.setup {
|
||||
},
|
||||
-- Accept currently selected item. If none selected, `select` first item.
|
||||
-- Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<CR>"] = cmp.mapping.confirm { select = true },
|
||||
["<CR>"] = cmp.mapping.confirm { select = false },
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
|
||||
@ -39,6 +39,7 @@ keymap("n", "g#", "g#zz", opts)
|
||||
keymap("n", "<C-u>", "<C-u>zz", opts)
|
||||
keymap("n", "<C-d>", "<C-d>zz", opts)
|
||||
|
||||
-- Allow moving selected text
|
||||
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
||||
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
||||
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
|
||||
@ -48,5 +49,8 @@ keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
|
||||
keymap("n", "<S-l>", ":tabnext<CR>", opts)
|
||||
keymap("n", "<S-h>", ":tabprevious<CR>", opts)
|
||||
|
||||
-- Copy to clipboard
|
||||
keymap("v", "<C-c>", "\"+y", opts)
|
||||
|
||||
--Close buffer
|
||||
-- keymap("n", "<C-w>", ":bd | bp <CR>", opts)
|
||||
|
||||
@ -27,17 +27,4 @@ M.setup = function()
|
||||
vim.diagnostic.config(config)
|
||||
end
|
||||
|
||||
-- local function lsp_highlight_document(client)
|
||||
-- -- Set autocommands conditional on server_capabilities
|
||||
-- local status_ok, illuminate = pcall(require, "illuminate")
|
||||
-- if not status_ok then
|
||||
-- return
|
||||
-- end
|
||||
-- illuminate.on_attach(client)
|
||||
-- end
|
||||
|
||||
-- M.on_attach = function(client, bufnr)
|
||||
-- lsp_highlight_document(client)
|
||||
-- end
|
||||
|
||||
return M
|
||||
@ -3,21 +3,10 @@ if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local status_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local status_ok, lspconfig = pcall(require, "lspconfig")
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
mason.setup()
|
||||
mason_lspconfig.setup()
|
||||
|
||||
vim.cmd([[ command! Format execute 'lua vim.lsp.buf.format{async=true}' ]])
|
||||
|
||||
require("user.lsp.mason_lsp_config")
|
||||
require("user.lsp.diagnostics_config").setup()
|
||||
-- require("user.none_ls") -- TODO: For now only uses python isort, uncomment when new stuff will be used
|
||||
|
||||
require("user.lsp.handlers").setup()
|
||||
vim.cmd([[ command! Format execute 'lua vim.lsp.buf.format{async=true}' ]])
|
||||
|
||||
@ -1,65 +1,48 @@
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
local navic = require("nvim-navic")
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
-- The first entry (without a key) will be the default handler
|
||||
-- and will be called for each installed server that doesn't have
|
||||
-- a dedicated handler.
|
||||
["omnisharp"] = function()
|
||||
require("lspconfig")["omnisharp"].setup({
|
||||
on_attach = function(client, bufnr)
|
||||
if client.name == "omnisharp" then
|
||||
client.server_capabilities.semanticTokensProvider = nil
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
["pylsp"] = function()
|
||||
require("lspconfig")["pylsp"].setup({
|
||||
on_attach = function(client, bufnr)
|
||||
navic.attach(client, bufnr)
|
||||
end,
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pycodestyle = {
|
||||
ignore = { "E501", "E231", "W503" },
|
||||
maxLineLength = 100,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
["rust_analyzer"] = function()
|
||||
require("lspconfig")["rust_analyzer"].setup({
|
||||
on_attach = function(client, bufnr)
|
||||
navic.attach(client, bufnr)
|
||||
end,
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup({
|
||||
on_attach = function(client, bufnr)
|
||||
navic.attach(client, bufnr)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
-- ["omnisharp"] = function()
|
||||
-- require("omnisharp").setup({})
|
||||
-- end,
|
||||
-- Next, you can provide a dedicated handler for specific servers.
|
||||
-- For example, a handler override for the `rust_analyzer`:
|
||||
-- ["rust_analyzer"] = function()
|
||||
-- require("rust-tools").setup({})
|
||||
-- end,
|
||||
vim.lsp.enable({
|
||||
"omnisharp",
|
||||
"pylsp",
|
||||
"rust_analyzer",
|
||||
})
|
||||
|
||||
-- TODO: this does not work, need to install pylsp-mypy plugin manually
|
||||
local function extra_args()
|
||||
local virtual = os.getenv("VIRTUAL_ENV") or "/usr"
|
||||
return { "--python-executable", virtual .. "/bin/python3", true }
|
||||
end
|
||||
|
||||
vim.lsp.config('pylsp', {
|
||||
settings = {
|
||||
["pylsp"] = {
|
||||
enabled = true,
|
||||
plugins = {
|
||||
pycodestyle = {
|
||||
ignore = { "E501", "E231", "W503" },
|
||||
maxLineLength = 100,
|
||||
},
|
||||
pyls_isort = { enabled = true },
|
||||
pylsp_mypy = {
|
||||
enabled = true,
|
||||
-- this will make mypy to use the virtual environment
|
||||
-- if not activated then it will use the system python(more specifically /usr/bin/python3)
|
||||
overrides = extra_args(),
|
||||
report_progress = true,
|
||||
live_mode = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
vim.lsp.config('rust_analyzer', {
|
||||
settings = {
|
||||
["rust-analyzer"] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
mason_lspconfig.setup()
|
||||
|
||||
@ -1,182 +0,0 @@
|
||||
local schemas = {
|
||||
{
|
||||
description = "TypeScript compiler configuration file",
|
||||
fileMatch = {
|
||||
"tsconfig.json",
|
||||
"tsconfig.*.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/tsconfig.json",
|
||||
},
|
||||
{
|
||||
description = "Lerna config",
|
||||
fileMatch = { "lerna.json" },
|
||||
url = "https://json.schemastore.org/lerna.json",
|
||||
},
|
||||
{
|
||||
description = "Babel configuration",
|
||||
fileMatch = {
|
||||
".babelrc.json",
|
||||
".babelrc",
|
||||
"babel.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/babelrc.json",
|
||||
},
|
||||
{
|
||||
description = "ESLint config",
|
||||
fileMatch = {
|
||||
".eslintrc.json",
|
||||
".eslintrc",
|
||||
},
|
||||
url = "https://json.schemastore.org/eslintrc.json",
|
||||
},
|
||||
{
|
||||
description = "Bucklescript config",
|
||||
fileMatch = { "bsconfig.json" },
|
||||
url = "https://raw.githubusercontent.com/rescript-lang/rescript-compiler/8.2.0/docs/docson/build-schema.json",
|
||||
},
|
||||
{
|
||||
description = "Prettier config",
|
||||
fileMatch = {
|
||||
".prettierrc",
|
||||
".prettierrc.json",
|
||||
"prettier.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/prettierrc",
|
||||
},
|
||||
{
|
||||
description = "Vercel Now config",
|
||||
fileMatch = { "now.json" },
|
||||
url = "https://json.schemastore.org/now",
|
||||
},
|
||||
{
|
||||
description = "Stylelint config",
|
||||
fileMatch = {
|
||||
".stylelintrc",
|
||||
".stylelintrc.json",
|
||||
"stylelint.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/stylelintrc",
|
||||
},
|
||||
{
|
||||
description = "A JSON schema for the ASP.NET LaunchSettings.json files",
|
||||
fileMatch = { "launchsettings.json" },
|
||||
url = "https://json.schemastore.org/launchsettings.json",
|
||||
},
|
||||
{
|
||||
description = "Schema for CMake Presets",
|
||||
fileMatch = {
|
||||
"CMakePresets.json",
|
||||
"CMakeUserPresets.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/Kitware/CMake/master/Help/manual/presets/schema.json",
|
||||
},
|
||||
{
|
||||
description = "Configuration file as an alternative for configuring your repository in the settings page.",
|
||||
fileMatch = {
|
||||
".codeclimate.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/codeclimate.json",
|
||||
},
|
||||
{
|
||||
description = "LLVM compilation database",
|
||||
fileMatch = {
|
||||
"compile_commands.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/compile-commands.json",
|
||||
},
|
||||
{
|
||||
description = "Config file for Command Task Runner",
|
||||
fileMatch = {
|
||||
"commands.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/commands.json",
|
||||
},
|
||||
{
|
||||
description = "AWS CloudFormation provides a common language for you to describe and provision all the infrastructure resources in your cloud environment.",
|
||||
fileMatch = {
|
||||
"*.cf.json",
|
||||
"cloudformation.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/cloudformation.schema.json",
|
||||
},
|
||||
{
|
||||
description = "The AWS Serverless Application Model (AWS SAM, previously known as Project Flourish) extends AWS CloudFormation to provide a simplified way of defining the Amazon API Gateway APIs, AWS Lambda functions, and Amazon DynamoDB tables needed by your serverless application.",
|
||||
fileMatch = {
|
||||
"serverless.template",
|
||||
"*.sam.json",
|
||||
"sam.json",
|
||||
},
|
||||
url = "https://raw.githubusercontent.com/awslabs/goformation/v5.2.9/schema/sam.schema.json",
|
||||
},
|
||||
{
|
||||
description = "Json schema for properties json file for a GitHub Workflow template",
|
||||
fileMatch = {
|
||||
".github/workflow-templates/**.properties.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/github-workflow-template-properties.json",
|
||||
},
|
||||
{
|
||||
description = "golangci-lint configuration file",
|
||||
fileMatch = {
|
||||
".golangci.toml",
|
||||
".golangci.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/golangci-lint.json",
|
||||
},
|
||||
{
|
||||
description = "JSON schema for the JSON Feed format",
|
||||
fileMatch = {
|
||||
"feed.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/feed.json",
|
||||
versions = {
|
||||
["1"] = "https://json.schemastore.org/feed-1.json",
|
||||
["1.1"] = "https://json.schemastore.org/feed.json",
|
||||
},
|
||||
},
|
||||
{
|
||||
description = "Packer template JSON configuration",
|
||||
fileMatch = {
|
||||
"packer.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/packer.json",
|
||||
},
|
||||
{
|
||||
description = "NPM configuration file",
|
||||
fileMatch = {
|
||||
"package.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/package.json",
|
||||
},
|
||||
{
|
||||
description = "JSON schema for Visual Studio component configuration files",
|
||||
fileMatch = {
|
||||
"*.vsconfig",
|
||||
},
|
||||
url = "https://json.schemastore.org/vsconfig.json",
|
||||
},
|
||||
{
|
||||
description = "Resume json",
|
||||
fileMatch = { "resume.json" },
|
||||
url = "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
|
||||
},
|
||||
}
|
||||
|
||||
local opts = {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = schemas,
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
commands = {
|
||||
Format = {
|
||||
function()
|
||||
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line "$", 0 })
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return opts
|
||||
@ -1,16 +0,0 @@
|
||||
return {
|
||||
settings = {
|
||||
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
return {
|
||||
settings = {
|
||||
|
||||
python = {
|
||||
analysis = {
|
||||
typeCheckingMode = "off",
|
||||
diagnosticMode = "workspace",
|
||||
autoSearchPaths = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -6,13 +6,20 @@ end
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
|
||||
null_ls.builtins.diagnostics.mypy.with({
|
||||
extra_args = function()
|
||||
local virtual = os.getenv("VIRTUAL_ENV") or "/usr"
|
||||
return { "--python-executable", virtual .. "/bin/python3" }
|
||||
end,
|
||||
})
|
||||
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
|
||||
formatting.black.with({ extra_args = { "--fast" } }),
|
||||
-- formatting.prettier.with({ extra_args = { "--no-semi", "--single-quote", "--jsx-single-quote" } }),
|
||||
-- formatting.black.with({ extra_args = { "--fast" } }),
|
||||
formatting.isort,
|
||||
formatting.stylua,
|
||||
-- diagnostics.flake8
|
||||
-- diagnostics.mypy,
|
||||
},
|
||||
})
|
||||
|
||||
@ -5,7 +5,8 @@ end
|
||||
|
||||
nvim_navic.setup({
|
||||
lsp = {
|
||||
auto_attach = true
|
||||
auto_attach = true,
|
||||
preference = {"pyright", "pylsp"}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user