[VS Code]: Feature State Diagnostics Section

Problem

In the diagnostics screen, we want to show the user the status of their Duo features. These features are managed in Language Server and the Language Server informs VS Code Extension about the state of the features through StateChecks.

Solution

⚠️ Ideally you would want to do [VS Code]: Clean up redundant policies for code... (#1762 - closed) first, but it's not a hard requirement. But these two issues cannot happen in parallel.

This issue has been closed, see comment here

image

Add the following screen to the diagnostics


## GitLab Duo Code Suggestions (Off)

- [true] User is authenticated
- [true] Code Suggestions are enabled in settings
- [true] Code Suggestions API connection is working
- [true] The GitLab instance version supports Code Suggestions
- [false] Valid GitLab Duo Pro license
- [true] GitLab Duo is enabled for the open project(s)

## GitLab Duo Chat (On)

- [true] User is authenticated
- [true] Chat is enabled in settings
- [true] Valid GitLab Duo Pro license
- [true] GitLab Duo is enabled for the open project(s)

The feature state UI has the following form:

## {Feature name} ({On/Off})
- [{true/false}] {statement about successful state check}

Technical details

This is the most complex screen in the diagnostics.

This describes the POC (please improve the naming if you are implementing this):

The LanguageServerPolicy is now the central point that manages all LS-provided state.

We need to instead promote this state out of the LanguageServerPolicy and into a FeatureStateManager. This manager is the SSOT for all the LS checks.

We need to listen on LS notification and update the FeatureStateManager. That's the job of FeatureStateChangeNotificationHandler.

We then change the LanguageServerPolicy to work on top of the FeatureStateManager

Lastly, we need to render the diagnostics screen with a renderer.

Follow up

💡 It would be nice to do [LS]: Expose all checks through the state check... (gitlab-org/editor-extensions/gitlab-lsp#688 - closed) first, but thanks to the POC, there is not much rework in doing this issue first and [LS]: Expose all checks through the state check... (gitlab-org/editor-extensions/gitlab-lsp#688 - closed) later.

Edited by Dylan Bernardi