Refactor LSP and add notify

This commit is contained in:
2023-09-03 00:33:33 +02:00
parent a4f0d30976
commit e6bd54bb0c
11 changed files with 102 additions and 287 deletions
-22
View File
@@ -1,22 +0,0 @@
--[[
Copyright 2023 Oscar Wallberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
return {
cmd = { "golangci-lint-langserver", },
init_options = {
command = { "golangci-lint", "run", "--out-format", "json", },
},
}
-84
View File
@@ -1,84 +0,0 @@
--[[
Copyright 2023 Oscar Wallberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
return {
cmd = { "gopls", "serve", },
-- https://github.com/golang/tools/blob/master/gopls/doc/settings.md
settings = {
gopls = {
gofumpt = true,
codelenses = {
gc_details = true,
generate = true,
regenerate_cgo = true,
run_vulncheck_exp = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
usePlaceholders = true,
analyses = {
asmdecl = true,
assign = true,
atomic = true,
atomicalign = true,
bools = true,
buildtag = true,
cgocall = true,
composites = true,
copylocks = true,
deepequalerrors = true,
embed = true,
errorsas = true,
fieldalignment = true,
httpresponse = true,
ifaceassert = true,
infertypeargs = true,
loopclosure = true,
lostcancel = true,
nilfunc = true,
nilness = true,
printf = true,
shadow = true,
shift = true,
simplifycompositelit = true,
simplifyrange = true,
simplifyslice = true,
sortslice = true,
stdmethods = true,
stringintconv = true,
structtag = true,
testinggoroutine = true,
tests = true,
timeformat = true,
unmarshal = true,
unreachable = true,
unsafeptr = true,
unusedparams = true,
unusedresult = true,
unusedwrite = true,
useany = true,
fillreturns = true,
nonewvars = true,
noresultvalues = true,
undeclaredname = true,
unusedvariable = true,
fillstruct = true,
stubmethods = true,
},
},
},
}
-61
View File
@@ -1,61 +0,0 @@
--[[
Copyright 2023 Oscar Wallberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
return {
cmd = { "pylsp", },
single_file_support = true,
-- Reference: https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
settings = {
pylsp = {
-- configurationSources = { "flake8", "jedi_completion", "jedi_definition", "jedi_hover", "jedi_references", "jedi_signature_help", "jedi_symbols" },
plugins = {
flake8 = {
config = "tox.ini",
enabled = true,
-- executable = "flake8"
},
pyls_isort = { enabled = true, },
jedi_completion = {
enabled = true,
include_params = false,
include_class_objects = true,
fuzzy = true,
eager = true,
resolve_at_most = 25,
cache_for = {
"pandas",
"numpy",
"tensorflow",
"matplotlib",
},
},
jedi_definition = {
enabled = true,
follow_imports = true,
follow_builtin_imports = 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,
},
},
},
},
}
-39
View File
@@ -1,39 +0,0 @@
--[[
Copyright 2023 Oscar Wallberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
return {
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
settings = {
python = {
disableCompletion = false,
disableDiagnostics = false,
analysis = {
autoImportCompletions = true,
autoSearchPaths = true,
diagnosticMode = "workspace",
stubPath = "typings",
typeschedPaths = {},
diagnosticSeverityOverrides = {},
typeCheckingMode = "off",
useLibraryCodeForTypes = true,
},
completion = { importSupport = true, snippetSupport = true, },
},
},
}
-38
View File
@@ -1,38 +0,0 @@
--[[
Copyright 2023 Oscar Wallberg
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
return {
cmd = { "rust-analyzer", },
settings = {
-- https://github.com/rust-lang/rust-analyzer/blob/master/docs/user/generated_config.adoc
["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/",
},
},
--[[ inlayHints = {
closingBraceHints = {
-- Whether to show inlay hints after a closing `}` to indicate what item it belongs to.
enable = false
},
} ]]
},
},
}