feat: send client context to the LS
Description
This MR adds the editor and extension information to the LS initialization so the LS can send correct telemetry information.
This MR also refactors the way the extension starts LS. The MR is best-reviewed commit-by-commit.
Related Issues
Resolves #1086 (closed)
How has this been tested?
-
Change the tracking URL here: https://gitlab.com/gitlab-org/gitlab-vscode-extension/blob/1193cc155292b7db284caa1931a2c30d07758a19/src/common/language_server/register_language_server.ts#L79-82
const settings: IConfig = { baseUrl, // TODO: how do we pick the "right" account? ...accounts?.getOneAccountForInstance(baseUrl), telemetry: { trackingUrl: 'http://localhost:9091', }, };
-
Run the snowplow micro (use podman or docker)
podman run --name snowplow-micro --rm -e MICRO_IGLU_REGISTRY_URL="https://gitlab-org.gitlab.io/iglu" -p 127.0.0.1:9091:9090 snowplow/snowplow-micro:latest
-
start the extension in development mode
-
type something to trigger suggestions
-
See the correct context
curl -s "http://127.0.0.1:9091/micro/good" | jq '.[].event.contexts'
{ "schema": "iglu:com.snowplowanalytics.snowplow/contexts/jsonschema/1-0-0", "data": [ { "schema": "iglu:com.gitlab/ide_extension_version/jsonschema/1-1-0", "data": { "ide_name": "Visual Studio Code", "ide_vendor": "Microsoft Corporation", "ide_version": "1.84.0-insider", "extension_name": "GitLab Workflow LS", "extension_version": "3.82.0", "language_server_version": "3.11.0" } }, { "schema": "iglu:com.gitlab/code_suggestions_context/jsonschema/2-1-0", "data": { "suffix_length": 8655, "prefix_length": 809, "gitlab_realm": "saas", "language": null, "user_agent": "code-completions-language-server-experiment (Visual Studio Code - Insiders:1.84.0-insider)" } } ] }
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