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
+5 -5
View File
@@ -1,6 +1,6 @@
vim.loader.enable() vim.loader.enable()
local utils = require("utils") local utils = require("ow.utils")
local files = { local files = {
"globals", "globals",
@@ -10,7 +10,7 @@ local files = {
} }
for _, file in ipairs(files) do for _, file in ipairs(files) do
local pkg = "core." .. file local pkg = "ow.core." .. file
local ok, err = pcall(require, pkg) local ok, err = pcall(require, pkg)
if not ok then if not ok then
utils.err("Error while loading package " .. pkg) utils.err("Error while loading package " .. pkg)
@@ -19,7 +19,7 @@ for _, file in ipairs(files) do
end end
end end
local ok, err = pcall(require, "bootstrap") local ok, err = pcall(require, "ow.bootstrap")
if not ok then if not ok then
utils.err("Error during bootstrap") utils.err("Error during bootstrap")
utils.err(err:gsub("\t", " ")) utils.err(err:gsub("\t", " "))
@@ -30,9 +30,9 @@ end
local plugins = { local plugins = {
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
config = require("lsp").setup, config = require("ow.lsp").setup,
}, },
{ import = "plugins" }, { import = "ow.plugins" },
} }
---@type LazyConfig ---@type LazyConfig
+1 -1
View File
@@ -6,7 +6,7 @@ if version.major == 0 then
end end
end end
local utils = require("utils") local utils = require("ow.utils")
-- Install lazy.nvim -- Install lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+18 -9
View File
@@ -1,9 +1,9 @@
local utils = require("utils") local utils = require("ow.utils")
local CONFIG_DIR = vim.fn.stdpath("config") .. "/lua/lsp/config" local CONFIG_DIR = vim.fn.stdpath("config") .. "/lua/ow/lsp/config"
---@class Server ---@class Server
local Server = require("lsp.server") local Server = require("ow.lsp.server")
local M = {} local M = {}
@@ -19,9 +19,9 @@ local function get_module_name(filepath)
end end
local function get_server_config(name) local function get_server_config(name)
local module = "lsp.config." .. name local module = "ow.lsp.config." .. name
package.loaded[module] = nil package.loaded[module] = nil
return utils.try_require("lsp.config." .. name) return utils.try_require("ow.lsp.config." .. name)
end end
local reload_server_config = utils.debounce_with_id(function(name, events) local reload_server_config = utils.debounce_with_id(function(name, events)
@@ -35,7 +35,8 @@ local reload_server_config = utils.debounce_with_id(function(name, events)
end end
if events.rename then if events.rename then
local _, _, err_name = vim.uv.fs_stat(("%s/%s.lua"):format(CONFIG_DIR, name)) local _, _, err_name =
vim.uv.fs_stat(("%s/%s.lua"):format(CONFIG_DIR, name))
if err_name == "ENOENT" then if err_name == "ENOENT" then
return return
end end
@@ -51,7 +52,7 @@ local reload_server_config = utils.debounce_with_id(function(name, events)
return return
end end
local on_done = function (success) local on_done = function(success)
if success then if success then
utils.info(("%s reloaded"):format(name)) utils.info(("%s reloaded"):format(name))
end end
@@ -68,7 +69,10 @@ end, 1000)
local function process_change(error, filename, events) local function process_change(error, filename, events)
if error then if error then
utils.err(("Error on change for %s:\n%s"):format(filename, error), "lsp.on_config_change") utils.err(
("Error on change for %s:\n%s"):format(filename, error),
"ow.lsp.on_config_change"
)
return return
end end
@@ -109,7 +113,12 @@ local function load_configs()
::continue:: ::continue::
end end
vim.uv.fs_event_start(vim.uv.new_fs_event(), CONFIG_DIR, {}, vim.schedule_wrap(process_change)) vim.uv.fs_event_start(
vim.uv.new_fs_event(),
CONFIG_DIR,
{},
vim.schedule_wrap(process_change)
)
end end
--- Setup diagnostics UI --- Setup diagnostics UI
@@ -1,4 +1,4 @@
local utils = require("utils") local utils = require("ow.utils")
return { return {
enable = true, enable = true,
@@ -1,4 +1,4 @@
local utils = require("utils") local utils = require("ow.utils")
---@type ServerConfig ---@type ServerConfig
return { return {
@@ -2,7 +2,7 @@
-- https://github.com/bmewburn/intelephense-docs/blob/master/installation.md -- https://github.com/bmewburn/intelephense-docs/blob/master/installation.md
-- https://github.com/bmewburn/vscode-intelephense/blob/master/package.json -- https://github.com/bmewburn/vscode-intelephense/blob/master/package.json
local utils = require("utils") local utils = require("ow.utils")
return { return {
enable = true, enable = true,
@@ -1,4 +1,4 @@
local utils = require("utils") local utils = require("ow.utils")
local ERROR = vim.diagnostic.severity.ERROR local ERROR = vim.diagnostic.severity.ERROR
local WARN = vim.diagnostic.severity.WARN local WARN = vim.diagnostic.severity.WARN
@@ -1,7 +1,5 @@
-- spec: https://github.com/eclipse/lemminx/blob/main/docs/Configuration.md -- spec: https://github.com/eclipse/lemminx/blob/main/docs/Configuration.md
local utils = require("utils")
return { return {
enable = true, enable = true,
mason = { mason = {
@@ -1,5 +1,5 @@
-- spec: https://luals.github.io/wiki/settings/ -- spec: https://luals.github.io/wiki/settings/
local utils = require("utils") local utils = require("ow.utils")
---@type ServerConfig ---@type ServerConfig
return { return {
+1 -1
View File
@@ -1,7 +1,7 @@
-- Mappings. -- Mappings.
-- See `:help vim.lsp.*` for documentation on any of the below functions -- See `:help vim.lsp.*` for documentation on any of the below functions
local utils = require("utils") local utils = require("ow.utils")
---@class Keymap ---@class Keymap
---@field mode string|string[] ---@field mode string|string[]
+1 -1
View File
@@ -1,4 +1,4 @@
local utils = require("utils") local utils = require("ow.utils")
---@class Linter ---@class Linter
---@field name string ---@field name string
@@ -1,4 +1,4 @@
local utils = require("utils") local utils = require("ow.utils")
---@class PostInstallStep ---@class PostInstallStep
---@field cmd string[] ---@field cmd string[]
+4 -4
View File
@@ -1,11 +1,11 @@
local keymap = require("lsp.keymap") local keymap = require("ow.lsp.keymap")
local utils = require("utils") local utils = require("ow.utils")
---@class Linter ---@class Linter
local Linter = require("lsp.linter") local Linter = require("ow.lsp.linter")
---@class MasonPackage ---@class MasonPackage
local MasonPackage = require("lsp.package") local MasonPackage = require("ow.lsp.package")
---@class Server ---@class Server
---@field name? string ---@field name? string
@@ -37,7 +37,11 @@ return {
config = function() config = function()
require("luasnip.loaders.from_vscode").lazy_load() require("luasnip.loaders.from_vscode").lazy_load()
end, end,
build = (require("utils").os_name ~= "Windows_NT" and "make install_jsregexp" or nil), build = (
require("ow.utils").os_name ~= "Windows_NT"
and "make install_jsregexp"
or nil
),
version = "2.*", version = "2.*",
dependencies = { "rafamadriz/friendly-snippets" }, dependencies = { "rafamadriz/friendly-snippets" },
}, },
@@ -45,7 +49,7 @@ return {
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
local luasnip = require("luasnip") local luasnip = require("luasnip")
local utils = require("utils") local utils = require("ow.utils")
local lspkind = utils.try_require("lspkind") local lspkind = utils.try_require("lspkind")
---@type cmp.ConfigSchema ---@type cmp.ConfigSchema
@@ -53,7 +57,7 @@ return {
-- enabled = function() -- enabled = function()
-- return has_words_before() -- return has_words_before()
-- end, -- end,
preselect = 'None', preselect = "None",
completion = { completion = {
autocomplete = { "InsertEnter", "TextChanged" }, autocomplete = { "InsertEnter", "TextChanged" },
keyword_length = 1, keyword_length = 1,
View File