diff options
| author | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2026-05-14 20:31:06 +0000 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2026-05-14 20:31:06 +0000 |
| commit | 5bcf12f97a9393c0fbf683ee921138f4837e8cd2 (patch) | |
| tree | c0f2e6ae8b3857e92beaa8c420788abb24222d09 | |
| parent | docs(emmylua_ls): fix docstring #4428 (diff) | |
| download | nvim-lspconfig-5bcf12f97a9393c0fbf683ee921138f4837e8cd2.tar nvim-lspconfig-5bcf12f97a9393c0fbf683ee921138f4837e8cd2.tar.gz nvim-lspconfig-5bcf12f97a9393c0fbf683ee921138f4837e8cd2.tar.bz2 nvim-lspconfig-5bcf12f97a9393c0fbf683ee921138f4837e8cd2.tar.lz nvim-lspconfig-5bcf12f97a9393c0fbf683ee921138f4837e8cd2.tar.xz nvim-lspconfig-5bcf12f97a9393c0fbf683ee921138f4837e8cd2.tar.zst nvim-lspconfig-5bcf12f97a9393c0fbf683ee921138f4837e8cd2.zip | |
docs: update configs.md
skip-checks: true
| -rw-r--r-- | doc/configs.md | 36 | ||||
| -rw-r--r-- | doc/configs.txt | 34 |
2 files changed, 70 insertions, 0 deletions
diff --git a/doc/configs.md b/doc/configs.md index 7638f989..6d406ac7 100644 --- a/doc/configs.md +++ b/doc/configs.md @@ -4105,6 +4105,42 @@ ln -s $(pwd)/target/release/emmylua_ls ~/bin/emmylua_ls See the emmylua_ls [configuration guide](https://github.com/EmmyLuaLs/emmylua-analyzer-rust/blob/main/docs/config/emmyrc_json_EN.md) for settings documentation. +If you want completions and analysis for Neovim plugins on your runtime path, try this config: + +```lua +vim.lsp.config('emmylua_ls', { + on_init = function(client) + -- If the workspace has its own emmylua_ls/lua_ls config file, defer to it. + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + path ~= vim.fn.stdpath('config') + and (vim.uv.fs_stat(path .. '/.emmyrc.json') or vim.uv.fs_stat(path .. '/.luarc.json')) + then + client.config.settings = {} + end + end + end, + settings = { + emmylua = { + -- Tell the server which Lua you're using (usually LuaJIT, for Neovim). + runtime = { version = 'LuaJIT' }, + diagnostics = { globals = { 'vim' } }, + -- Make the server aware of Neovim runtime files. + workspace = { + library = { + vim.env.VIMRUNTIME, + -- For LSP Settings Type Annotations: https://github.com/neovim/nvim-lspconfig#lsp-settings-type-annotations + vim.api.nvim_get_runtime_file('lua/lspconfig', false)[1], + }, + -- Or pull in all of 'runtimepath'. May be slower! https://github.com/neovim/nvim-lspconfig/issues/3189 + -- library = vim.api.nvim_get_runtime_file('', true), + }, + }, + }, +}) +``` + Snippet to enable the language server: ```lua vim.lsp.enable('emmylua_ls') diff --git a/doc/configs.txt b/doc/configs.txt index bcea626e..5251d832 100644 --- a/doc/configs.txt +++ b/doc/configs.txt @@ -2856,6 +2856,40 @@ You may want to symlink to the cargo artifact:> See the emmylua_ls [configuration guide](https://github.com/EmmyLuaLs/emmylua-analyzer-rust/blob/main/docs/config/emmyrc_json_EN.md) for settings documentation. +If you want completions and analysis for Neovim plugins on your runtime path, try this config: +>lua + vim.lsp.config('emmylua_ls', { + on_init = function(client) + -- If the workspace has its own emmylua_ls/lua_ls config file, defer to it. + if client.workspace_folders then + local path = client.workspace_folders[1].name + if + path ~= vim.fn.stdpath('config') + and (vim.uv.fs_stat(path .. '/.emmyrc.json') or vim.uv.fs_stat(path .. '/.luarc.json')) + then + client.config.settings = {} + end + end + end, + settings = { + emmylua = { + -- Tell the server which Lua you're using (usually LuaJIT, for Neovim). + runtime = { version = 'LuaJIT' }, + diagnostics = { globals = { 'vim' } }, + -- Make the server aware of Neovim runtime files. + workspace = { + library = { + vim.env.VIMRUNTIME, + -- For LSP Settings Type Annotations: https://github.com/neovim/nvim-lspconfig#lsp-settings-type-annotations + vim.api.nvim_get_runtime_file('lua/lspconfig', false)[1], + }, + -- Or pull in all of 'runtimepath'. May be slower! https://github.com/neovim/nvim-lspconfig/issues/3189 + -- library = vim.api.nvim_get_runtime_file('', true), + }, + }, + }, + }) + Snippet to enable the language server: >lua vim.lsp.enable('emmylua_ls') |
