fix: namespace all local packages and modules

This commit is contained in:
2025-04-16 23:16:58 +02:00
parent 0c327701a1
commit 16ccb1d107
45 changed files with 43 additions and 32 deletions
+36
View File
@@ -0,0 +1,36 @@
local utils = require("ow.utils")
return {
enable = true,
dependencies = {
"npm",
},
mason = {
"bash-language-server",
dependencies = {
{ "shellcheck" },
{ "shfmt" },
},
},
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = { "shfmt", "-s", "-i", "4", "-" },
output = "stdout",
})
end,
},
},
lspconfig = {
filetypes = {
"sh",
"bash",
"zsh",
},
cmd = { "bash-language-server", "start" },
single_file_support = true,
},
}
+28
View File
@@ -0,0 +1,28 @@
---@type ServerConfig
return {
enable = true,
mason = { "clangd" },
keymaps = {
{
mode = "n",
lhs = "gs",
rhs = vim.cmd.ClangdSwitchSourceHeader,
},
},
lspconfig = {
filetypes = {
"c",
"cpp",
},
cmd = {
"clangd",
"--clang-tidy",
"--enable-config",
-- Fix for errors in files outside of project
-- https://clangd.llvm.org/faq#how-do-i-fix-errors-i-get-when-opening-headers-outside-of-my-project-directory
"--compile-commands-dir=build",
},
single_file_support = true,
},
}
+20
View File
@@ -0,0 +1,20 @@
return {
enable = true,
dependencies = {
"python3",
},
mason = {
name = "cmake-language-server",
-- version = "",
},
lspconfig = {
filetypes = {
"cmake",
},
cmd = { "cmake-language-server", },
single_file_support = true,
init_options = {
buildDirectory = "build",
},
},
}
+36
View File
@@ -0,0 +1,36 @@
local utils = require("ow.utils")
---@type ServerConfig
return {
enable = true,
mason = { "gopls", dependencies = { "golines" } },
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = { "golines", "-m", "80", "--shorten-comments" },
output = "stdout",
})
vim.lsp.buf.format({ async = true })
end,
},
},
lspconfig = {
filetypes = {
"go",
"gomod",
"gowork",
"gotmpl",
},
cmd = { "gopls" },
single_file_support = true,
settings = {
gopls = {
staticcheck = true,
semanticTokens = true,
},
},
},
}
+30
View File
@@ -0,0 +1,30 @@
--[[
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 {
enable = false,
dependencies = {
"java",
},
mason = {
"groovy-language-server",
},
lspconfig = {
cmd = {
"groovy-language-server",
},
},
}
+18
View File
@@ -0,0 +1,18 @@
return {
enable = true,
mason = {
name = "haskell-language-server",
-- version = "",
},
lspconfig = {
filetypes = { "haskell", "lhaskell", "cabal", },
cmd = { "haskell-language-server-wrapper", "--lsp", },
single_file_support = true,
settings = {
haskell = {
cabalFormattingProvider = "cabalfmt",
formattingProvider = "ormolu",
},
},
},
}
+85
View File
@@ -0,0 +1,85 @@
-- spec:
-- https://github.com/bmewburn/intelephense-docs/blob/master/installation.md
-- https://github.com/bmewburn/vscode-intelephense/blob/master/package.json
local utils = require("ow.utils")
return {
enable = true,
dependencies = {
"npm",
},
mason = { "intelephense", dependencies = { {"phpcs", "pretty-php" } } },
linters = {
{
cmd = {
"phpcs",
"--standard=PSR12",
"--report=emacs",
"-s",
"-q",
"-",
},
stdin = true,
stdout = true,
pattern = "^.+:(%d+):(%d+): (%w+) %- (.*) %((.*)%)$",
groups = { "lnum", "col", "severity", "message", "source" },
source = "phpcs",
severity_map = {
error = vim.diagnostic.severity.ERROR,
warning = vim.diagnostic.severity.WARN,
},
},
},
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"pretty-php",
"--psr12",
"--enable=align-comments",
"-qq",
"-",
},
output = "stdout",
})
end,
},
{
mode = "x",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"pretty-php",
"--psr12",
"--enable=align-comments",
"-qq",
"-",
},
output = "stdout",
})
end,
},
},
lspconfig = {
filetypes = {
"php",
},
cmd = { "intelephense", "--stdio" },
single_file_support = true,
settings = {
intelephense = {
environment = {
phpVersion = "7.4",
},
format = {
enable = false,
},
},
},
},
}
+162
View File
@@ -0,0 +1,162 @@
local utils = require("ow.utils")
local ERROR = vim.diagnostic.severity.ERROR
local WARN = vim.diagnostic.severity.WARN
local INFO = vim.diagnostic.severity.INFO
local HINT = vim.diagnostic.severity.HINT
local SEVERITY_MAP = {
YTT = WARN,
ANN = WARN,
ASYNC = WARN,
B = WARN,
A = WARN,
COM = WARN,
C = WARN,
DTZ = WARN,
T = WARN,
FIX = WARN,
FA = WARN,
ISC = WARN,
PIE = WARN,
PYI = WARN,
PT = WARN,
RET = WARN,
SIM = WARN,
TC = WARN,
I = WARN,
E = ERROR,
W = WARN,
DOC = WARN,
D = INFO,
F = WARN,
PLC = WARN,
PLE = ERROR,
PLR = WARN,
PLW = WARN,
UP = WARN,
RUF = WARN,
}
---@type ServerConfig
return {
enable = true,
mason = { "jedi-language-server", dependencies = { "ruff" } },
linters = {
{
cmd = {
"ruff",
"check",
"--output-format=json",
"-q",
"-",
},
stdin = true,
stdout = true,
json = {
lnum = "location.row",
end_lnum = "end_location.row",
col = "location.column",
end_col = "end_location.column",
code = "code",
message = "message",
callback = function(diag)
if diag.severity or not diag.code then
return
end
diag.severity = SEVERITY_MAP[diag.code:match("^(%u+)")]
end,
},
source = "ruff",
tags = {
deprecated = {
"PYI057",
"PT020",
"UP005",
"UP019",
"UP021",
"UP023",
"UP026",
"UP035",
},
unnecessary = {
"ARG001",
"ARG002",
"ARG003",
"ARG004",
"ARG005",
"F401",
"F504",
"F522",
"F811",
"F841",
"F842",
"RUF029",
"RUF059",
"RUF100",
},
},
},
},
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"ruff",
"format",
"--stdin-filename=%filename%",
"--quiet",
"-",
},
output = "stdout",
})
utils.format({
cmd = {
"ruff",
"check",
"--select=I",
"--fix",
"--quiet",
"-",
},
output = "stdout",
})
end,
},
{
mode = "x",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"ruff",
"format",
"--stdin-filename=%filename%",
"--quiet",
"--range=%row_start%:%col_start%-%row_end%:%col_end%",
"-",
},
output = "stdout",
})
end,
},
},
lspconfig = {
filetypes = {
"python",
},
cmd = { "jedi-language-server" },
single_file_support = true,
init_options = {
completion = {
disableSnippets = true,
},
diagnostics = {
enable = true,
},
},
},
}
+40
View File
@@ -0,0 +1,40 @@
-- spec: https://github.com/eclipse/lemminx/blob/main/docs/Configuration.md
return {
enable = true,
mason = {
name = "lemminx",
dependencies = { "xmlformatter" },
},
lspconfig = {
filetypes = {
"xml",
"xsd",
"xsl",
"xslt",
"svg",
},
cmd = { "lemminx", },
single_file_support = true,
init_options = {
settings = {
xml = {
format = {
enabled = true, -- is able to format document
splitAttributes = true, -- each attribute is formatted onto new line
joinCDATALines = false, -- normalize content inside CDATA
joinCommentLines = false, -- normalize content inside comments
formatComments = true, -- keep comment in relative position
joinContentLines = false, -- normalize content inside elements
spaceBeforeEmptyCloseLine = true, -- insert whitespace before self closing tag end bracket
},
validation = {
noGrammar = "ignore",
enabled = true,
schema = true,
}
},
},
},
},
}
+87
View File
@@ -0,0 +1,87 @@
-- spec: https://luals.github.io/wiki/settings/
local utils = require("ow.utils")
---@type ServerConfig
return {
enable = true,
dependencies = { "cargo" },
mason = {
"lua-language-server",
post_install = { { cmd = { "cargo", "install", "stylua", "--features", "lua54" } } },
},
keymaps = {
{
mode = "n",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = { "stylua", "-" },
output = "stdout",
})
end,
},
{
mode = "x",
lhs = "<leader>lf",
rhs = function()
utils.format({
cmd = {
"stylua",
"-",
"--range-start",
"%byte_start%",
"--range-end",
"%byte_end%",
},
output = "stdout",
})
end,
},
},
lspconfig = {
filetypes = { "lua" },
cmd = { "lua-language-server" },
single_file_support = true,
settings = {
Lua = {
completion = { showWord = "Disable" },
diagnostics = {
-- disable = { "missing-fields" },
},
runtime = {
version = "LuaJIT",
path = {
-- "?.lua",
"?.lua",
"?/init.lua",
-- "?.lua",
-- "lua/?.lua",
-- "lua/?/init.lua",
-- "?/lua/?.lua",
-- "?/lua/?/init.lua",
},
-- pathStrict = true,
},
workspace = {
library = {
vim.env.VIMRUNTIME,
"~/repos/awesome-code-doc",
"/usr/share/awesome/lib",
vim.fn.stdpath("data") .. "/lazy",
},
checkThirdParty = false,
},
hint = {
enable = false,
arrayIndex = "Disable",
await = true,
paramName = "All",
paramType = true,
semicolon = "Disable",
setType = true,
},
telemetry = { enable = false },
},
},
},
}
+21
View File
@@ -0,0 +1,21 @@
---@type ServerConfig
return {
enable = true,
mason = { "mesonlsp" },
lspconfig = {
---@type fun(filename: string, bufnr: number): string?
root_dir = function(filename, bufnr)
local parent = require("lspconfig").util.find_git_ancestor(filename)
if not parent then
local win = vim.fn.bufwinid(bufnr)
parent = vim.fn.getcwd(win)
end
return parent
end,
settings = {
others = {
disableInlayHints = true,
},
},
},
}
+26
View File
@@ -0,0 +1,26 @@
---@type ServerConfig
return {
enable = true,
mason = { "pyright" },
lspconfig = {
filetypes = {
"python",
},
cmd = { "pyright-langserver", "--stdio" },
single_file_support = true,
-- https://microsoft.github.io/pyright/#/settings
settings = {
python = {
analysis = {
autoSearchPaths = true,
diagnosticMode = "openFilesOnly",
useLibraryCodeForTypes = true,
typeCheckingMode = "strict",
},
},
pyright = {
disableLanguageServices = true,
},
},
},
}
+191
View File
@@ -0,0 +1,191 @@
-- spec: https://rust-analyzer.github.io/manual.html#configuration
return {
enable = true,
mason = {
name = "rust-analyzer",
-- version = "",
},
lspconfig = {
filetypes = {
"rust",
},
cmd = { "rust-analyzer", },
single_file_support = true,
settings = {
["rust-analyzer"] = {
inlayHints = {
chainingHints = {
enable = false,
},
parameterHints = {
enable = false,
},
typeHints = {
enable = false,
},
},
--[[ assist = {
emitMustUse = false,
expressionFillDefault = false,
},
cachePriming = {
enable = false,
},
cargo = {
autoreload = false,
buildScripts = {
enable = false,
},
},
checkOnSave = false,
completion = {
autoimport = {
enable = false,
},
autoself = {
enable = false,
},
callable = {
snippets = false,
},
fullFunctionSignatures = {
enable = false,
},
postfix = {
enable = false,
},
privateEditable = {
enable = false,
},
},
diagnostics = {
enable = false,
},
highlightRelated = {
breakPoints = {
enable = false,
},
closureCaptures = {
enable = false,
},
exitPoints = {
enable = false,
},
references = {
enable = false,
},
yieldPoints = {
enable = false,
},
},
hover = {
actions = {
enable = false,
},
documentation = {
enable = true,
},
links = {
enable = false,
},
memoryLayout = {
enable = false,
},
},
imports = {
group = {
enable = false,
},
},
inlayHints = {
bindingModeHints = {
enable = false,
},
chainingHints = {
enable = false,
},
closingBraceHints = {
enable = false,
},
closureCaptureHints = {
enable = false,
},
closureReturnTypeHints = {
enable = false,
},
discriminantHints = {
enable = false,
},
expressionAdjustmentHints = {
enable = false,
},
lifetimeElisionHints = {
enable = false,
},
parameterHints = {
enable = false,
},
reborrowHints = {
enable = false,
},
typeHints = {
enable = false,
},
},
joinLines = {
joinAssignments = false,
joinElseIf = false,
removeTrailingComma = false,
unwrapTrivialBlock = false,
},
lens = {
enable = false,
},
notifications = {
cargoTomlNotFound = false,
},
procMacro = {
enable = false,
},
references = {
excludeImports = false,
},
rustfmt = {
rangeFormatting = {
enable = false,
},
},
semanticHighlighting = {
doc = {
comment = {
inject = {
enable = false,
},
},
},
nonStandardTokens = false,
operator = {
enable = false,
},
punctuation = {
enable = false,
},
strings = {
enable = false,
},
},
signatureInfo = {
documentation = {
enable = true,
},
},
typing = {
autoClosingAngleBrackets = {
enable = false,
},
}, ]]
},
},
},
}
+31
View File
@@ -0,0 +1,31 @@
-- spec: https://github.com/zigtools/zls#configuration-options
---@type ServerConfig
return {
enable = true,
dependencies = {
"zig",
},
-- mason = {
-- name = "zls",
-- -- version = "",
-- },
lspconfig = {
filetypes = {
"zig",
"zir",
},
cmd = { "zls", },
single_file_support = true,
settings = {
zls = {
warn_style = true,
highlight_global_var_declarations = true,
inlay_hints_show_variable_type_hints = false,
inlay_hints_show_struct_literal_field_type = false,
inlay_hints_show_parameter_name = false,
inlay_hints_show_builtin = false,
},
},
},
}