Troubleshooting Code Suggestions
DETAILS: Tier: Free, Premium, Ultimate Offering: SaaS, self-managed
When working with GitLab Duo Code Suggestions, you might encounter the following issues.
Code Suggestions are not displayed
If Code Suggestions are not displayed, and you have installed a supported IDE extension, try the following troubleshooting steps.
In GitLab SaaS, ensure Code Suggestions is enabled for at least one top-level group your account belongs to. If you don't have a role that lets you view the top-level group's settings, contact a group owner.
Code Suggestions not displayed in VS Code or GitLab Web IDE
Check all the steps in Code Suggestions are not displayed first.
If you are a self-managed user, ensure that Code Suggestions for the GitLab Web IDE are enabled. The same settings apply to VS Code as local IDE.
- On the left sidebar, select Extensions > GitLab Workflow.
- Select Settings ({settings}), and then select Extension Settings.
- In GitLab > AI Assisted Code Suggestions, select the Enable code completion checkbox.
If the settings are enabled, but Code Suggestions are still not displayed, try the following steps:
- Enable the
Debug
checkbox in the GitLab Workflow Extension Settings. - Open the extension log in View > Output and change the dropdown list to GitLab Workflow as the log filter. The command palette command is
GitLab: Show Extension Logs
. - Disable and re-enable the Enable code completion checkbox.
- Verify that the debug log contains similar output:
2023-07-14T17:29:00:763 [debug]: Disabling code completion
2023-07-14T17:29:01:802 [debug]: Enabling code completion
2023-07-14T17:29:01:802 [debug]: AI Assist: Using server: https://cloud.gitlab.com/ai/v2/code/completions
Code Suggestions not displayed in Microsoft Visual Studio
Check all the steps in Code Suggestions are not displayed first.
- Ensure you have properly set up the extension.
- From the Tools > Options menu, find the GitLab option. Ensure Log Level is set to Debug.
- Open the extension log in View > Output and change the dropdown list to GitLab Extension as the log filter.
- Verify that the debug log contains similar output:
14:48:21:344 GitlabProposalSource.GetCodeSuggestionAsync
14:48:21:344 LsClient.SendTextDocumentCompletionAsync("GitLab.Extension.Test\TestData.cs", 34, 0)
14:48:21:346 LS(55096): time="2023-07-17T14:48:21-05:00" level=info msg="update context"
Authentication troubleshooting
If the above steps do not solve your issue, the problem may be related to the recent changes in authentication, specifically the token system. To resolve the issue:
- Remove the existing personal access token from your GitLab account settings.
- Reauthorize your GitLab account in VS Code using OAuth.
- Test the Code Suggestions feature with different file extensions to verify if the issue is resolved.