Sublime Forum

Support for GitLab Code Suggestions

#1

GitLab is rolling out a feature called “Code Suggestions” to help programmers be more lazy. Or as they spin it, “Use Code Suggestions to write code more efficiently by viewing code suggestions as you type.” https://docs.gitlab.com/ee/user/project/repository/code_suggestions.html

As a programmer, I support this goal.

Currently, they only support VS Code. Is adding GitLab Code Suggestions support for Sublime Text on any roadmap?

They’ll need to pry my Sublime editor from my cold, dead fingers…although that feature would be pretty tempting.

1 Like

#2

Isn’t this the same as LSP-copilot?

0 Likes

#3

Copilot takes money.

Although, GitLab implies it may take money in the future too.

Code Suggestions is now available on GitLab.com for all users for free while the feature is in Beta.


You probably also ask GitLab how’s their attitude about making an official plugin for ST.

0 Likes

#4

Support looks like it would be relatively straight forward. They don’t require any agent or library like LSP-copilot does. It is just using normal HTTP requests to https://codesuggestions.gitlab.com/v2/completions with a simple payload like the below. So implementing a plugin that can leverage this should be fairly straight forward. Basically everything you need is below in code snippets

Authorization: `Bearer ${gitlabApiKey}`,
      'Content-Type': 'application/json'

{
      prompt_version: 1,
      project_path: projectPath,
      project_id: projectId,
      current_file: {
        file_name: fileName,
        content_above_cursor: contentAboveCursor,
        content_below_cursor: contentBelowCursor,
      },
    }
(
      response.choices
        ?.map(choice => choice.text)
        .map(
          choiceText =>
            new vscode.InlineCompletionItem(
              choiceText as string,
              new vscode.Range(position, position),
            ),
        ) || []
    )
1 Like