Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

emmylua_ls

URL: https://github.com/EmmyLuaLs/emmylua-analyzer-rust

plugins.lsp.servers.emmylua_ls.enable

Whether to enable https://github.com/EmmyLuaLs/emmylua-analyzer-rust EmmyluaLs, a language server for Lua. emmylua_ls can be installed using cargo by following the instructions. The default cmd assumes that the emmylua_ls binary can be found in $PATH. You may want to symlink to the cargo artifact:

ln -s $(pwd)/target/release/emmylua_ls ~/bin/emmylua_ls

See the emmylua_ls configuration guide for settings documentation. If you want completions and analysis for Neovim plugins on your runtime path, try this config:

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),
      },
    },
  },
})
```.

Type: boolean

Default:

false

Example:

true

Declared by:

plugins.lsp.servers.emmylua_ls.package

The emmylua_ls package to use.

Alternatively, emmylua_ls should be installed on your $PATH.

Type: null or package

Default:

pkgs.emmylua-ls

Declared by:

plugins.lsp.servers.emmylua_ls.packageFallback

When enabled, the language server package will be added to the end of the PATH (suffix) instead of the beginning (prefix).

This can be useful if you want local versions of the language server (e.g. from a devshell) to override the Nixvim version.

Type: boolean

Default:

false

Declared by:

plugins.lsp.servers.emmylua_ls.autostart

Whether to call vim.lsp.enable() for emmylua_ls.

Type: boolean

Default:

true

Example:

false

Declared by:

plugins.lsp.servers.emmylua_ls.cmd

A list where each entry corresponds to the blankspace delimited part of the command that launches the server.

The first entry is the binary used to run the language server. Additional entries are passed as arguments.

Type: null or (list of string)

Default: null when package is null, otherwise null

Declared by:

plugins.lsp.servers.emmylua_ls.extraOptions

Extra options for the emmylua_ls language server.

Type: attribute set of anything

Default:

{ }

Declared by:

plugins.lsp.servers.emmylua_ls.filetypes

Set of filetypes for which to attempt to resolve {root_dir}. May be empty, or server may specify a default value.

Type: null or (list of string)

Default:

null

Declared by:

plugins.lsp.servers.emmylua_ls.rootMarkers

A list of files that mark the root of the project/workspace.

Vim’s LSP will try to share the same language server instance for all buffers matching filetypes within the same project.

A new server instance is only spawned when opening a buffer with a different project root.

See :h lsp-config and :h vim.fs.root().

Type: null or (list of (string or raw lua code)) or raw lua code

Default: null

Plugin default: null

Declared by:

plugins.lsp.servers.emmylua_ls.settings

The settings for this LSP.

Type: open submodule of attribute set of lua value

Default:

{ }

Example:

{
  callback = lib.nixvim.mkRaw ''
  function()
    print('nixvim')
  end
'';
  foo_bar = 42;
  hostname = "localhost:8080";
}

Declared by: