diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..1b2d693
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..1412a4d
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/nvim.iml b/.idea/nvim.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/nvim.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lua/core/init.lua b/lua/core/init.lua
index 6798319..7fc952d 100644
--- a/lua/core/init.lua
+++ b/lua/core/init.lua
@@ -1,3 +1,4 @@
require('core.keymap')
+require('toolchain').init()
require('core.editor')
require('core.package_manager')
diff --git a/lua/core/package_manager.lua b/lua/core/package_manager.lua
index b5db7b3..5eaab0c 100644
--- a/lua/core/package_manager.lua
+++ b/lua/core/package_manager.lua
@@ -11,9 +11,9 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
-local plugins = require('toolchain').plugins
+local plugins = require('toolchain').get_plugins()
table.insert(plugins, 1, { import = 'editor' })
require('lazy').setup({
- spec = plugins,
+ spec = plugins
})
diff --git a/lua/editor/highlighting.lua b/lua/editor/highlighting.lua
index fa2755d..eeb66fb 100644
--- a/lua/editor/highlighting.lua
+++ b/lua/editor/highlighting.lua
@@ -8,7 +8,7 @@ return {
auto_install = true,
highlight = { enable = true },
indent = { enable = true },
- ensure_installed = require('toolchain').highlighters,
+ ensure_installed = require('toolchain').get_highlighter_autoinstalls(),
})
end,
}
diff --git a/lua/editor/language_server.lua b/lua/editor/language_server.lua
index 53298fa..40f732c 100644
--- a/lua/editor/language_server.lua
+++ b/lua/editor/language_server.lua
@@ -14,7 +14,7 @@ return {
},
config = function()
require('mason-lspconfig').setup({
- ensure_installed = TOOLCHAIN.lsp_requriemts,
+ ensure_installed = TOOLCHAIN.get_lsp_autoinstalls(),
})
end,
},
@@ -26,9 +26,7 @@ return {
local capabilities = require('cmp_nvim_lsp').default_capabilities()
local lspconfig = require('lspconfig')
- for _, lsp in ipairs(TOOLCHAIN.language_servers) do
- lsp.setup(lspconfig, capabilities)
- end
+ TOOLCHAIN.setup_lsps(lspconfig, capabilities)
-- Keybinding --
vim.keymap.set(
@@ -67,18 +65,8 @@ return {
-- Setup --
local null_ls = require('null-ls')
- local null_ls_sources = {}
- for _, setup_function in ipairs(TOOLCHAIN.diagnostics) do
- local conf = setup_function(null_ls)
- if #conf ~= 0 then
- for _, _conf in pairs(conf) do
- table.insert(null_ls_sources, _conf)
- end
- end
- end
-
null_ls.setup({
- sources = null_ls_sources,
+ sources = TOOLCHAIN.get_null_ls_source(null_ls),
})
-- Keybinding --
diff --git a/lua/toolchain/config.lua b/lua/toolchain/config.lua
new file mode 100644
index 0000000..adf82c5
--- /dev/null
+++ b/lua/toolchain/config.lua
@@ -0,0 +1,41 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('json', 'xml', 'yaml', 'toml')
+
+ T.add_null_ls_module(function(null_ls)
+ return {
+ null_ls.builtins.diagnostics.spectral,
+ --null_ls.builtins.diagnostics.vacuum --Pure Openapi linter
+ }
+ end)
+
+ T.add_lsp_autoinstalls('jsonls', 'lemminx', 'yamlls', 'taplo')
+ T.add_lsps(function(lspconfig, capabilities)
+ local config = { capabilities = capabilities }
+ lspconfig.jsonls.setup(config)
+ lspconfig.lemminx.setup(config)
+ lspconfig.yamlls.setup(config)
+ lspconfig.taplo.setup(config)
+ end)
+
+ T.add_plugins(
+ {
+ 'folke/lazydev.nvim',
+ ft = 'lua',
+ opts = {
+ library = {},
+ },
+ },
+ {
+ "folke/neoconf.nvim",
+ priority = 100,
+ config = function()
+ require('neoconf').setup()
+ end
+ }
+ )
+end
+
+return M
diff --git a/lua/toolchain/config/actions.lua b/lua/toolchain/config/actions.lua
deleted file mode 100644
index b6fa425..0000000
--- a/lua/toolchain/config/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/config/debugger.lua b/lua/toolchain/config/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/config/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/config/diagnostics.lua b/lua/toolchain/config/diagnostics.lua
deleted file mode 100644
index 28d9c74..0000000
--- a/lua/toolchain/config/diagnostics.lua
+++ /dev/null
@@ -1,10 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.spectral,
- --null_ls.builtins.diagnostics.vacuum --Pure Openapi linter
- }
- end,
-}
diff --git a/lua/toolchain/config/formatter.lua b/lua/toolchain/config/formatter.lua
deleted file mode 100644
index f7ecfd2..0000000
--- a/lua/toolchain/config/formatter.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/config/init.lua b/lua/toolchain/config/init.lua
deleted file mode 100644
index 106f1de..0000000
--- a/lua/toolchain/config/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.config.requirements'),
- language_servers = require('toolchain.config.language_server'),
- formatters = require('toolchain.config.formatter'),
- actions = require('toolchain.config.actions'),
- diagnostics = require('toolchain.config.diagnostics'),
- debuggers = require('toolchain.config.debugger'),
-}
diff --git a/lua/toolchain/config/language_server.lua b/lua/toolchain/config/language_server.lua
deleted file mode 100644
index 18b6998..0000000
--- a/lua/toolchain/config/language_server.lua
+++ /dev/null
@@ -1,16 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'jsonls',
- 'lemminx',
- 'yamlls',
- 'taplo',
- },
- setup = function(lspconfig, capabilities)
- local config = { capabilities = capabilities }
- lspconfig.jsonls.setup(config)
- lspconfig.lemminx.setup(config)
- lspconfig.yamlls.setup(config)
- lspconfig.taplo.setup(config)
- end,
-}
diff --git a/lua/toolchain/config/plugins.lua b/lua/toolchain/config/plugins.lua
deleted file mode 100644
index 2eb0056..0000000
--- a/lua/toolchain/config/plugins.lua
+++ /dev/null
@@ -1,16 +0,0 @@
-return {
- {
- 'folke/lazydev.nvim',
- ft = 'lua',
- opts = {
- library = {},
- },
- },
- {
- "folke/neoconf.nvim",
- priority = 100,
- config = function ()
- require('neoconf').setup()
- end
- }
-}
diff --git a/lua/toolchain/config/requirements.lua b/lua/toolchain/config/requirements.lua
deleted file mode 100644
index 0e7bf96..0000000
--- a/lua/toolchain/config/requirements.lua
+++ /dev/null
@@ -1,17 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.config.formatter').plugins),
- table.unpack(require('toolchain.config.actions').plugins),
- table.unpack(require('toolchain.config.diagnostics').plugins),
- table.unpack(require('toolchain.config.debugger').plugins),
- table.unpack(require('toolchain.config.plugins')),
- },
- highlighters = {
- 'json',
- 'xml',
- 'yaml',
- 'toml',
- },
- language_servers = require('toolchain.config.language_server').requirements,
-}
diff --git a/lua/toolchain/database.lua b/lua/toolchain/database.lua
new file mode 100644
index 0000000..2491d87
--- /dev/null
+++ b/lua/toolchain/database.lua
@@ -0,0 +1,13 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('sql')
+ T.add_lsp_autoinstalls('sqlls')
+ T.add_lsps(function(lspconfig, capabilities)
+ local config = { capabilities = capabilities }
+ lspconfig.sqlls.setup(config)
+ end)
+end
+
+return M
diff --git a/lua/toolchain/database/actions.lua b/lua/toolchain/database/actions.lua
deleted file mode 100644
index b6fa425..0000000
--- a/lua/toolchain/database/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/database/debugger.lua b/lua/toolchain/database/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/database/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/database/diagnostics.lua b/lua/toolchain/database/diagnostics.lua
deleted file mode 100644
index d9057cd..0000000
--- a/lua/toolchain/database/diagnostics.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/database/formatter.lua b/lua/toolchain/database/formatter.lua
deleted file mode 100644
index f7ecfd2..0000000
--- a/lua/toolchain/database/formatter.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/database/init.lua b/lua/toolchain/database/init.lua
deleted file mode 100644
index 145cfb8..0000000
--- a/lua/toolchain/database/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.database.requirements'),
- language_servers = require('toolchain.database.language_server'),
- formatters = require('toolchain.database.formatter'),
- actions = require('toolchain.database.actions'),
- diagnostics = require('toolchain.database.diagnostics'),
- debuggers = require('toolchain.database.debugger'),
-}
diff --git a/lua/toolchain/database/language_server.lua b/lua/toolchain/database/language_server.lua
deleted file mode 100644
index 5a5c598..0000000
--- a/lua/toolchain/database/language_server.lua
+++ /dev/null
@@ -1,10 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'sqlls',
- },
- setup = function(lspconfig, capabilities)
- local config = { capabilities = capabilities }
- lspconfig.sqlls.setup(config)
- end,
-}
diff --git a/lua/toolchain/database/plugins.lua b/lua/toolchain/database/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/database/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/database/requirements.lua b/lua/toolchain/database/requirements.lua
deleted file mode 100644
index 2c249e5..0000000
--- a/lua/toolchain/database/requirements.lua
+++ /dev/null
@@ -1,14 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.database.formatter').plugins),
- table.unpack(require('toolchain.database.actions').plugins),
- table.unpack(require('toolchain.database.diagnostics').plugins),
- table.unpack(require('toolchain.database.debugger').plugins),
- table.unpack(require('toolchain.database.plugins')),
- },
- highlighters = {
- 'sql',
- },
- language_servers = require('toolchain.database.language_server').requirements,
-}
diff --git a/lua/toolchain/frontend.lua b/lua/toolchain/frontend.lua
new file mode 100644
index 0000000..42165d1
--- /dev/null
+++ b/lua/toolchain/frontend.lua
@@ -0,0 +1,14 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('svelte', 'vue')
+ T.add_lsp_autoinstalls('svelte', 'volar')
+ T.add_lsps(function(lspconfig, capabilities)
+ local config = { capabilities = capabilities }
+ lspconfig.svelte.setup(config)
+ lspconfig.volar.setup(config)
+ end)
+end
+
+return M
diff --git a/lua/toolchain/frontend/actions.lua b/lua/toolchain/frontend/actions.lua
deleted file mode 100644
index b6fa425..0000000
--- a/lua/toolchain/frontend/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/frontend/debugger.lua b/lua/toolchain/frontend/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/frontend/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/frontend/diagnostics.lua b/lua/toolchain/frontend/diagnostics.lua
deleted file mode 100644
index d9057cd..0000000
--- a/lua/toolchain/frontend/diagnostics.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/frontend/formatter.lua b/lua/toolchain/frontend/formatter.lua
deleted file mode 100644
index f7ecfd2..0000000
--- a/lua/toolchain/frontend/formatter.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/frontend/init.lua b/lua/toolchain/frontend/init.lua
deleted file mode 100644
index 21fe9b2..0000000
--- a/lua/toolchain/frontend/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.frontend.requirements'),
- language_servers = require('toolchain.frontend.language_server'),
- formatters = require('toolchain.frontend.formatter'),
- actions = require('toolchain.frontend.actions'),
- diagnostics = require('toolchain.frontend.diagnostics'),
- debuggers = require('toolchain.frontend.debugger'),
-}
diff --git a/lua/toolchain/frontend/language_server.lua b/lua/toolchain/frontend/language_server.lua
deleted file mode 100644
index 62204c9..0000000
--- a/lua/toolchain/frontend/language_server.lua
+++ /dev/null
@@ -1,12 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'svelte',
- 'volar',
- },
- setup = function(lspconfig, capabilities)
- local config = { capabilities = capabilities }
- lspconfig.svelte.setup(config)
- lspconfig.volar.setup(config)
- end,
-}
diff --git a/lua/toolchain/frontend/plugins.lua b/lua/toolchain/frontend/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/frontend/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/frontend/requirements.lua b/lua/toolchain/frontend/requirements.lua
deleted file mode 100644
index 7c492ef..0000000
--- a/lua/toolchain/frontend/requirements.lua
+++ /dev/null
@@ -1,16 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.frontend.formatter').plugins),
- table.unpack(require('toolchain.frontend.actions').plugins),
- table.unpack(require('toolchain.frontend.diagnostics').plugins),
- table.unpack(require('toolchain.frontend.debugger').plugins),
- table.unpack(require('toolchain.frontend.plugins')),
- },
-
- highlighters = {
- 'svelte',
- 'vue',
- },
- language_servers = require('toolchain.frontend.language_server').requirements,
-}
diff --git a/lua/toolchain/generic.lua b/lua/toolchain/generic.lua
new file mode 100644
index 0000000..fd83a45
--- /dev/null
+++ b/lua/toolchain/generic.lua
@@ -0,0 +1,13 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_null_ls_module(function(null_ls)
+ return {
+ -- Actions
+ null_ls.builtins.code_actions.refactoring,
+ }
+ end)
+end
+
+return M
diff --git a/lua/toolchain/generic/actions.lua b/lua/toolchain/generic/actions.lua
deleted file mode 100644
index 217a9f7..0000000
--- a/lua/toolchain/generic/actions.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.code_actions.refactoring,
- }
- end,
-}
diff --git a/lua/toolchain/generic/debugger.lua b/lua/toolchain/generic/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/generic/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/generic/diagnostics.lua b/lua/toolchain/generic/diagnostics.lua
deleted file mode 100644
index d9057cd..0000000
--- a/lua/toolchain/generic/diagnostics.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/generic/formatter.lua b/lua/toolchain/generic/formatter.lua
deleted file mode 100644
index f7ecfd2..0000000
--- a/lua/toolchain/generic/formatter.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/generic/init.lua b/lua/toolchain/generic/init.lua
deleted file mode 100644
index a56ab52..0000000
--- a/lua/toolchain/generic/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.generic.requirements'),
- language_servers = require('toolchain.generic.language_server'),
- formatters = require('toolchain.generic.formatter'),
- actions = require('toolchain.generic.actions'),
- diagnostics = require('toolchain.generic.diagnostics'),
- debuggers = require('toolchain.generic.debugger'),
-}
diff --git a/lua/toolchain/generic/language_server.lua b/lua/toolchain/generic/language_server.lua
deleted file mode 100644
index d52007d..0000000
--- a/lua/toolchain/generic/language_server.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {},
- setup = function(_lspgeneric, _capabilities) end,
-}
diff --git a/lua/toolchain/generic/plugins.lua b/lua/toolchain/generic/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/generic/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/generic/requirements.lua b/lua/toolchain/generic/requirements.lua
deleted file mode 100644
index 733f094..0000000
--- a/lua/toolchain/generic/requirements.lua
+++ /dev/null
@@ -1,12 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.generic.formatter').plugins),
- table.unpack(require('toolchain.generic.actions').plugins),
- table.unpack(require('toolchain.generic.diagnostics').plugins),
- table.unpack(require('toolchain.generic.debugger').plugins),
- table.unpack(require('toolchain.generic.plugins')),
- },
- highlighters = {},
- language_servers = require('toolchain.generic.language_server').requirements,
-}
diff --git a/lua/toolchain/git.lua b/lua/toolchain/git.lua
new file mode 100644
index 0000000..9a800a6
--- /dev/null
+++ b/lua/toolchain/git.lua
@@ -0,0 +1,47 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('gitcommit', 'gitignore', 'gitattributes', 'git_rebase', 'git_config')
+
+ T.add_plugins(
+ {
+ 'tpope/vim-fugitive',
+ },
+ {
+ 'lewis6991/gitsigns.nvim',
+ config = function()
+ -- Setup --
+ require('gitsigns').setup()
+
+ -- Keybinding --
+ vim.keymap.set(
+ 'n',
+ 'gh',
+ ':Gitsigns preview_hunk_inline',
+ { desc = 'Toggle Inline Git Diff' }
+ )
+ vim.keymap.set(
+ 'n',
+ 'gb',
+ ':Gitsigns toggle_current_line_blame',
+ { desc = 'Toggle Inline Git Blame' }
+ )
+ vim.keymap.set(
+ 'n',
+ 'go',
+ ':Git ',
+ { desc = 'Open Git' }
+ )
+ end,
+ },
+ {
+ 'moyiz/git-dev.nvim',
+ lazy = true,
+ cmd = { 'GitDevOpen', 'GitDevCleanAll' },
+ opts = {},
+ }
+ )
+end
+
+return M
diff --git a/lua/toolchain/git/actions.lua b/lua/toolchain/git/actions.lua
deleted file mode 100644
index b6fa425..0000000
--- a/lua/toolchain/git/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/git/debugger.lua b/lua/toolchain/git/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/git/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/git/diagnostics.lua b/lua/toolchain/git/diagnostics.lua
deleted file mode 100644
index d9057cd..0000000
--- a/lua/toolchain/git/diagnostics.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/git/formatter.lua b/lua/toolchain/git/formatter.lua
deleted file mode 100644
index f7ecfd2..0000000
--- a/lua/toolchain/git/formatter.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/git/init.lua b/lua/toolchain/git/init.lua
deleted file mode 100644
index c723e01..0000000
--- a/lua/toolchain/git/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.git.requirements'),
- language_servers = require('toolchain.git.language_server'),
- formatters = require('toolchain.git.formatter'),
- actions = require('toolchain.git.actions'),
- diagnostics = require('toolchain.git.diagnostics'),
- debuggers = require('toolchain.git.debugger'),
-}
diff --git a/lua/toolchain/git/language_server.lua b/lua/toolchain/git/language_server.lua
deleted file mode 100644
index 1d8b636..0000000
--- a/lua/toolchain/git/language_server.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {},
- setup = function(_lspconfig, _capabilities) end,
-}
diff --git a/lua/toolchain/git/plugins.lua b/lua/toolchain/git/plugins.lua
deleted file mode 100644
index 09f0f02..0000000
--- a/lua/toolchain/git/plugins.lua
+++ /dev/null
@@ -1,38 +0,0 @@
-return {
- {
- 'tpope/vim-fugitive',
- },
- {
- 'lewis6991/gitsigns.nvim',
- config = function()
- -- Setup --
- require('gitsigns').setup()
-
- -- Keybinding --
- vim.keymap.set(
- 'n',
- 'gh',
- ':Gitsigns preview_hunk_inline',
- { desc = 'Toggle Inline Git Diff' }
- )
- vim.keymap.set(
- 'n',
- 'gb',
- ':Gitsigns toggle_current_line_blame',
- { desc = 'Toggle Inline Git Blame' }
- )
- vim.keymap.set(
- 'n',
- 'go',
- ':Git ',
- { desc = 'Open Git' }
- )
- end,
- },
- {
- 'moyiz/git-dev.nvim',
- lazy = true,
- cmd = { 'GitDevOpen', 'GitDevCleanAll' },
- opts = {},
- },
-}
diff --git a/lua/toolchain/git/requirements.lua b/lua/toolchain/git/requirements.lua
deleted file mode 100644
index 11a1d39..0000000
--- a/lua/toolchain/git/requirements.lua
+++ /dev/null
@@ -1,18 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.git.formatter').plugins),
- table.unpack(require('toolchain.git.actions').plugins),
- table.unpack(require('toolchain.git.diagnostics').plugins),
- table.unpack(require('toolchain.git.debugger').plugins),
- table.unpack(require('toolchain.git.plugins')),
- },
- highlighters = {
- 'gitcommit',
- 'gitignore',
- 'gitattributes',
- 'git_rebase',
- 'git_config',
- },
- language_servers = require('toolchain.git.language_server').requirements,
-}
diff --git a/lua/toolchain/go.lua b/lua/toolchain/go.lua
new file mode 100644
index 0000000..363a0cc
--- /dev/null
+++ b/lua/toolchain/go.lua
@@ -0,0 +1,38 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('go', 'gomod', 'gosum', 'gotmpl')
+ T.add_null_ls_module(function(null_ls)
+ return {
+ -- Actions
+ null_ls.builtins.code_actions.gomodifytags,
+ null_ls.builtins.code_actions.impl,
+ -- Diagnostics
+ null_ls.builtins.diagnostics.golangci_lint,
+ null_ls.builtins.diagnostics.staticcheck,
+ -- Formatter
+ null_ls.builtins.formatting.gofumpt,
+ }
+ end)
+ T.add_lsp_autoinstalls('gopls')
+ T.add_lsps(function(lspconfig, capabilities)
+ lspconfig.gopls.setup({ capabilities = capabilities })
+ end)
+
+ T.add_plugins({
+ 'leoluz/nvim-dap-go',
+ config = function()
+ local dir = require('util.finder').find_project_dir(
+ 'go.mod',
+ 3,
+ { 'src', 'app', 'pkg' },
+ { 'test' },
+ true
+ )
+ require('dap-go').setup({ delve = { cwd = dir } })
+ end,
+ })
+end
+
+return M
diff --git a/lua/toolchain/go/actions.lua b/lua/toolchain/go/actions.lua
deleted file mode 100644
index 354c4ae..0000000
--- a/lua/toolchain/go/actions.lua
+++ /dev/null
@@ -1,10 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.code_actions.gomodifytags,
- null_ls.builtins.code_actions.impl,
- }
- end,
-}
diff --git a/lua/toolchain/go/debugger.lua b/lua/toolchain/go/debugger.lua
deleted file mode 100644
index 150fa6c..0000000
--- a/lua/toolchain/go/debugger.lua
+++ /dev/null
@@ -1,18 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {
- {
- 'leoluz/nvim-dap-go',
- config = function()
- local dir = require('util.finder').find_project_dir(
- 'go.mod',
- 3,
- { 'src', 'app', 'pkg' },
- { 'test' },
- true
- )
- require('dap-go').setup({ delve = { cwd = dir } })
- end,
- },
- },
-}
diff --git a/lua/toolchain/go/diagnostics.lua b/lua/toolchain/go/diagnostics.lua
deleted file mode 100644
index 230936f..0000000
--- a/lua/toolchain/go/diagnostics.lua
+++ /dev/null
@@ -1,10 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.golangci_lint,
- null_ls.builtins.diagnostics.staticcheck,
- }
- end,
-}
diff --git a/lua/toolchain/go/formatter.lua b/lua/toolchain/go/formatter.lua
deleted file mode 100644
index 5a33f19..0000000
--- a/lua/toolchain/go/formatter.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.formatting.gofumpt,
- }
- end,
-}
diff --git a/lua/toolchain/go/init.lua b/lua/toolchain/go/init.lua
deleted file mode 100644
index 3ed41c3..0000000
--- a/lua/toolchain/go/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.go.requirements'),
- language_servers = require('toolchain.go.language_server'),
- formatters = require('toolchain.go.formatter'),
- actions = require('toolchain.go.actions'),
- diagnostics = require('toolchain.go.diagnostics'),
- debuggers = require('toolchain.go.debugger'),
-}
diff --git a/lua/toolchain/go/language_server.lua b/lua/toolchain/go/language_server.lua
deleted file mode 100644
index 408f5d5..0000000
--- a/lua/toolchain/go/language_server.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'gopls',
- },
- setup = function(lspconfig, capabilities)
- lspconfig.gopls.setup({ capabilities = capabilities })
- end,
-}
diff --git a/lua/toolchain/go/plugins.lua b/lua/toolchain/go/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/go/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/go/requirements.lua b/lua/toolchain/go/requirements.lua
deleted file mode 100644
index 34dfa88..0000000
--- a/lua/toolchain/go/requirements.lua
+++ /dev/null
@@ -1,17 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.go.formatter').plugins),
- table.unpack(require('toolchain.go.actions').plugins),
- table.unpack(require('toolchain.go.diagnostics').plugins),
- table.unpack(require('toolchain.go.debugger').plugins),
- table.unpack(require('toolchain.go.plugins')),
- },
- highlighters = {
- 'go',
- 'gomod',
- 'gosum',
- 'gotmpl',
- },
- language_servers = require('toolchain.go.language_server').requirements,
-}
diff --git a/lua/toolchain/init.lua b/lua/toolchain/init.lua
index 94d6a8b..7625c73 100644
--- a/lua/toolchain/init.lua
+++ b/lua/toolchain/init.lua
@@ -1,106 +1,113 @@
local TOOLCHAINS = {}
-local config = require('toolchain.config')
-local database = require('toolchain.database')
-local frontend = require('toolchain.frontend')
-local generic = require('toolchain.generic')
-local git = require('toolchain.git')
-local go = require('toolchain.go')
-local lua = require('toolchain.lua')
-local php = require('toolchain.php')
-local scripts = require('toolchain.scripts')
-local text = require('toolchain.text')
-local web = require('toolchain.web')
+------------
+-- Plugins -
+------------
-TOOLCHAINS.plugins = {
- table.unpack(config.requirements.plugins),
- table.unpack(database.requirements.plugins),
- table.unpack(frontend.requirements.plugins),
- table.unpack(generic.requirements.plugins),
- table.unpack(git.requirements.plugins),
- table.unpack(go.requirements.plugins),
- table.unpack(lua.requirements.plugins),
- table.unpack(php.requirements.plugins),
- table.unpack(scripts.requirements.plugins),
- table.unpack(text.requirements.plugins),
- table.unpack(web.requirements.plugins),
-}
+local plugins = {}
-TOOLCHAINS.highlighters = {
- table.unpack(config.requirements.highlighters),
- table.unpack(database.requirements.highlighters),
- table.unpack(frontend.requirements.highlighters),
- table.unpack(generic.requirements.highlighters),
- table.unpack(git.requirements.highlighters),
- table.unpack(go.requirements.highlighters),
- table.unpack(lua.requirements.highlighters),
- table.unpack(php.requirements.highlighters),
- table.unpack(scripts.requirements.highlighters),
- table.unpack(text.requirements.highlighters),
- table.unpack(web.requirements.highlighters),
-}
+--- @param ... LazySpec
+TOOLCHAINS.add_plugins = function(...)
+ for _, spec in ipairs({...}) do
+ table.insert(plugins, spec)
+ end
+end
-TOOLCHAINS.language_servers = {
- table.unpack(config.language_servers),
- table.unpack(database.language_servers),
- table.unpack(frontend.language_servers),
- table.unpack(generic.language_servers),
- table.unpack(git.language_servers),
- table.unpack(go.language_servers),
- table.unpack(lua.language_servers),
- table.unpack(php.language_servers),
- table.unpack(scripts.language_servers),
- table.unpack(text.language_servers),
- table.unpack(web.language_servers),
-}
+TOOLCHAINS.get_plugins = function()
+ return plugins
+end
+---------
+-- LSPs -
+---------
+local lsp_autoinstalls = {}
+local lsp_setups = {}
-TOOLCHAINS.diagnostics = {
- table.unpack(config.diagnostics),
- table.unpack(database.diagnostics),
- table.unpack(frontend.diagnostics),
- table.unpack(generic.diagnostics),
- table.unpack(git.diagnostics),
- table.unpack(go.diagnostics),
- table.unpack(lua.diagnostics),
- table.unpack(php.diagnostics),
- table.unpack(scripts.diagnostics),
- table.unpack(text.diagnostics),
- table.unpack(web.diagnostics),
-}
+--- @param ... string
+TOOLCHAINS.add_lsp_autoinstalls = function(...)
+ for _, lsp in ipairs({...}) do
+ table.insert(lsp_autoinstalls, lsp)
+ end
+end
+TOOLCHAINS.get_lsp_autoinstalls = function()
+ return lsp_autoinstalls
+end
+
+--- @param setup SetupLSPs
+TOOLCHAINS.add_lsps = function(setup)
+ table.insert(lsp_setups, setup)
+end
+
+--- @param lspconfig any
+--- @param capabilities any
+TOOLCHAINS.setup_lsps = function(lspconfig, capabilities)
+ for _, setup in ipairs(lsp_setups) do
+ setup(lspconfig, capabilities)
+ end
+end
+
+------------
+-- Null ls -
+------------
+
+local null_ls_setups = {}
+
+--- @param setup SetupNullLsModule
+TOOLCHAINS.add_null_ls_module = function(setup)
+ table.insert(null_ls_setups, setup)
+end
+
+
+TOOLCHAINS.get_null_ls_source = function(null_ls)
+ local null_ls_sources = {}
+ for _, setup_function in ipairs(null_ls_setups) do
+ local conf = setup_function(null_ls)
+ if #conf ~= 0 then
+ for _, _conf in pairs(conf) do
+ table.insert(null_ls_sources, _conf)
+ end
+ end
+ end
+ return null_ls_sources
+end
+
+----------------
+-- Highlighter -
+----------------
+
+local highlighter_autoinstalls = {}
+
+--- @param ... string
+TOOLCHAINS.add_highlighter_autoinstalls = function(...)
+ for _, highlighter in ipairs({...}) do
+ table.insert(highlighter_autoinstalls, highlighter)
+ end
+end
+
+TOOLCHAINS.get_highlighter_autoinstalls = function()
+ return highlighter_autoinstalls
+end
+
+----------------
+-- Init -
+----------------
+TOOLCHAINS.init = function()
+ require('toolchain.config').setup()
+ require('toolchain.database').setup()
+ require('toolchain.frontend').setup()
+ require('toolchain.generic').setup()
+ require('toolchain.git').setup()
+ require('toolchain.go').setup()
+ require('toolchain.lua').setup()
+ require('toolchain.php').setup()
+ require('toolchain.scripts').setup()
+ require('toolchain.text').setup()
+ require('toolchain.web').setup()
+end
return TOOLCHAINS
---Type Definitions
-
----@class Toolchain
----@field requirements ToolchainRequirements
----@field formatters ToolchainFormatters
----@field language_servers ToolchainLanguageServers
----@field actions ToolchainActions
----@field diagnostics ToolchainDiagnostics
----@field debuggers ToolchainDebuggers
-
----@class ToolchainRequirements
----@field plugins LazySpec[]
----@field highlighters table
----@field language_servers table
-
----@class ToolchainLanguageServers
----@field requirements string[]
----@field setup fun(lspconfig:any, capabilities: any)
-
----@class ToolchainFormatters
----@field plugins LazySpec[]
----@field setup fun(null_ls: any):table
-
----@class ToolchainActions
----@field plugins LazySpec[]
----@field setup fun(null_ls: any):table
-
----@class ToolchainDiagnostics
----@field plugins LazySpec[]
----@field setup fun(null_ls: any):table
-
----@class ToolchainDebuggers
----@field plugins LazySpec[]
-
+---------------------
+-- Type Definitions -
+---------------------
+---@alias SetupLSPs fun(lspconfig:any, capabilities: any)
+---@alias SetupNullLsModule fun(null_ls: any):table
diff --git a/lua/toolchain/lua.lua b/lua/toolchain/lua.lua
new file mode 100644
index 0000000..728a426
--- /dev/null
+++ b/lua/toolchain/lua.lua
@@ -0,0 +1,31 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('lua','luadoc')
+
+ T.add_null_ls_module(function(null_ls)
+ return {
+ -- Diagnostics
+ null_ls.builtins.diagnostics.selene,
+ -- Formatter
+ null_ls.builtins.formatting.stylua,
+ }
+ end)
+ T.add_lsp_autoinstalls('lua_ls')
+
+ T.add_lsps(function(lspconfig, capabilities)
+ lspconfig.lua_ls.setup({
+ capabilities = capabilities,
+ settings = {
+ Lua = {
+ diagnostics = {
+ globals = { 'vim' },
+ },
+ },
+ },
+ })
+ end)
+end
+
+return M
diff --git a/lua/toolchain/lua/actions.lua b/lua/toolchain/lua/actions.lua
deleted file mode 100644
index b6fa425..0000000
--- a/lua/toolchain/lua/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/lua/debugger.lua b/lua/toolchain/lua/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/lua/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/lua/diagnostics.lua b/lua/toolchain/lua/diagnostics.lua
deleted file mode 100644
index 63c06c7..0000000
--- a/lua/toolchain/lua/diagnostics.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.selene,
- }
- end,
-}
diff --git a/lua/toolchain/lua/formatter.lua b/lua/toolchain/lua/formatter.lua
deleted file mode 100644
index d80d040..0000000
--- a/lua/toolchain/lua/formatter.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.formatting.stylua,
- }
- end,
-}
diff --git a/lua/toolchain/lua/init.lua b/lua/toolchain/lua/init.lua
deleted file mode 100644
index cdeb958..0000000
--- a/lua/toolchain/lua/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.lua.requirements'),
- language_servers = require('toolchain.lua.language_server'),
- formatters = require('toolchain.lua.formatter'),
- actions = require('toolchain.lua.actions'),
- diagnostics = require('toolchain.lua.diagnostics'),
- debuggers = require('toolchain.lua.debugger'),
-}
diff --git a/lua/toolchain/lua/language_server.lua b/lua/toolchain/lua/language_server.lua
deleted file mode 100644
index 5ded34e..0000000
--- a/lua/toolchain/lua/language_server.lua
+++ /dev/null
@@ -1,18 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'lua_ls',
- },
- setup = function(lspconfig, capabilities)
- lspconfig.lua_ls.setup({
- capabilities = capabilities,
- settings = {
- Lua = {
- diagnostics = {
- globals = { 'vim' },
- },
- },
- },
- })
- end,
-}
diff --git a/lua/toolchain/lua/plugins.lua b/lua/toolchain/lua/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/lua/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/lua/requirements.lua b/lua/toolchain/lua/requirements.lua
deleted file mode 100644
index 437184c..0000000
--- a/lua/toolchain/lua/requirements.lua
+++ /dev/null
@@ -1,15 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.lua.formatter').plugins),
- table.unpack(require('toolchain.lua.actions').plugins),
- table.unpack(require('toolchain.lua.diagnostics').plugins),
- table.unpack(require('toolchain.lua.debugger').plugins),
- table.unpack(require('toolchain.lua.plugins')),
- },
- highlighters = {
- 'lua',
- 'luadoc',
- },
- language_servers = require('toolchain.lua.language_server').requirements,
-}
diff --git a/lua/toolchain/php.lua b/lua/toolchain/php.lua
new file mode 100644
index 0000000..e0365d1
--- /dev/null
+++ b/lua/toolchain/php.lua
@@ -0,0 +1,29 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('php', 'phpdoc', 'twig')
+
+ T.add_null_ls_module(function(null_ls)
+ return {
+ -- Diagnostics
+ null_ls.builtins.diagnostics.phpstan,
+ null_ls.builtins.diagnostics.phpcs,
+ null_ls.builtins.diagnostics.twigcs,
+ -- Formatter
+ null_ls.builtins.formatting.phpcsfixer.with({
+ prefer_local = 'vendor/bin/php-cs-fixer',
+ args = { 'fix', '--allow-risky=yes', '$FILENAME' },
+ }),
+ }
+ end)
+
+ T.add_lsp_autoinstalls('phpactor', 'twiggy_language_server', 'stimulus_ls')
+ T.add_lsps(function(lspconfig, capabilities)
+ local config = { capabilities = capabilities }
+ lspconfig.phpactor.setup(config)
+ lspconfig.stimulus_ls.setup(config)
+ end)
+end
+
+return M
diff --git a/lua/toolchain/php/actions.lua b/lua/toolchain/php/actions.lua
deleted file mode 100644
index b6fa425..0000000
--- a/lua/toolchain/php/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/php/debugger.lua b/lua/toolchain/php/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/php/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/php/diagnostics.lua b/lua/toolchain/php/diagnostics.lua
deleted file mode 100644
index fcec5f9..0000000
--- a/lua/toolchain/php/diagnostics.lua
+++ /dev/null
@@ -1,11 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.phpstan,
- null_ls.builtins.diagnostics.phpcs,
- null_ls.builtins.diagnostics.twigcs,
- }
- end,
-}
diff --git a/lua/toolchain/php/formatter.lua b/lua/toolchain/php/formatter.lua
deleted file mode 100644
index 390e615..0000000
--- a/lua/toolchain/php/formatter.lua
+++ /dev/null
@@ -1,12 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.formatting.phpcsfixer.with({
- prefer_local = 'vendor/bin/php-cs-fixer',
- args = { 'fix', '--allow-risky=yes', '$FILENAME' },
- }),
- }
- end,
-}
diff --git a/lua/toolchain/php/init.lua b/lua/toolchain/php/init.lua
deleted file mode 100644
index 2edca01..0000000
--- a/lua/toolchain/php/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.php.requirements'),
- language_servers = require('toolchain.php.language_server'),
- formatters = require('toolchain.php.formatter'),
- actions = require('toolchain.php.actions'),
- diagnostics = require('toolchain.php.diagnostics'),
- debuggers = require('toolchain.php.debugger'),
-}
diff --git a/lua/toolchain/php/language_server.lua b/lua/toolchain/php/language_server.lua
deleted file mode 100644
index bfc4abb..0000000
--- a/lua/toolchain/php/language_server.lua
+++ /dev/null
@@ -1,13 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'phpactor',
- 'twiggy_language_server',
- 'stimulus_ls',
- },
- setup = function(lspconfig, capabilities)
- local config = { capabilities = capabilities }
- lspconfig.phpactor.setup(config)
- lspconfig.stimulus_ls.setup(config)
- end,
-}
diff --git a/lua/toolchain/php/plugins.lua b/lua/toolchain/php/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/php/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/php/requirements.lua b/lua/toolchain/php/requirements.lua
deleted file mode 100644
index 469d8c2..0000000
--- a/lua/toolchain/php/requirements.lua
+++ /dev/null
@@ -1,16 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.php.formatter').plugins),
- table.unpack(require('toolchain.php.actions').plugins),
- table.unpack(require('toolchain.php.diagnostics').plugins),
- table.unpack(require('toolchain.php.debugger').plugins),
- table.unpack(require('toolchain.php.plugins')),
- },
- highlighters = {
- 'php',
- 'phpdoc',
- 'twig',
- },
- language_servers = require('toolchain.php.language_server').requirements,
-}
diff --git a/lua/toolchain/scripts.lua b/lua/toolchain/scripts.lua
new file mode 100644
index 0000000..bf4646a
--- /dev/null
+++ b/lua/toolchain/scripts.lua
@@ -0,0 +1,26 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('bash', 'dockerfile', 'make', 'just')
+
+ T.add_null_ls_module(function(null_ls)
+ return {
+ -- Diagnostics
+ null_ls.builtins.diagnostics.actionlint,
+ null_ls.builtins.diagnostics.checkmake,
+ null_ls.builtins.diagnostics.dotenv_linter,
+ -- Formatter
+ null_ls.builtins.formatting.shfmt,
+ null_ls.builtins.formatting.shellharden,
+ }
+ end)
+
+ T.add_lsp_autoinstalls('bashls')
+ T.add_lsps(function(lspconfig, capabilities)
+ local config = { capabilities = capabilities }
+ lspconfig.bashls.setup(config)
+ end)
+end
+
+return M
diff --git a/lua/toolchain/scripts/actions.lua b/lua/toolchain/scripts/actions.lua
deleted file mode 100644
index b6fa425..0000000
--- a/lua/toolchain/scripts/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(_null_ls) return {} end,
-}
diff --git a/lua/toolchain/scripts/debugger.lua b/lua/toolchain/scripts/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/scripts/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/scripts/diagnostics.lua b/lua/toolchain/scripts/diagnostics.lua
deleted file mode 100644
index 4536ffe..0000000
--- a/lua/toolchain/scripts/diagnostics.lua
+++ /dev/null
@@ -1,11 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.actionlint,
- null_ls.builtins.diagnostics.checkmake,
- null_ls.builtins.diagnostics.dotenv_linter,
- }
- end,
-}
diff --git a/lua/toolchain/scripts/formatter.lua b/lua/toolchain/scripts/formatter.lua
deleted file mode 100644
index 641b12d..0000000
--- a/lua/toolchain/scripts/formatter.lua
+++ /dev/null
@@ -1,10 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.formatting.shfmt,
- null_ls.builtins.formatting.shellharden,
- }
- end,
-}
diff --git a/lua/toolchain/scripts/init.lua b/lua/toolchain/scripts/init.lua
deleted file mode 100644
index 42b236c..0000000
--- a/lua/toolchain/scripts/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.scripts.requirements'),
- language_servers = require('toolchain.scripts.language_server'),
- formatters = require('toolchain.scripts.formatter'),
- actions = require('toolchain.scripts.actions'),
- diagnostics = require('toolchain.scripts.diagnostics'),
- debuggers = require('toolchain.scripts.debugger'),
-}
diff --git a/lua/toolchain/scripts/language_server.lua b/lua/toolchain/scripts/language_server.lua
deleted file mode 100644
index 8683d52..0000000
--- a/lua/toolchain/scripts/language_server.lua
+++ /dev/null
@@ -1,10 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'bashls',
- },
- setup = function(lspconfig, capabilities)
- local config = { capabilities = capabilities }
- lspconfig.bashls.setup(config)
- end,
-}
diff --git a/lua/toolchain/scripts/plugins.lua b/lua/toolchain/scripts/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/scripts/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/scripts/requirements.lua b/lua/toolchain/scripts/requirements.lua
deleted file mode 100644
index 3ef696f..0000000
--- a/lua/toolchain/scripts/requirements.lua
+++ /dev/null
@@ -1,17 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.scripts.formatter').plugins),
- table.unpack(require('toolchain.scripts.actions').plugins),
- table.unpack(require('toolchain.scripts.diagnostics').plugins),
- table.unpack(require('toolchain.scripts.debugger').plugins),
- table.unpack(require('toolchain.scripts.plugins')),
- },
- highlighters = {
- 'bash',
- 'make',
- 'just',
- 'dockerfile',
- },
- language_servers = require('toolchain.scripts.language_server').requirements,
-}
diff --git a/lua/toolchain/text/plugins.lua b/lua/toolchain/text.lua
similarity index 54%
rename from lua/toolchain/text/plugins.lua
rename to lua/toolchain/text.lua
index de2ce13..3400356 100644
--- a/lua/toolchain/text/plugins.lua
+++ b/lua/toolchain/text.lua
@@ -1,5 +1,30 @@
-return {
- {
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('markdown')
+
+ T.add_null_ls_module(function(null_ls)
+ return {
+ -- Actions
+ null_ls.builtins.code_actions.proselint,
+ -- Diagnostics
+ null_ls.builtins.diagnostics.alex,
+ null_ls.builtins.diagnostics.codespell,
+ null_ls.builtins.diagnostics.trail_space,
+ -- Formatter
+ null_ls.builtins.diagnostics.markdownlint,
+ }
+ end)
+
+ T.add_lsp_autoinstalls('marksman')
+
+ T.add_lsps(function(lspconfig, capabilities)
+ local config = { capabilities = capabilities }
+ lspconfig.marksman.setup(config)
+ end)
+
+ T.add_plugins({
'mrjones2014/mdpreview.nvim',
ft = 'markdown',
dependencies = {
@@ -32,5 +57,7 @@ return {
{ desc = 'Show Markdown Preview' }
)
end,
- },
-}
+ })
+end
+
+return M
diff --git a/lua/toolchain/text/actions.lua b/lua/toolchain/text/actions.lua
deleted file mode 100644
index 7357cdc..0000000
--- a/lua/toolchain/text/actions.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.code_actions.proselint,
- }
- end,
-}
diff --git a/lua/toolchain/text/debugger.lua b/lua/toolchain/text/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/text/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/text/diagnostics.lua b/lua/toolchain/text/diagnostics.lua
deleted file mode 100644
index 69c140e..0000000
--- a/lua/toolchain/text/diagnostics.lua
+++ /dev/null
@@ -1,11 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.alex,
- null_ls.builtins.diagnostics.codespell,
- null_ls.builtins.diagnostics.trail_space,
- }
- end,
-}
diff --git a/lua/toolchain/text/formatter.lua b/lua/toolchain/text/formatter.lua
deleted file mode 100644
index 55aaddc..0000000
--- a/lua/toolchain/text/formatter.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.markdownlint,
- }
- end,
-}
diff --git a/lua/toolchain/text/init.lua b/lua/toolchain/text/init.lua
deleted file mode 100644
index a61c922..0000000
--- a/lua/toolchain/text/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.text.requirements'),
- language_servers = require('toolchain.text.language_server'),
- formatters = require('toolchain.text.formatter'),
- actions = require('toolchain.text.actions'),
- diagnostics = require('toolchain.text.diagnostics'),
- debuggers = require('toolchain.text.debugger'),
-}
diff --git a/lua/toolchain/text/language_server.lua b/lua/toolchain/text/language_server.lua
deleted file mode 100644
index f5a7aa1..0000000
--- a/lua/toolchain/text/language_server.lua
+++ /dev/null
@@ -1,10 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'marksman',
- },
- setup = function(lspconfig, capabilities)
- local config = { capabilities = capabilities }
- lspconfig.marksman.setup(config)
- end,
-}
diff --git a/lua/toolchain/text/requirements.lua b/lua/toolchain/text/requirements.lua
deleted file mode 100644
index 1cca856..0000000
--- a/lua/toolchain/text/requirements.lua
+++ /dev/null
@@ -1,14 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.text.formatter').plugins),
- table.unpack(require('toolchain.text.actions').plugins),
- table.unpack(require('toolchain.text.diagnostics').plugins),
- table.unpack(require('toolchain.text.debugger').plugins),
- table.unpack(require('toolchain.text.plugins')),
- },
- highlighters = {
- 'markdown',
- },
- language_servers = require('toolchain.text.language_server').requirements,
-}
diff --git a/lua/toolchain/web.lua b/lua/toolchain/web.lua
new file mode 100644
index 0000000..a836888
--- /dev/null
+++ b/lua/toolchain/web.lua
@@ -0,0 +1,31 @@
+local T = require('toolchain')
+local M = {}
+
+M.setup = function()
+ T.add_highlighter_autoinstalls('html', 'css', 'scss', 'javascript', 'typescript')
+
+ T.add_null_ls_module(function(null_ls)
+ return {
+ -- Diagnostics
+ null_ls.builtins.diagnostics.stylelint,
+ -- Formatter
+ null_ls.builtins.formatting.prettier.with({
+ command = 'prettierd',
+ }),
+ }
+ end)
+
+ T.add_lsp_autoinstalls('html', 'emmet_ls', 'cssls', 'tailwindcss', 'eslint', 'tsserver')
+
+ T.add_lsps(function(lspconfig, capabilities)
+ local config = { capabilities = capabilities }
+ lspconfig.html.setup(config)
+ lspconfig.emmet_ls.setup(config)
+ lspconfig.cssls.setup(config)
+ lspconfig.tailwindcss.setup(config)
+ lspconfig.tsserver.setup(config)
+ lspconfig.eslint.setup(config)
+ end)
+end
+
+return M
diff --git a/lua/toolchain/web/actions.lua b/lua/toolchain/web/actions.lua
deleted file mode 100644
index b3d7c92..0000000
--- a/lua/toolchain/web/actions.lua
+++ /dev/null
@@ -1,5 +0,0 @@
----@type ToolchainActions
-return {
- plugins = {},
- setup = function(null_ls) return {} end,
-}
diff --git a/lua/toolchain/web/debugger.lua b/lua/toolchain/web/debugger.lua
deleted file mode 100644
index 0193251..0000000
--- a/lua/toolchain/web/debugger.lua
+++ /dev/null
@@ -1,4 +0,0 @@
----@type ToolchainDebuggers
-return {
- plugins = {},
-}
diff --git a/lua/toolchain/web/diagnostics.lua b/lua/toolchain/web/diagnostics.lua
deleted file mode 100644
index 9d9073d..0000000
--- a/lua/toolchain/web/diagnostics.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type ToolchainDiagnostics
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.diagnostics.stylelint,
- }
- end,
-}
diff --git a/lua/toolchain/web/formatter.lua b/lua/toolchain/web/formatter.lua
deleted file mode 100644
index 5d54b94..0000000
--- a/lua/toolchain/web/formatter.lua
+++ /dev/null
@@ -1,11 +0,0 @@
----@type ToolchainFormatters
-return {
- plugins = {},
- setup = function(null_ls)
- return {
- null_ls.builtins.formatting.prettier.with({
- command = 'prettierd',
- }),
- }
- end,
-}
diff --git a/lua/toolchain/web/init.lua b/lua/toolchain/web/init.lua
deleted file mode 100644
index 77bd1ac..0000000
--- a/lua/toolchain/web/init.lua
+++ /dev/null
@@ -1,9 +0,0 @@
----@type Toolchain
-return {
- requirements = require('toolchain.web.requirements'),
- language_servers = require('toolchain.web.language_server'),
- formatters = require('toolchain.web.formatter'),
- actions = require('toolchain.web.actions'),
- diagnostics = require('toolchain.web.diagnostics'),
- debuggers = require('toolchain.web.debugger'),
-}
diff --git a/lua/toolchain/web/language_server.lua b/lua/toolchain/web/language_server.lua
deleted file mode 100644
index 5af59f1..0000000
--- a/lua/toolchain/web/language_server.lua
+++ /dev/null
@@ -1,20 +0,0 @@
----@type ToolchainLanguageServers
-return {
- requirements = {
- 'html',
- 'emmet_ls',
- 'cssls',
- 'tailwindcss',
- 'eslint',
- 'tsserver',
- },
- setup = function(lspconfig, capabilities)
- local config = { capabilities = capabilities }
- lspconfig.html.setup(config)
- lspconfig.emmet_ls.setup(config)
- lspconfig.cssls.setup(config)
- lspconfig.tailwindcss.setup(config)
- lspconfig.tsserver.setup(config)
- lspconfig.eslint.setup(config)
- end,
-}
diff --git a/lua/toolchain/web/plugins.lua b/lua/toolchain/web/plugins.lua
deleted file mode 100644
index a564707..0000000
--- a/lua/toolchain/web/plugins.lua
+++ /dev/null
@@ -1 +0,0 @@
-return {}
diff --git a/lua/toolchain/web/requirements.lua b/lua/toolchain/web/requirements.lua
deleted file mode 100644
index 956f9d1..0000000
--- a/lua/toolchain/web/requirements.lua
+++ /dev/null
@@ -1,18 +0,0 @@
----@type ToolchainRequirements
-return {
- plugins = {
- table.unpack(require('toolchain.web.formatter').plugins),
- table.unpack(require('toolchain.web.actions').plugins),
- table.unpack(require('toolchain.web.diagnostics').plugins),
- table.unpack(require('toolchain.web.debugger').plugins),
- table.unpack(require('toolchain.web.plugins')),
- },
- highlighters = {
- 'html',
- 'css',
- 'scss',
- 'javascript',
- 'typescript',
- },
- language_servers = require('toolchain.web.language_server').requirements,
-}