refactor: add state manager to LS suggestions + react to enabled
Description
This MR adds state manager to the LS integration. It also introduces a middleware that:
- prevents "standard" completion requests from being sent at all
- prevents inline completion requests from being sent if the code suggestions are disabled
What is left to implement after this MR:
- tracking loading and error states
- introduce a "no account" state
Related Issues
Resolves #1088 (closed)
Partially implements: #1052 (closed)
How has this been tested?
-
Disable code suggestions in your settings and make sure you use the LS implementation
{ "gitlab.aiAssistedCodeSuggestions.enabled": false, "gitlab.featureFlags.languageServer":true, }
-
See that suggestions are disabled in the status bar
-
Click the status bar icon
-
Click the status bar icon again
-
Click again to enable
-
Go to a JSON file
-
Go to JS file and type something in
- see suggestions coming in
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