Format workspace with CodeFormat

This commit is contained in:
2023-09-02 17:29:59 +02:00
parent 214ffd053d
commit ae3bc212a9
63 changed files with 1205 additions and 1061 deletions
+3 -3
View File
@@ -17,7 +17,7 @@
-- requires shellcheck also (for linting)
return {
cmd = { 'bash-language-server', 'start' },
cmd_env = { GLOB_PATTERN = '*@(.sh|.inc|.bash|.command)' },
single_file_support = true
cmd = { "bash-language-server", "start", },
cmd_env = { GLOB_PATTERN = "*@(.sh|.inc|.bash|.command)", },
single_file_support = true,
}
+5 -5
View File
@@ -16,10 +16,10 @@
return {
cmd = {
'clangd',
'--clang-tidy',
'--enable-config',
'--log=verbose'
"clangd",
"--clang-tidy",
"--enable-config",
"--log=verbose",
},
single_file_support = true,
}
}
+3 -3
View File
@@ -15,9 +15,9 @@
]]
return {
cmd = { 'cmake-language-server' },
cmd = { "cmake-language-server", },
single_file_support = true,
init_options = {
buildDirectory = "build"
}
buildDirectory = "build",
},
}
+88 -88
View File
@@ -15,162 +15,162 @@
]]
return {
cmd = { 'diagnostic-languageserver', '--stdio' },
cmd = { "diagnostic-languageserver", "--stdio", },
single_file_support = true,
-- For more info see https://github.com/iamcco/diagnostic-languageserver
init_options = {
filetypes = { python = 'flake8', lua = 'luaFormatter' },
filetypes = { python = "flake8", lua = "luaFormatter", },
linters = {
-- some help from this:
-- https://github.com/creativenull/diagnosticls-configs-nvim/blob/main/lua/diagnosticls-configs/linters/flake8.lua
flake8 = {
command = 'flake8',
command = "flake8",
args = {
'--config',
'tox.ini',
'--format',
'%(row)d,%(col)d,%(code).1s,%(code)s: %(text)s',
'-'
"--config",
"tox.ini",
"--format",
"%(row)d,%(col)d,%(code).1s,%(code)s: %(text)s",
"-",
},
rootPatterns = { 'Pipfile', '.git', 'tox.ini' },
rootPatterns = { "Pipfile", ".git", "tox.ini", },
isStdout = true,
isStderr = false,
debounce = 100,
offsetLine = 0,
offsetColumn = 0,
sourceName = 'flake8',
sourceName = "flake8",
formatLines = 1,
formatPattern = {
[[(\d+),(\d+),([A-Z]),(.*)(\r|\n)*$]],
{ line = 1, column = 2, security = 3, message = { 4 } }
{ line = 1, column = 2, security = 3, message = { 4, }, },
},
securities = {
-- Available securities are { 'error', 'warning', 'hint', 'info' }
E = 'error',
W = 'warning',
B = 'hint',
F = 'error',
D = 'info'
}
}
E = "error",
W = "warning",
B = "hint",
F = "error",
D = "info",
},
},
},
formatFiletypes = {
python = { 'black', 'isort' },
lua = { 'luaFormatter' },
sh = { 'shfmt' }
python = { "black", "isort", },
lua = { "luaFormatter", },
sh = { "shfmt", },
},
formatters = {
black = {
sourceName = 'black',
command = 'black',
sourceName = "black",
command = "black",
args = {
'--stdin-filename',
'%filename',
'-t',
'py39',
'--quiet',
'-'
"--stdin-filename",
"%filename",
"-t",
"py39",
"--quiet",
"-",
},
rootPatterns = { 'Pipfile', '.git', 'tox.ini' },
rootPatterns = { "Pipfile", ".git", "tox.ini", },
isStdout = true,
isStderr = false,
ignoreExitCode = false
ignoreExitCode = false,
},
isort = {
sourceName = 'isort',
command = 'isort',
args = { '--quiet', '-' },
rootPatterns = { 'Pipfile', '.git', 'tox.ini' },
sourceName = "isort",
command = "isort",
args = { "--quiet", "-", },
rootPatterns = { "Pipfile", ".git", "tox.ini", },
isStdout = true,
isStderr = false,
ignoreExitCode = false
ignoreExitCode = false,
},
luaFormatter = {
sourceName = 'luaFormatter',
command = 'lua-format',
sourceName = "luaFormatter",
command = "lua-format",
isStdout = true,
isStderr = false,
ignoreExitCode = false,
args = {
'--column-limit',
'80', -- Column limit of one line
'--indent-width',
'4', -- Number of spaces used for indentation
"--column-limit",
"80", -- Column limit of one line
"--indent-width",
"4", -- Number of spaces used for indentation
-- '--use-tab', -- Use tab for indentation
'--no-use-tab', -- Do not use tab for indentation
'--tab-width',
'4', -- Number of spaces used per tab
'--continuation-indent-width',
'4', -- Indent width for continuations line
'--spaces-before-call',
'1', -- Space on function calls
'--keep-simple-control-block-one-line', -- Keep block in one line
"--no-use-tab", -- Do not use tab for indentation
"--tab-width",
"4", -- Number of spaces used per tab
"--continuation-indent-width",
"4", -- Indent width for continuations line
"--spaces-before-call",
"1", -- Space on function calls
"--keep-simple-control-block-one-line", -- Keep block in one line
-- '--no-keep-simple-control-block-one-line', -- Do not keep block in one line
'--keep-simple-function-one-line', -- Keep function in one line
"--keep-simple-function-one-line", -- Keep function in one line
-- '--no-keep-simple-function-one-line', -- Do not keep function in one line
'--align-args', -- Align the arguments
"--align-args", -- Align the arguments
-- '--no-align-args', -- Do not align the arguments
'--break-after-functioncall-lp', -- Break after '(' of function call
"--break-after-functioncall-lp", -- Break after '(' of function call
-- '--no-break-after-functioncall-lp', -- Do not break after '(' of function call
'--break-before-functioncall-rp', -- Break before ')' of function call
"--break-before-functioncall-rp", -- Break before ')' of function call
-- '--no-break-before-functioncall-rp', -- Do not break before ')' of function call
-- '--spaces-inside-functioncall-parens', -- Put spaces on the inside of parens in function calls
'--no-spaces-inside-functioncall-parens', -- Do not put spaces on the inside of parens in function calls
"--no-spaces-inside-functioncall-parens", -- Do not put spaces on the inside of parens in function calls
-- '--spaces-inside-functiondef-parens', -- Put spaces on the inside of parens in function headers
'--no-spaces-inside-functiondef-parens', -- Do not put spaces on the inside of parens in function headers
'--align-parameter', -- Align the parameters
"--no-spaces-inside-functiondef-parens", -- Do not put spaces on the inside of parens in function headers
"--align-parameter", -- Align the parameters
-- '--no-align-parameter', -- Do not align the parameters
'--chop-down-parameter', -- Chop down all parameters
"--chop-down-parameter", -- Chop down all parameters
-- '--no-chop-down-parameter', -- Do not chop down all parameters
'--break-after-functiondef-lp', -- Break after '(' of function def
"--break-after-functiondef-lp", -- Break after '(' of function def
-- '--no-break-after-functiondef-lp', -- Do not break after '(' of function def
'--break-before-functiondef-rp', -- Break before ')' of function def
"--break-before-functiondef-rp", -- Break before ')' of function def
-- '--no-break-before-functiondef-rp', -- Do not break before ')' of function def
'--align-table-field', -- Align fields of table
"--align-table-field", -- Align fields of table
-- '--no-align-table-field', -- Do not align fields of table
'--break-after-table-lb', -- Break after '{' of table
"--break-after-table-lb", -- Break after '{' of table
-- '--no-break-after-table-lb', -- Do not break after '{' of table
'--break-before-table-rb', -- Break before '}' of table
"--break-before-table-rb", -- Break before '}' of table
-- '--no-break-before-table-rb', -- Do not break before '}' of table
'--chop-down-table', -- Chop down any table
"--chop-down-table", -- Chop down any table
-- '--no-chop-down-table', -- Do not chop down any table
'--chop-down-kv-table', -- Chop down table if table contains key
"--chop-down-kv-table", -- Chop down table if table contains key
-- '--no-chop-down-kv-table', -- Do not chop down table if table contains key
'--table-sep',
',', -- Character to separate table fields
'--column-table-limit',
'80', -- Column limit of each line of a table
"--table-sep",
",", -- Character to separate table fields
"--column-table-limit",
"80", -- Column limit of each line of a table
-- '--extra-sep-at-table-end', -- Add a extra field separator
'--no-extra-sep-at-table-end', -- Do not add a extra field separator
'--spaces-inside-table-braces', -- Put spaces on the inside of braces in table constructors
"--no-extra-sep-at-table-end", -- Do not add a extra field separator
"--spaces-inside-table-braces", -- Put spaces on the inside of braces in table constructors
-- '--no-spaces-inside-table-braces', -- Do not put spaces on the inside of braces in table constructors
'--break-after-operator', -- Put break after operators
"--break-after-operator", -- Put break after operators
-- '--no-break-after-operator', -- Do not put break after operators
'--double-quote-to-single-quote', -- Transform string literals to use single quote
"--double-quote-to-single-quote", -- Transform string literals to use single quote
-- '--no-double-quote-to-single-quote', -- Do not transform string literals to use single quote
-- '--single-quote-to-double-quote', -- Transform string literals to use double
'--no-single-quote-to-double-quote', -- Do not transform string literals to use double
'--spaces-around-equals-in-field', -- Put spaces around the equal sign in key/value fields
"--no-single-quote-to-double-quote", -- Do not transform string literals to use double
"--spaces-around-equals-in-field", -- Put spaces around the equal sign in key/value fields
-- '--no-spaces-around-equals-in-field', -- Do not put spaces around the equal sign in key/value fields
'--line-breaks-after-function-body',
'1', -- Line brakes after function body
'--line-separator',
'input' -- input(determined by the input content),
"--line-breaks-after-function-body",
"1", -- Line brakes after function body
"--line-separator",
"input", -- input(determined by the input content),
-- os(Use line ending of the current Operating system),
-- lf(Unix style "\n"),
-- crlf(Windows style "\r\n"),
-- cr(classic Max style "\r")
}
},
},
shfmt = {
sourceName = 'shfmt',
command = 'shfmt',
args = { '-s', '-i', '4', '-ci' },
rootPatterns = { 'Pipfile', '.git', 'tox.ini' },
sourceName = "shfmt",
command = "shfmt",
args = { "-s", "-i", "4", "-ci", },
rootPatterns = { "Pipfile", ".git", "tox.ini", },
isStdout = true,
isStderr = false,
ignoreExitCode = false
}
}
}
ignoreExitCode = false,
},
},
},
}
+4 -4
View File
@@ -15,8 +15,8 @@
]]
return {
cmd = { "golangci-lint-langserver" },
cmd = { "golangci-lint-langserver", },
init_options = {
command = { "golangci-lint", "run", "--out-format", "json" }
}
}
command = { "golangci-lint", "run", "--out-format", "json", },
},
}
+7 -7
View File
@@ -15,7 +15,7 @@
]]
return {
cmd = { "gopls", "serve" },
cmd = { "gopls", "serve", },
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
settings = {
gopls = {
@@ -27,7 +27,7 @@ return {
run_vulncheck_exp = true,
tidy = true,
upgrade_dependency = true,
vendor = true
vendor = true,
},
usePlaceholders = true,
analyses = {
@@ -77,8 +77,8 @@ return {
undeclaredname = true,
unusedvariable = true,
fillstruct = true,
stubmethods = true
}
}
}
}
stubmethods = true,
},
},
},
}
+4 -4
View File
@@ -16,8 +16,8 @@
return {
cmd = {
'java', '-jar',
'/usr/share/java/groovy-language-server/groovy-language-server-all.jar'
"java", "-jar",
"/usr/share/java/groovy-language-server/groovy-language-server-all.jar",
},
single_file_support = true
}
single_file_support = true,
}
+23 -23
View File
@@ -15,7 +15,7 @@
]]
return {
cmd = { 'jedi-language-server' },
cmd = { "jedi-language-server", },
single_file_support = true,
-- For more info see https://github.com/pappasam/jedi-language-server#configurationSources
-- and https://github.com/pappasam/coc-jedi#configuration (good descriptions)
@@ -41,7 +41,7 @@ return {
-- That said, there are situations where IDE developers,
-- or some programmers in some code bases, may want to filter some completions by name.
-- This flexible interface is provided to accommodate these advanced use cases.
ignorePatterns = {}
ignorePatterns = {},
},
-- Built-in diagnostics seem to be very basic,
-- to the point where you are wondering if it's even active.
@@ -63,7 +63,7 @@ return {
-- When diagnostics are enabled, run on document save (to disk)
-- type: boolean
-- default: true
didSave = true
didSave = true,
},
hover = {
-- Enable (or disable) all hover text.
@@ -87,17 +87,17 @@ return {
-- type: string[]
-- default: []
disable = {
class = { all = false, names = {}, fullNames = {} },
class = { all = false, names = {}, fullNames = {}, },
-- Need to escape lua keyword
['function'] = { all = false, names = {}, fullNames = {} },
instance = { all = false, names = {}, fullNames = {} },
keyword = { all = false, names = {}, fullNames = {} },
module = { all = false, names = {}, fullNames = {} },
param = { all = false, names = {}, fullNames = {} },
path = { all = false, names = {}, fullNames = {} },
property = { all = false, names = {}, fullNames = {} },
statement = { all = false, names = {}, fullNames = {} }
}
["function"] = { all = false, names = {}, fullNames = {}, },
instance = { all = false, names = {}, fullNames = {}, },
keyword = { all = false, names = {}, fullNames = {}, },
module = { all = false, names = {}, fullNames = {}, },
param = { all = false, names = {}, fullNames = {}, },
path = { all = false, names = {}, fullNames = {}, },
property = { all = false, names = {}, fullNames = {}, },
statement = { all = false, names = {}, fullNames = {}, },
},
},
jediSettings = {
-- Modules that jedi will directly import without analyzing.
@@ -117,7 +117,7 @@ return {
-- Print jedi debugging messages to stderr.
-- type: boolean
-- default: false
debug = false
debug = false,
},
-- The preferred MarkupKind for all jedi-language-server messages that take MarkupContent.
-- type: string
@@ -154,18 +154,18 @@ return {
-- If you manually set this option, it overrides the default.
-- Setting it to an empty array will result in no ignored folders.
ignoreFolders = {
'.nox', '.tox', '.venv', '__pycache__', 'venv',
'artifacts', 'config', '.vscode', '.pytest_cache',
'build', 'scripts', 'incoax_tests.egg-info',
'node_modules'
".nox", ".tox", ".venv", "__pycache__", "venv",
"artifacts", "config", ".vscode", ".pytest_cache",
"build", "scripts", "incoax_tests.egg-info",
"node_modules",
},
-- Maximum number of symbols returned by a call to workspace/symbols.
-- type: number
-- default: 20
-- A value less than or equal to zero removes the maximum
-- and allows jedi-language-server to return all workplace symbols found by jedi.
maxSymbols = 20
}
}
}
}
maxSymbols = 20,
},
},
},
}
+9 -9
View File
@@ -15,16 +15,16 @@
]]
return {
cmd = { 'lemminx' },
cmd = { "lemminx", },
single_file_support = true,
init_options = {
settings = {
xml = {
trace = { server = 'verbose' },
trace = { server = "verbose", },
catalogs = {},
logs = {
client = false,
file = '/home/oscar/lsp4xml.log'
file = "/home/oscar/lsp4xml.log",
},
format = {
splitAttributes = true,
@@ -32,9 +32,9 @@ return {
joinContentLines = true,
joinCommentLines = false,
spaceBeforeEmptyCloseLine = false,
enabled = true
}
}
}
}
}
enabled = true,
},
},
},
},
}
+13 -13
View File
@@ -14,34 +14,34 @@
limitations under the License.
]]
local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua')
local runtime_path = vim.split(package.path, ";")
table.insert(runtime_path, "lua/?.lua")
table.insert(runtime_path, "lua/?/init.lua")
-- spec: https://luals.github.io/wiki/settings/
return {
cmd = { 'lua-language-server' },
cmd = { "lua-language-server", },
single_file_support = true,
settings = {
Lua = {
runtime = {
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = 'LuaJIT',
version = "LuaJIT",
-- Setup your lua path
path = runtime_path
path = runtime_path,
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' }
globals = { "vim", },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false
library = vim.api.nvim_get_runtime_file("", true),
checkThirdParty = false,
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false }
}
}
}
telemetry = { enable = false, },
},
},
}
+18 -18
View File
@@ -15,7 +15,7 @@
]]
return {
cmd = { 'pylsp' },
cmd = { "pylsp", },
single_file_support = true,
-- Reference: https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
settings = {
@@ -23,11 +23,11 @@ return {
-- configurationSources = { "flake8", "jedi_completion", "jedi_definition", "jedi_hover", "jedi_references", "jedi_signature_help", "jedi_symbols" },
plugins = {
flake8 = {
config = 'tox.ini',
enabled = true
config = "tox.ini",
enabled = true,
-- executable = "flake8"
},
pyls_isort = { enabled = true },
pyls_isort = { enabled = true, },
jedi_completion = {
enabled = true,
include_params = false,
@@ -36,26 +36,26 @@ return {
eager = true,
resolve_at_most = 25,
cache_for = {
'pandas',
'numpy',
'tensorflow',
'matplotlib'
}
"pandas",
"numpy",
"tensorflow",
"matplotlib",
},
},
jedi_definition = {
enabled = true,
follow_imports = true,
follow_builtin_imports = true
follow_builtin_imports = true,
},
jedi_hover = { enabled = true },
jedi_references = { enabled = true },
jedi_signature_help = { enabled = true },
jedi_hover = { enabled = true, },
jedi_references = { enabled = true, },
jedi_signature_help = { enabled = true, },
jedi_symbols = {
enabled = true,
all_scopes = true,
include_import_symbols = true
}
}
}
}
include_import_symbols = true,
},
},
},
},
}
+8 -8
View File
@@ -15,7 +15,7 @@
]]
return {
cmd = { 'pyright-langserver', '--stdio' },
cmd = { "pyright-langserver", "--stdio", },
single_file_support = true,
-- see https://github.com/microsoft/pyright/blob/main/docs/configuration.md
-- and https://github.com/fannheyward/coc-pyright
@@ -26,14 +26,14 @@ return {
analysis = {
autoImportCompletions = true,
autoSearchPaths = true,
diagnosticMode = 'workspace',
stubPath = 'typings',
diagnosticMode = "workspace",
stubPath = "typings",
typeschedPaths = {},
diagnosticSeverityOverrides = {},
typeCheckingMode = 'off',
useLibraryCodeForTypes = true
typeCheckingMode = "off",
useLibraryCodeForTypes = true,
},
completion = { importSupport = true, snippetSupport = true }
}
}
completion = { importSupport = true, snippetSupport = true, },
},
},
}
+8 -8
View File
@@ -15,24 +15,24 @@
]]
return {
cmd = { 'rust-analyzer' },
cmd = { "rust-analyzer", },
settings = {
-- https://github.com/rust-lang/rust-analyzer/blob/master/docs/user/generated_config.adoc
['rust-analyzer'] = {
["rust-analyzer"] = {
cargo = {
-- Extra environment variables that will be set when running cargo, rustc
-- or other commands within the workspace. Useful for setting RUSTFLAGS.
extraEnv = {
OPENSSL_INCLUDE_DIR = '/usr/include/openssl-1.0/',
OPENSSL_LIB_DIR = '/usr/lib/openssl-1.0/'
}
}
OPENSSL_INCLUDE_DIR = "/usr/include/openssl-1.0/",
OPENSSL_LIB_DIR = "/usr/lib/openssl-1.0/",
},
},
--[[ inlayHints = {
closingBraceHints = {
-- Whether to show inlay hints after a closing `}` to indicate what item it belongs to.
enable = false
},
} ]]
}
}
},
},
}
+85 -85
View File
@@ -21,7 +21,7 @@ P._language_servers = nil
P.capabilities = {}
P.spec = require('lsp.spec')
P.spec = require("lsp.spec")
function P._setup_diagnostic()
vim.diagnostic.config({
@@ -35,44 +35,44 @@ function P._setup_diagnostic()
-- },
float = {
show_header = false,
source = 'if_many',
border = 'rounded',
source = "if_many",
border = "rounded",
focusable = false,
format = function(diagnostic)
return string.format('%s', diagnostic.message)
end
format = function (diagnostic)
return string.format("%s", diagnostic.message)
end,
},
update_in_insert = false, -- default to false
severity_sort = true -- default to false
severity_sort = true, -- default to false
})
-- Change diagnostic icons
vim.fn.sign_define('DiagnosticSignError', {
text = 'E',
texthl = 'DiagnosticSignError',
vim.fn.sign_define("DiagnosticSignError", {
text = "E",
texthl = "DiagnosticSignError",
-- culhl = 'DiagnosticSignError',
numhl = 'DiagnosticSignError'
numhl = "DiagnosticSignError",
-- linehl = 'LspDiagnosticsUnderlineError'
})
vim.fn.sign_define('DiagnosticSignWarn', {
text = 'W',
texthl = 'DiagnosticSignWarn',
vim.fn.sign_define("DiagnosticSignWarn", {
text = "W",
texthl = "DiagnosticSignWarn",
-- culhl = 'DiagnosticSignWarn',
numhl = 'DiagnosticSignWarn'
numhl = "DiagnosticSignWarn",
-- linehl = 'LspDiagnosticsUnderlineWarning'
})
vim.fn.sign_define('DiagnosticSignHint', {
text = 'H',
texthl = 'DiagnosticSignHint',
vim.fn.sign_define("DiagnosticSignHint", {
text = "H",
texthl = "DiagnosticSignHint",
-- culhl = 'DiagnosticSignHint',
numhl = 'DiagnosticSignHint'
numhl = "DiagnosticSignHint",
-- linehl = 'LspDiagnosticsUnderlineHint'
})
vim.fn.sign_define('DiagnosticSignInfo', {
text = 'i',
texthl = 'DiagnosticSignInfo',
vim.fn.sign_define("DiagnosticSignInfo", {
text = "i",
texthl = "DiagnosticSignInfo",
-- culhl = 'DiagnosticSignInfo',
numhl = 'DiagnosticSignInfo'
numhl = "DiagnosticSignInfo",
-- linehl = 'LspDiagnosticsUnderlineInfo'
})
@@ -85,9 +85,9 @@ function P.on_attach(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
-- Disabled in favor of nvim-cmp
-- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
require('lsp_signature').on_attach({
require("lsp_signature").on_attach({
debug = false, -- set to true to enable debug logging
log_path = vim.fn.stdpath('cache') .. '/lsp_signature.log', -- log dir when debug is on
log_path = vim.fn.stdpath("cache") .. "/lsp_signature.log", -- log dir when debug is on
-- default is ~/.cache/nvim/lsp_signature.log
verbose = false, -- show debug line number
@@ -115,11 +115,11 @@ function P.on_attach(client, bufnr)
close_timeout = nil, -- close floating window after ms when laster parameter is entered
fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
hint_enable = false, -- virtual hint enable
hint_prefix = '🐼 ', -- Panda for parameter, NOTE: for the terminal not support emoji, might crash
hint_scheme = 'String',
hi_parameter = 'IncSearch', -- default 'LspSignatureActiveParameter', -- how your parameter will be highlight
hint_prefix = "🐼 ", -- Panda for parameter, NOTE: for the terminal not support emoji, might crash
hint_scheme = "String",
hi_parameter = "IncSearch", -- default 'LspSignatureActiveParameter', -- how your parameter will be highlight
handler_opts = {
border = 'none' -- double, rounded, single, shadow, none
border = "none", -- double, rounded, single, shadow, none
},
always_trigger = true, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58
@@ -128,80 +128,80 @@ function P.on_attach(client, bufnr)
extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
zindex = 200, -- by default it will be on top of all floating windows, set to <= 50 send it to bottom
padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc
padding = "", -- character to pad on left and right of signature can be ' ', or '|' etc
transparency = nil, -- disabled by default, allow floating win transparent value 1~100
shadow_blend = 36, -- if you using shadow as border use this set the opacity
shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
shadow_guibg = "Black", -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency
toggle_key = '<C-e>', -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
toggle_key = "<C-e>", -- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
select_signature_key = nil, -- cycle to next signature, e.g. '<M-n>' function overloading
move_cursor_key = '<C-s>' -- imap, use nvim_set_current_win to move cursor between current win and floating
move_cursor_key = "<C-s>", -- imap, use nvim_set_current_win to move cursor between current win and floating
}, bufnr)
-- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions
local opts = { noremap = true, silent = true }
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'L',
'<cmd>lua vim.diagnostic.open_float()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d',
'<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d',
'<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>ll',
'<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD',
'<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd',
'<cmd>lua vim.lsp.buf.definition()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K',
'<cmd>lua vim.lsp.buf.hover()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi',
'<cmd>lua vim.lsp.buf.implementation()<CR>',
local opts = { noremap = true, silent = true, }
vim.api.nvim_buf_set_keymap(bufnr, "n", "L",
"<cmd>lua vim.diagnostic.open_float()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "[d",
"<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "]d",
"<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>ll",
"<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gD",
"<cmd>lua vim.lsp.buf.declaration()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd",
"<cmd>lua vim.lsp.buf.definition()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "K",
"<cmd>lua vim.lsp.buf.hover()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "gi",
"<cmd>lua vim.lsp.buf.implementation()<CR>",
opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>s',
'<cmd>lua vim.lsp.buf.signature_help()<CR>',
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>s",
"<cmd>lua vim.lsp.buf.signature_help()<CR>",
opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wa',
'<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>',
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>wa",
"<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>",
opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wr',
'<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>',
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>wr",
"<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>",
opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>wl',
'<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>',
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>wl",
"<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>",
opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gt',
'<cmd>lua vim.lsp.buf.type_definition()<CR>',
vim.api.nvim_buf_set_keymap(bufnr, "n", "gt",
"<cmd>lua vim.lsp.buf.type_definition()<CR>",
opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>rn',
'<cmd>lua vim.lsp.buf.rename()<CR>', opts)
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', 'gr',
'<cmd>lua vim.lsp.buf.references()<CR>', opts)
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<leader>lf',
'<cmd>lua vim.lsp.buf.format({async = true})<CR>',
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn",
"<cmd>lua vim.lsp.buf.rename()<CR>", opts)
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", "gr",
"<cmd>lua vim.lsp.buf.references()<CR>", opts)
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>lf",
"<cmd>lua vim.lsp.buf.format({async = true})<CR>",
opts)
-- if client.server_capabilities.document_range_formatting then
vim.api.nvim_buf_set_keymap(bufnr, 'v', '<leader>lf',
'<cmd>lua vim.lsp.buf.format({async = true})<CR>',
vim.api.nvim_buf_set_keymap(bufnr, "v", "<leader>lf",
"<cmd>lua vim.lsp.buf.format({async = true})<CR>",
opts)
-- end
-- The below command will highlight the current variable and its usages in the buffer.
if client.server_capabilities.document_highlight then
vim.fn.execute('hi! link LspReferenceRead Visual')
vim.fn.execute('hi! link LspReferenceText Visual')
vim.fn.execute('hi! link LspReferenceWrite Visual')
vim.api.nvim_create_augroup('lsp_document_highlight', { clear = true })
vim.api.nvim_create_autocmd('CursorHold', {
vim.fn.execute("hi! link LspReferenceRead Visual")
vim.fn.execute("hi! link LspReferenceText Visual")
vim.fn.execute("hi! link LspReferenceWrite Visual")
vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true, })
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = vim.lsp.buf.document_highlight
callback = vim.lsp.buf.document_highlight,
})
vim.api.nvim_create_autocmd('CursorMoved', {
vim.api.nvim_create_autocmd("CursorMoved", {
buffer = bufnr,
callback = vim.lsp.buf.clear_references
callback = vim.lsp.buf.clear_references,
})
end
-- Auto show current line diagnostics after 300 ms
@@ -223,11 +223,11 @@ function P.reload_server_buf(self, name)
end
for _, bufnr in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_loaded(bufnr) then
local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = bufnr })
local buf_ft = vim.api.nvim_get_option_value("filetype", { buf = bufnr, })
if ft_map[buf_ft] then
vim.api.nvim_buf_call(
bufnr,
function() vim.cmd('e') end
function () vim.cmd("e") end
)
end
end
@@ -263,9 +263,9 @@ function P.language_servers(self)
end
function P.setup_server(self, server)
local lspconfig = require('lspconfig')
local lspconfig = require("lspconfig")
local server_spec = self.spec[server]
local cfg = require('lsp.config.' .. server)
local cfg = require("lsp.config." .. server)
cfg.filetypes = server_spec.filetypes
cfg.root_dir = lspconfig.util.find_git_ancestor
cfg.capabilities = self.capabilities
@@ -275,12 +275,12 @@ end
function P.setup(self)
self._setup_diagnostic()
P.capabilities = require('cmp_nvim_lsp').default_capabilities()
P.capabilities = require("cmp_nvim_lsp").default_capabilities()
require("mason-lspconfig").setup_handlers({
function(name)
function (name)
self:setup_server(name)
self:reload_server_buf(name)
end
end,
})
end
+33 -33
View File
@@ -17,71 +17,71 @@
return {
clangd = {
filetypes = {
'c',
'cpp',
'objc',
'objcpp',
'cuda',
'proto',
}
"c",
"cpp",
"objc",
"objcpp",
"cuda",
"proto",
},
},
cmake = {
filetypes = {
'cmake'
}
"cmake",
},
},
diagnosticls = {
filetypes = {
'python',
'lua',
'sh',
}
"python",
"lua",
"sh",
},
},
lua_ls = {
filetypes = {
'lua'
}
"lua",
},
},
lemminx = {
filetypes = {
'xml',
'xsd',
'xsl',
'xslt',
'svg',
}
"xml",
"xsd",
"xsl",
"xslt",
"svg",
},
},
bashls = {
filetypes = {
'sh'
}
"sh",
},
},
groovyls = {
filetypes = {
'groovy'
}
"groovy",
},
},
rust_analyzer = {
filetypes = {
'rust'
}
"rust",
},
},
gopls = {
filetypes = {
"go",
"gomod"
}
"gomod",
},
},
golangci_lint_ls = {
filetypes = {
"go",
"gomod"
}
"gomod",
},
},
jedi_language_server = {
filetypes = {
'python'
}
"python",
},
},
-- pyright = { 'python' },
-- pylsp = { 'python' },