Initial commit

This commit is contained in:
2023-08-31 21:58:22 +02:00
parent 61336de4d2
commit 429a03c710
72 changed files with 5130 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
--[[
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.
]]
-- requires shellcheck also (for linting)
return {
cmd = { 'bash-language-server', 'start' },
cmd_env = { GLOB_PATTERN = '*@(.sh|.inc|.bash|.command)' },
single_file_support = true
}
+25
View File
@@ -0,0 +1,25 @@
--[[
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 = {
'clangd',
'--clang-tidy',
'--enable-config',
'--log=verbose'
},
single_file_support = true,
}
+23
View File
@@ -0,0 +1,23 @@
--[[
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 = { 'cmake-language-server' },
single_file_support = true,
init_options = {
buildDirectory = "build"
}
}
+176
View File
@@ -0,0 +1,176 @@
--[[
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 = { 'diagnostic-languageserver', '--stdio' },
single_file_support = true,
-- For more info see https://github.com/iamcco/diagnostic-languageserver
init_options = {
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',
args = {
'--config',
'tox.ini',
'--format',
'%(row)d,%(col)d,%(code).1s,%(code)s: %(text)s',
'-'
},
rootPatterns = { 'Pipfile', '.git', 'tox.ini' },
isStdout = true,
isStderr = false,
debounce = 100,
offsetLine = 0,
offsetColumn = 0,
sourceName = 'flake8',
formatLines = 1,
formatPattern = {
[[(\d+),(\d+),([A-Z]),(.*)(\r|\n)*$]],
{ 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'
}
}
},
formatFiletypes = {
python = { 'black', 'isort' },
lua = { 'luaFormatter' },
sh = { 'shfmt' }
},
formatters = {
black = {
sourceName = 'black',
command = 'black',
args = {
'--stdin-filename',
'%filename',
'-t',
'py39',
'--quiet',
'-'
},
rootPatterns = { 'Pipfile', '.git', 'tox.ini' },
isStdout = true,
isStderr = false,
ignoreExitCode = false
},
isort = {
sourceName = 'isort',
command = 'isort',
args = { '--quiet', '-' },
rootPatterns = { 'Pipfile', '.git', 'tox.ini' },
isStdout = true,
isStderr = false,
ignoreExitCode = false
},
luaFormatter = {
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
-- '--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-keep-simple-control-block-one-line', -- Do not keep block 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
-- '--no-align-args', -- Do not align the arguments
'--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
-- '--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
-- '--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-align-parameter', -- Do not align the 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
-- '--no-break-after-functiondef-lp', -- Do not break after '(' 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
-- '--no-align-table-field', -- Do not align fields 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
-- '--no-break-before-table-rb', -- Do not break before '}' of 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
-- '--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
-- '--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-spaces-inside-table-braces', -- Do not put spaces on the inside of braces in table constructors
'--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
-- '--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-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),
-- 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' },
isStdout = true,
isStderr = false,
ignoreExitCode = false
}
}
}
}
+22
View File
@@ -0,0 +1,22 @@
--[[
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
@@ -0,0 +1,84 @@
--[[
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
}
}
}
}
+23
View File
@@ -0,0 +1,23 @@
--[[
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 = {
'java', '-jar',
'/usr/share/java/groovy-language-server/groovy-language-server-all.jar'
},
single_file_support = true
}
+171
View File
@@ -0,0 +1,171 @@
--[[
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 = { '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)
init_options = {
completion = {
-- If your language client supports CompletionItem snippets but you don't like them,
-- disable them by setting this option to true.
-- type: boolean
-- default: false
disableSnippets = false,
-- Return all completion results in initial completion request.
-- Set to true if your language client does not support completionItem/resolve.
-- type: boolean
-- default: false
resolveEagerly = false,
-- A list of regular expressions.
-- If any regular expression in ignorePatterns matches a completion's name,
-- that completion item is not returned to the client.
-- type: string[]
-- default: []
-- In general, you should prefer the default value for this option.
-- Jedi is very good at filtering values for end users.
-- 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 = {}
},
-- Built-in diagnostics seem to be very basic,
-- to the point where you are wondering if it's even active.
-- Will use iamcco/diagnostic-languageserver instead.
diagnostics = {
-- Enables (or disables) diagnostics provided by Jedi
-- type: boolean
-- default: true
enable = false,
-- When diagnostics are enabled, run on document open
-- type: boolean
-- default: true
didOpen = true,
-- When diagnostics are enabled, run on in-memory document change
-- (eg, while you're editing, without needing to save to disk)
-- type: boolean
-- default: true
didChange = true,
-- When diagnostics are enabled, run on document save (to disk)
-- type: boolean
-- default: true
didSave = true
},
hover = {
-- Enable (or disable) all hover text.
-- If set to false, will cause the hover method not to be registered to the language server.
-- type: boolean
-- default: true
enable = true,
-- disable.[jedi-type].all
-- Disable all hover text of jedi-type specified.
-- type: boolean
-- default: false
-- disable.[jedi-type].names
-- Disable hover text identified by name in list of jedi-type specified.
-- type: string[]
-- default: []
-- disable.[jedi-type].fullNames
-- Disable hover text identified by the fully qualified name in list of jedi-type specified.
-- If no fully qualified name can be found, jedi-language-server will default to
-- the name to prevent any unexpected behavior for users
-- (relevant for jedi types like keywords that don't have full names).
-- type: string[]
-- default: []
disable = {
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 = {} }
}
},
jediSettings = {
-- Modules that jedi will directly import without analyzing.
-- Improves autocompletion but loses goto definition.
-- type: string[]
-- default: []
-- If you're noticing that modules like numpy and pandas are taking a super long time to load
-- and you value completions / signatures over goto definition,
-- I recommend using this option like this:
-- autoImportModules = { "numpy", "pandas" },
autoImportModules = {},
-- Completions are by default case insensitive.
-- Set to false to make completions case sensitive.
-- type: boolean
-- default: true
caseInsensitiveCompletion = true,
-- Print jedi debugging messages to stderr.
-- type: boolean
-- default: false
debug = false
},
-- The preferred MarkupKind for all jedi-language-server messages that take MarkupContent.
-- type: string
-- accepted values: "markdown", "plaintext"
-- If omitted, jedi-language-server defaults to the client-preferred configuration.
-- If there is no client-preferred configuration, jedi language server users "plaintext".
-- markupKindPreferred = "markdown",
workspace = {
-- Add additional paths for Jedi's analysis.
-- Useful with vendor directories, packages in a non-standard location, etc.
-- You probably won't need to use this, but you'll be happy it's here when you need it!
-- type: string[]
-- default: []
-- Non-absolute paths are relative to your project root.
-- For example, let's say your Python project is structured like this:
-- ├── funky
-- │ └── haha.py
-- ├── poetry.lock
-- ├── pyproject.toml
-- └── test.py
-- Assume that funky/haha.py contains 1 line, x = 12,
-- and your build system does some wizardry that makes haha importable just like os or pathlib.
-- In this example, if you want to have this same non-standard behavior with jedi-language-server,
-- put the following:
-- extraPaths = { "funky" }
-- When editing test.py, you'll get completions, goto definition,
-- and all other lsp features for the line `from haha import ....`
-- Again, you probably don't need this.
extraPaths = {},
symbols = {
-- Performance optimization that sets names of folders that are ignored for workspace/symbols.
-- type: string[]
-- default: { ".nox", ".tox", ".venv", "__pycache__", "venv" }
-- 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'
},
-- 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
}
}
}
}
+40
View File
@@ -0,0 +1,40 @@
--[[
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 = { 'lemminx' },
single_file_support = true,
init_options = {
settings = {
xml = {
trace = { server = 'verbose' },
catalogs = {},
logs = {
client = false,
file = '/home/oscar/lsp4xml.log'
},
format = {
splitAttributes = true,
joinCDATALines = false,
joinContentLines = true,
joinCommentLines = false,
spaceBeforeEmptyCloseLine = false,
enabled = true
}
}
}
}
}
+47
View File
@@ -0,0 +1,47 @@
--[[
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.
]]
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' },
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',
-- Setup your lua path
path = runtime_path
},
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { 'vim' }
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file('', true),
checkThirdParty = false
},
-- Do not send telemetry data containing a randomized but unique identifier
telemetry = { enable = false }
}
}
}
+61
View File
@@ -0,0 +1,61 @@
--[[
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
@@ -0,0 +1,39 @@
--[[
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
@@ -0,0 +1,38 @@
--[[
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
},
} ]]
}
}
}