diff --git a/.luarc.json b/.luarc.json new file mode 100644 index 0000000..5d723fd --- /dev/null +++ b/.luarc.json @@ -0,0 +1,42 @@ +{ + "workspace": { + "library": [ + "/Users/petersheehan/.local/share/peter.nvim/lazy/3rd-party.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/SchemaStore.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/blink.cmp/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/conform.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/diffview.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/flash.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/haskell-tools.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/kanagawa.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/lazy.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mason.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.ai/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.align/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.icons/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.surround/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/neogit/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-ansible/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-autopairs/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-lint/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-treesitter/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-treesitter-textobjects/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/oil.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/plenary.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/snacks.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/vim-matchup/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/which-key.nvim/lua", + "/opt/homebrew/Cellar/neovim/0.11.4/share/nvim/runtime/lua", + "/Users/petersheehan/.config/peter.nvim/lua", + "$HOME/LLS_Addons/luvit-meta" + ], + "ignoreDir": ["/lua", "./temp"], + "checkThirdParty": false + }, + "runtime": { + "version": "LuaJIT", + "path": ["?.lua", "?/init.lua"], + "pathStrict": true + }, + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/refs/heads/master/setting/schema.json" +} diff --git a/after/lsp/emmylua_ls.lua b/after/lsp/emmylua_ls.lua new file mode 100644 index 0000000..4b78065 --- /dev/null +++ b/after/lsp/emmylua_ls.lua @@ -0,0 +1,5 @@ +return { + cmd = { "emmylua_ls" }, + filetypes = { "lua" }, + root_markers = { ".luarc.json" }, +} diff --git a/gen-luarc.lua b/gen-luarc.lua new file mode 100644 index 0000000..33ad161 --- /dev/null +++ b/gen-luarc.lua @@ -0,0 +1,76 @@ +local uv = vim.uv +local fn = vim.fn + +local lazy_path = fn.stdpath("data") .. "/lazy" +local output_file = fn.stdpath("config") .. "/generated.luarc.json" + +local function is_dir(path) + local stat = uv.fs_stat(path) + return stat and stat.type == "directory" +end + +local function scan_lazy_plugins() + local libraries = {} + + local handle = uv.fs_scandir(lazy_path) + if not handle then + print("Could not scan lazy directory: " .. lazy_path) + return libraries + end + + while true do + local name, type = uv.fs_scandir_next(handle) + if not name then + break + end + + if type == "directory" then + local lua_dir = lazy_path .. "/" .. name .. "/lua" + if is_dir(lua_dir) then + table.insert(libraries, lua_dir) + end + end + end + + return libraries +end + +local function generate_config() + local libraries = scan_lazy_plugins() + + vim.list_extend(libraries, { + "/opt/homebrew/Cellar/neovim/0.11.4/share/nvim/runtime/lua", + "/Users/petersheehan/.config/peter.nvim/lua", + -- "${3rd}/luv/library", + "$HOME/LLS_Addons/luvit-meta", + }) + + local config = { + ["$schema"] = "https://raw.githubusercontent.com/LuaLS/vscode-lua/refs/heads/master/setting/schema.json", + runtime = { + path = { "?.lua", "?/init.lua" }, + pathStrict = true, + version = "LuaJIT", + }, + workspace = { + checkThirdParty = false, + ignoreDir = { "/lua", "./temp" }, + library = libraries, + }, + } + + local json = fn.json_encode(config) + + local file = io.open(output_file, "w") + if not file then + print("Failed to open output file: " .. output_file) + return + end + + file:write(json) + file:close() + + print("Generated LuaLS config at: " .. output_file) +end + +generate_config() diff --git a/generated.luarc.json b/generated.luarc.json new file mode 100644 index 0000000..5d723fd --- /dev/null +++ b/generated.luarc.json @@ -0,0 +1,42 @@ +{ + "workspace": { + "library": [ + "/Users/petersheehan/.local/share/peter.nvim/lazy/3rd-party.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/SchemaStore.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/blink.cmp/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/conform.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/diffview.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/flash.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/haskell-tools.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/kanagawa.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/lazy.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mason.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.ai/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.align/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.icons/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/mini.surround/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/neogit/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-ansible/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-autopairs/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-lint/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-treesitter/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/nvim-treesitter-textobjects/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/oil.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/plenary.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/snacks.nvim/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/vim-matchup/lua", + "/Users/petersheehan/.local/share/peter.nvim/lazy/which-key.nvim/lua", + "/opt/homebrew/Cellar/neovim/0.11.4/share/nvim/runtime/lua", + "/Users/petersheehan/.config/peter.nvim/lua", + "$HOME/LLS_Addons/luvit-meta" + ], + "ignoreDir": ["/lua", "./temp"], + "checkThirdParty": false + }, + "runtime": { + "version": "LuaJIT", + "path": ["?.lua", "?/init.lua"], + "pathStrict": true + }, + "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/refs/heads/master/setting/schema.json" +} diff --git a/lazy-lock.json b/lazy-lock.json index 9061cc3..0c818c0 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -8,7 +8,6 @@ "haskell-tools.nvim": { "branch": "master", "commit": "d223712c767011350ed887c3152da4955d9b1457" }, "kanagawa.nvim": { "branch": "master", "commit": "aef7f5cec0a40dbe7f3304214850c472e2264b10" }, "lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" }, - "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, "mini.ai": { "branch": "main", "commit": "b0247752cf629ce7c6bd0a1efd82fb58ff60f9d6" }, "mini.align": { "branch": "main", "commit": "94a80efd1979839121bf011c856acb0459598433" }, @@ -18,7 +17,6 @@ "nvim-ansible": { "branch": "main", "commit": "c7f595d568b588942d4d0c37b5cd6cae3764a148" }, "nvim-autopairs": { "branch": "master", "commit": "59bce2eef357189c3305e25bc6dd2d138c1683f5" }, "nvim-lint": { "branch": "master", "commit": "486474c2ace8d78d28995074dbdbe29011bc63d0" }, - "nvim-lspconfig": { "branch": "master", "commit": "44acfe887d4056f704ccc4f17513ed41c9e2b2e6" }, "nvim-treesitter": { "branch": "main", "commit": "ecdae44baefeffceade8b0c752d80ececad28e76" }, "nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" }, "oil.nvim": { "branch": "master", "commit": "f55b25e493a7df76371cfadd0ded5004cb9cd48a" }, diff --git a/lua/peter/languages/lua.lua b/lua/peter/languages/lua.lua index 7bb0a43..a42e6f6 100644 --- a/lua/peter/languages/lua.lua +++ b/lua/peter/languages/lua.lua @@ -2,7 +2,8 @@ ---@type peter.lang.Config return { - lsp = { "lua_ls" }, + -- lsp = { "lua_ls" }, + lsp = { "emmylua_ls" }, plugins = { treesitter = { "lua", "luadoc" }, diff --git a/lua/peter/plugins/lsp/lazydev.lua b/lua/peter/plugins/lsp/lazydev.lua index ed80a79..b703aa2 100644 --- a/lua/peter/plugins/lsp/lazydev.lua +++ b/lua/peter/plugins/lsp/lazydev.lua @@ -14,6 +14,10 @@ local P = require("peter.util.plugins.plugins") +if true then + return {} +end + ---@type LazyPluginSpec[] return { { diff --git a/lua/peter/plugins/lsp/lspconfig.lua b/lua/peter/plugins/lsp/lspconfig.lua index 2942906..ed8bd49 100644 --- a/lua/peter/plugins/lsp/lspconfig.lua +++ b/lua/peter/plugins/lsp/lspconfig.lua @@ -2,7 +2,9 @@ -- Community-maintained LSP configs. -- See 'https://github.com/neovim/nvim-lspconfig'. - +if true then + return {} +end ---@type LazyPluginSpec[] return { {