From 41faa29b766af3aee3803586f50b67f7c4ccebdc Mon Sep 17 00:00:00 2001 From: Amy Qualls Date: Mon, 19 Aug 2024 10:38:23 -0700 Subject: [PATCH 1/4] Stub out Vim auto-command section I want to move this here, but I don't know what it does. Let's copy over the basic info, and seek answers from the engineer. --- doc/editor_extensions/neovim/index.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/editor_extensions/neovim/index.md b/doc/editor_extensions/neovim/index.md index b92c1851355603..e6467cf6f85fc5 100644 --- a/doc/editor_extensions/neovim/index.md +++ b/doc/editor_extensions/neovim/index.md @@ -132,6 +132,15 @@ you must include your own key mapping that references it: vim.keymap.set('n', '', '(GitLabToggleCodeSuggestions)') ``` +### Configure Vim auto-commands + +For your convenience, this plugin provides Vim auto-commands to start the +LSP integration for some supported file types. For example, Ruby is a supported +language, so the plugin adds a `FileType ruby` auto-command. + +You can configure this behavior for additional file types with the +`code_suggestions.auto_filetypes` setup option. + ## Report issues with the extension Report any issues, bugs, or feature requests in the -- GitLab From 99583d05d2f442b8b5a14c3a9a5a1ce837467076 Mon Sep 17 00:00:00 2001 From: Amy Qualls Date: Thu, 22 Aug 2024 16:51:54 -0700 Subject: [PATCH 2/4] Revisions based on technical reviews Let's make these instructions a bit better. I got a better explanation of what one of these things was, too. --- doc/editor_extensions/neovim/index.md | 67 +++++++++++++++------------ 1 file changed, 37 insertions(+), 30 deletions(-) diff --git a/doc/editor_extensions/neovim/index.md b/doc/editor_extensions/neovim/index.md index e6467cf6f85fc5..97bdd91178e823 100644 --- a/doc/editor_extensions/neovim/index.md +++ b/doc/editor_extensions/neovim/index.md @@ -28,11 +28,7 @@ Prerequisites: - The GitLab Duo Code Suggestions feature requires GitLab version 16.8 or later. - You have [Neovim](https://neovim.io/) version 0.9 or later. -To install the extension: - -1. Follow the installation steps for your chosen plugin manager. -1. Optional. Configure GitLab Duo Code Suggestions as an Omni Completion provider. -1. Set up helptags using `:helptags ALL` for access to [`:help gitlab.txt`](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/doc/gitlab.txt). +To install the extension, follow the installation steps for your chosen plugin manager: ::Tabs @@ -85,25 +81,32 @@ use { ## Configure the extension -These environment variables are frequently used with the extension. For a full list, see this plugin's help text -at [`doc/gitlab.txt`](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/doc/gitlab.txt). +1. Configure environment variables. While these are the most common, a full list is available in this + plugin's help text at [`doc/gitlab.txt`](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/doc/gitlab.txt): -| Environment variable | Default | Description | -|----------------------|----------------------|-------------| -| `GITLAB_TOKEN`. | n/a | The default GitLab personal access token to use for authenticated requests. If provided, skips interactive authentication. | -| `GITLAB_VIM_URL`. | `https://gitlab.com` | Override the GitLab instance to connect with. Defaults to `https://gitlab.com`. | + | Environment variable | Default | Description | + |----------------------|----------------------|-------------| + | `GITLAB_TOKEN`. | not applicable | The default GitLab personal access token to use for authenticated requests. If provided, skips interactive authentication. | + | `GITLAB_VIM_URL`. | `https://gitlab.com` | Override the GitLab instance to connect with. Defaults to `https://gitlab.com`. | -This plugin enables `gitlab.statusline` by default, which hooks into the built-in `statusline` -to show the status of the Code Suggestions integration. To disable `gitlab.statusline`, -add this to your configuration: +1. Configure your desired file types. For example, because this plugin supports Ruby, it adds a `FileType ruby` auto-command. + To configure this behavior for additional file types, add more file types to the `code_suggestions.auto_filetypes` setup option: -```lua -require('gitlab').setup({ - statusline = { - enabled = false - } -}) -``` + ```lua + require('gitlab').setup({ + statusline = { + enabled = false + }, + code_suggestions = { + auto_filetypes = { 'ruby', 'javascript' }, -- Default is { 'ruby' } + } + }) + ``` + +1. Optional. [Configure Omni Completion](#configure-omni-completion). +1. Optional. [Configure `` key mappings](#configure-plug-key-mappings). +1. Optional. Set up helptags using `:helptags ALL` for access to + [`:help gitlab.txt`](https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/doc/gitlab.txt). ### Configure Omni Completion @@ -112,15 +115,14 @@ with Code Suggestions: 1. Create a [personal access token](../../user/profile/personal_access_tokens.md#create-a-personal-access-token) with the `api` scope. 1. Install the Code Suggestions [language server](https://gitlab.com/gitlab-org/editor-extensions/gitlab-lsp). - 1. Optional. Consider configuring Omni Completion's dialog even for a single suggestion: ```lua vim.o.completeopt = 'menu,menuone' ``` -When working in a supported file type, press Ctrl+x -then Ctrl+o to open the Omni Completion menu. +When working in a supported file type, open the Omni Completion menu by pressing Ctrl+x +then Ctrl+o. ### Configure `` key mappings @@ -132,14 +134,19 @@ you must include your own key mapping that references it: vim.keymap.set('n', '', '(GitLabToggleCodeSuggestions)') ``` -### Configure Vim auto-commands +### Disable `gitlab.statusline` -For your convenience, this plugin provides Vim auto-commands to start the -LSP integration for some supported file types. For example, Ruby is a supported -language, so the plugin adds a `FileType ruby` auto-command. +By default, this plugin enables `gitlab.statusline` by default, which uses the built-in `statusline` +to show the status of the Code Suggestions integration. If you want to disable `gitlab.statusline`, +add this to your configuration: -You can configure this behavior for additional file types with the -`code_suggestions.auto_filetypes` setup option. +```lua +require('gitlab').setup({ + statusline = { + enabled = false + } +}) +``` ## Report issues with the extension -- GitLab From a5c9a858ee08d0781ecbc782848cebe26d13b425 Mon Sep 17 00:00:00 2001 From: Amy Qualls Date: Fri, 23 Aug 2024 19:03:44 +0000 Subject: [PATCH 3/4] Apply 1 suggestion(s) to 1 file(s) --- doc/editor_extensions/neovim/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/editor_extensions/neovim/index.md b/doc/editor_extensions/neovim/index.md index 97bdd91178e823..c8b09735533708 100644 --- a/doc/editor_extensions/neovim/index.md +++ b/doc/editor_extensions/neovim/index.md @@ -98,6 +98,8 @@ use { enabled = false }, code_suggestions = { + # For the full list of default languages, see the 'auto_filetypes' array in + # https://gitlab.com/gitlab-org/editor-extensions/gitlab.vim/-/blob/main/lua/gitlab/config/defaults.lua auto_filetypes = { 'ruby', 'javascript' }, -- Default is { 'ruby' } } }) -- GitLab From 4aff7c47a32f5cf4159beae8bb910f9d47f1db67 Mon Sep 17 00:00:00 2001 From: Amy Qualls Date: Fri, 23 Aug 2024 20:55:25 +0000 Subject: [PATCH 4/4] Apply 1 suggestion(s) to 1 file(s) Co-authored-by: Phillip Wells --- doc/editor_extensions/neovim/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/editor_extensions/neovim/index.md b/doc/editor_extensions/neovim/index.md index c8b09735533708..cfef0ab701af4c 100644 --- a/doc/editor_extensions/neovim/index.md +++ b/doc/editor_extensions/neovim/index.md @@ -138,7 +138,7 @@ vim.keymap.set('n', '', '(GitLabToggleCodeSuggestions)') ### Disable `gitlab.statusline` -By default, this plugin enables `gitlab.statusline` by default, which uses the built-in `statusline` +By default, this plugin enables `gitlab.statusline`, which uses the built-in `statusline` to show the status of the Code Suggestions integration. If you want to disable `gitlab.statusline`, add this to your configuration: -- GitLab