feat: add nvimdots
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/bashls.lua
|
||||
return {
|
||||
cmd = { "bash-language-server", "start" },
|
||||
filetypes = { "bash", "sh" },
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
local function switch_source_header_splitcmd(bufnr, splitcmd)
|
||||
bufnr = require("lspconfig").util.validate_bufnr(bufnr)
|
||||
local clangd_client = require("lspconfig").util.get_active_client_by_name(bufnr, "clangd")
|
||||
local params = { uri = vim.uri_from_bufnr(bufnr) }
|
||||
if clangd_client then
|
||||
clangd_client.request("textDocument/switchSourceHeader", params, function(err, result)
|
||||
if err then
|
||||
error(tostring(err))
|
||||
end
|
||||
if not result then
|
||||
vim.notify("Corresponding file can’t be determined", vim.log.levels.ERROR, { title = "LSP Error!" })
|
||||
return
|
||||
end
|
||||
vim.api.nvim_command(splitcmd .. " " .. vim.uri_to_fname(result))
|
||||
end)
|
||||
else
|
||||
vim.notify(
|
||||
"Method textDocument/switchSourceHeader is not supported by any active server on this buffer",
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "LSP Error!" }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
local function get_binary_path_list(binaries)
|
||||
local path_list = {}
|
||||
for _, binary in ipairs(binaries) do
|
||||
local path = vim.fn.exepath(binary)
|
||||
if path ~= "" then
|
||||
table.insert(path_list, path)
|
||||
end
|
||||
end
|
||||
return table.concat(path_list, ",")
|
||||
end
|
||||
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/clangd.lua
|
||||
return function(options)
|
||||
require("lspconfig").clangd.setup({
|
||||
on_attach = options.on_attach,
|
||||
capabilities = vim.tbl_deep_extend("keep", { offsetEncoding = { "utf-16", "utf-8" } }, options.capabilities),
|
||||
single_file_support = true,
|
||||
cmd = {
|
||||
"clangd",
|
||||
"-j=12",
|
||||
"--enable-config",
|
||||
"--background-index",
|
||||
"--pch-storage=memory",
|
||||
-- You MUST set this arg ↓ to your c/cpp compiler location (if not included)!
|
||||
"--query-driver=" .. get_binary_path_list({ "clang++", "clang", "gcc", "g++" }),
|
||||
"--clang-tidy",
|
||||
"--all-scopes-completion",
|
||||
"--completion-style=detailed",
|
||||
"--header-insertion-decorators",
|
||||
"--header-insertion=iwyu",
|
||||
"--limit-references=3000",
|
||||
"--limit-results=350",
|
||||
},
|
||||
commands = {
|
||||
ClangdSwitchSourceHeader = {
|
||||
function()
|
||||
switch_source_header_splitcmd(0, "edit")
|
||||
end,
|
||||
description = "Open source/header in current buffer",
|
||||
},
|
||||
ClangdSwitchSourceHeaderVSplit = {
|
||||
function()
|
||||
switch_source_header_splitcmd(0, "vsplit")
|
||||
end,
|
||||
description = "Open source/header in a new vsplit",
|
||||
},
|
||||
ClangdSwitchSourceHeaderSplit = {
|
||||
function()
|
||||
switch_source_header_splitcmd(0, "split")
|
||||
end,
|
||||
description = "Open source/header in a new split",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,12 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/dartls.lua
|
||||
return {
|
||||
cmd = { "dart", "language-server", "--protocol=lsp" },
|
||||
filetypes = { "dart" },
|
||||
init_options = {
|
||||
closingLabels = true,
|
||||
flutterOutline = true,
|
||||
onlyAnalyzeProjectsWithOpenFiles = true,
|
||||
outline = true,
|
||||
suggestFromUnimportedLibraries = true,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/gopls.lua
|
||||
return {
|
||||
cmd = { "gopls", "-remote.debug=:0", "-remote=auto" },
|
||||
filetypes = { "go", "gomod", "gosum", "gotmpl", "gohtmltmpl", "gotexttmpl" },
|
||||
flags = { allow_incremental_sync = true, debounce_text_changes = 500 },
|
||||
capabilities = {
|
||||
textDocument = {
|
||||
completion = {
|
||||
contextSupport = true,
|
||||
dynamicRegistration = true,
|
||||
completionItem = {
|
||||
commitCharactersSupport = true,
|
||||
deprecatedSupport = true,
|
||||
preselectSupport = true,
|
||||
insertReplaceSupport = true,
|
||||
labelDetailsSupport = true,
|
||||
snippetSupport = true,
|
||||
documentationFormat = { "markdown", "plaintext" },
|
||||
resolveSupport = {
|
||||
properties = {
|
||||
"documentation",
|
||||
"details",
|
||||
"additionalTextEdits",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
settings = {
|
||||
gopls = {
|
||||
staticcheck = true,
|
||||
semanticTokens = true,
|
||||
noSemanticString = true,
|
||||
usePlaceholders = true,
|
||||
completeUnimported = true,
|
||||
symbolMatcher = "Fuzzy",
|
||||
buildFlags = { "-tags", "integration" },
|
||||
codelenses = {
|
||||
generate = true,
|
||||
gc_details = true,
|
||||
test = true,
|
||||
tidy = true,
|
||||
vendor = true,
|
||||
regenerate_cgo = true,
|
||||
upgrade_dependency = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
-- https://github.com/vscode-langservers/vscode-html-languageserver-bin
|
||||
return {
|
||||
cmd = { "html-languageserver", "--stdio" },
|
||||
filetypes = { "html" },
|
||||
init_options = {
|
||||
configurationSection = { "html", "css", "javascript" },
|
||||
embeddedLanguages = { css = true, javascript = true },
|
||||
},
|
||||
settings = {},
|
||||
single_file_support = true,
|
||||
flags = { debounce_text_changes = 500 },
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/jsonls.lua
|
||||
return {
|
||||
flags = { debounce_text_changes = 500 },
|
||||
settings = {
|
||||
json = {
|
||||
-- Schemas https://www.schemastore.org
|
||||
schemas = {
|
||||
{
|
||||
fileMatch = { "package.json" },
|
||||
url = "https://json.schemastore.org/package.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { "tsconfig*.json" },
|
||||
url = "https://json.schemastore.org/tsconfig.json",
|
||||
},
|
||||
{
|
||||
fileMatch = {
|
||||
".prettierrc",
|
||||
".prettierrc.json",
|
||||
"prettier.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/prettierrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { ".eslintrc", ".eslintrc.json" },
|
||||
url = "https://json.schemastore.org/eslintrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = {
|
||||
".babelrc",
|
||||
".babelrc.json",
|
||||
"babel.config.json",
|
||||
},
|
||||
url = "https://json.schemastore.org/babelrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { "lerna.json" },
|
||||
url = "https://json.schemastore.org/lerna.json",
|
||||
},
|
||||
{
|
||||
fileMatch = {
|
||||
".stylelintrc",
|
||||
".stylelintrc.json",
|
||||
"stylelint.config.json",
|
||||
},
|
||||
url = "http://json.schemastore.org/stylelintrc.json",
|
||||
},
|
||||
{
|
||||
fileMatch = { "/.github/workflows/*" },
|
||||
url = "https://json.schemastore.org/github-workflow.json",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/lua_ls.lua
|
||||
return {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = { version = "LuaJIT" },
|
||||
diagnostics = {
|
||||
globals = { "vim" },
|
||||
disable = { "different-requires", "undefined-field" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
vim.fn.expand("$VIMRUNTIME/lua"),
|
||||
vim.fn.expand("$VIMRUNTIME/lua/vim/lsp"),
|
||||
},
|
||||
maxPreload = 100000,
|
||||
preloadFileSize = 10000,
|
||||
},
|
||||
hint = { enable = true, setType = true },
|
||||
format = { enable = false },
|
||||
telemetry = { enable = false },
|
||||
-- Do not override treesitter lua highlighting with lua_ls's highlighting
|
||||
semantic = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/server_configurations/pylsp.lua
|
||||
return {
|
||||
cmd = { "pylsp" },
|
||||
filetypes = { "python" },
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
-- Lint
|
||||
ruff = {
|
||||
enabled = true,
|
||||
select = {
|
||||
-- enable pycodestyle
|
||||
"E",
|
||||
-- enable pyflakes
|
||||
"F",
|
||||
},
|
||||
ignore = {
|
||||
-- ignore E501 (line too long)
|
||||
-- "E501",
|
||||
-- ignore F401 (imported but unused)
|
||||
-- "F401",
|
||||
},
|
||||
extendSelect = { "I" },
|
||||
severities = {
|
||||
-- Hint, Information, Warning, Error
|
||||
F401 = "I",
|
||||
E501 = "I",
|
||||
},
|
||||
},
|
||||
flake8 = { enabled = false },
|
||||
pyflakes = { enabled = false },
|
||||
pycodestyle = { enabled = false },
|
||||
mccabe = { enabled = false },
|
||||
|
||||
-- Code refactor
|
||||
rope = { enabled = true },
|
||||
|
||||
-- Formatting
|
||||
black = { enabled = true },
|
||||
pyls_isort = { enabled = false },
|
||||
autopep8 = { enabled = false },
|
||||
yapf = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user