Skip to content

refactor: code suggestions state manager handles unsupported language

Tomas Vik requested to merge tv/2023-11/ls-state-management into main

Description

This MR refactors the code suggestions state manager to be the source of truth for whether the active text editor supports the language or not.

The more self-contained the state manager is, the more it is reusable for the Language Server integration.

This MR continues work that refactor: change how we represnt disabled in se... (!1182 - merged) started.

Related Issues

Related to #1052 (closed)

How has this been tested?

(the process is the same as for !1182 (merged))

  1. Disable code suggestions in your settings and make sure you use the non-LS implementation

    {
      "gitlab.aiAssistedCodeSuggestions.enabled": false,
      "gitlab.featureFlags.languageServer":false,
    }
  2. See that suggestions are disabled in the status bar

    • image
  3. Click the status bar icon

    • see that the gitlab.aiAssistedCodeSuggestions.enabled value changed in your settings.json to true
    • see suggestion enabled in you status bar
      • image
  4. Click the status bar icon again

    • see code suggestions were disabled only for this session
    • image
  5. Click again to enable

  6. Go to a JSON file

    • see that the language is unsupported
    • image
  7. Go to JS file and type something in

    • see that the icon changes when the extension loads new suggestions

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
  • Test gap
Edited by Tomas Vik

Merge request reports