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

gitlab_duo

plugins.lsp.servers.gitlab_duo.enable

Whether to enable GitLab Duo Language Server Configuration for Neovim https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp The GitLab LSP enables any editor or IDE to integrate with GitLab Duo for AI-powered code suggestions via the Language Server Protocol. Prerequisites: - Node.js and npm installed - GitLab account with Duo Pro license - Internet connection for OAuth device flow Setup: 1. Run :LspGitLabDuoSignIn to start OAuth authentication 2. Follow the browser prompts to authorize 3. Enable inline completion in LspAttach event (see example below) Inline Completion Example:

vim.api.nvim_create_autocmd('LspAttach', {
  callback = function(args)
    local bufnr = args.buf
    local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
    if vim.lsp.inline_completion and
       client:supports_method(vim.lsp.protocol.Methods.textDocument_inlineCompletion, bufnr) then
      vim.lsp.inline_completion.enable(true, { bufnr = bufnr })
      -- Tab to accept suggestion
      vim.keymap.set('i', '<Tab>', function()
        if vim.lsp.inline_completion.is_visible() then
          return vim.lsp.inline_completion.accept()
        else
          return '<Tab>'
        end
      end, { expr = true, buffer = bufnr, desc = 'GitLab Duo: Accept suggestion' })
      -- Alt/Option+[ for previous suggestion
      vim.keymap.set('i', '<M-[>', vim.lsp.inline_completion.select_prev,
        { buffer = bufnr, desc = 'GitLab Duo: Previous suggestion' })
      -- Alt/Option+] for next suggestion
      vim.keymap.set('i', '<M-]>', vim.lsp.inline_completion.select_next,
        { buffer = bufnr, desc = 'GitLab Duo: Next suggestion' })
    end
  end
})
```.

Type: boolean

Default: false

Example: true

Declared by:

plugins.lsp.servers.gitlab_duo.package

Package to use for gitlab_duo. Nixpkgs does not include this package, and as such an external derivation or null must be provided.

Type: null or package

Default: No package, throws when undefined

Declared by:

plugins.lsp.servers.gitlab_duo.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.gitlab_duo.autostart

Controls if the FileType autocommand that launches a language server is created. If false, allows for deferring language servers until manually launched with :LspStart (|lspconfig-commands|).

Type: null or boolean or raw lua code

Default: null

Plugin default: true

Declared by:

plugins.lsp.servers.gitlab_duo.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.gitlab_duo.extraOptions

Extra options for the gitlab_duo language server.

Type: attribute set of anything

Default: { }

Declared by:

plugins.lsp.servers.gitlab_duo.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.gitlab_duo.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.gitlab_duo.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: