Skip to content
代码片段 群组 项目
代码所有者
将用户和群组指定为特定文件更改的核准人。 了解更多。
stage: Create
group: Code Creation
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments

Code Suggestions development guidelines

Code Suggestions development setup

The recommended setup for locally developing and debugging Code Suggestions is to have all 3 different components running:

  • IDE Extension (e.g. VSCode Extension)
  • Main application configured correctly
  • Model gateway

This should enable everyone to see locally any change in an IDE being sent to the main application transformed to a prompt which is then sent to the respective model.

Setup instructions

  1. Install and run locally the VSCode Extension
    1. Add the "gitlab.debug": true, info to the Code Suggestions development config
      1. In VSCode navigate to the Extensions page and find "GitLab Workflow" in the list
      2. Open the extension settings by clicking a small cog icon and select "Extension Settings" option
      3. Check a "GitLab: Debug" checkbox.
  2. Main Application
    1. Enable Feature Flags code_suggestions_completion_api and code_suggestions_tokens_api
      1. In your terminal, navigate to a gitlab inside your gitlab-development-kit directory
      2. Run bundle exec rails c to start a Rails console
      3. Call Feature.enable(:code_suggestions_completion_api) and Feature.enable(:code_suggestions_tokens_api) from the console
    2. Run the GDK with export CODE_SUGGESTIONS_BASE_URL=http://localhost:5052
  3. Setup Model Gateway
    1. Build tree sitter libraries poetry run scripts/build-tree-sitter-lib.py
    2. Extra .env Changes for all debugging insights
      1. LOG_LEVEL=DEBUG
      2. LOG_FORMAT_JSON=false
      3. LOG_TO_FILE=true
    3. Watch the new log file modelgateway_debug.log , e.g. tail -f modelgateway_debug.log | fblog -a prefix -a suffix -a current_file_name -a suggestion -a language -a input -a parameters -a score -a exception