feat: Support using web ide in the language server
Description
It addresses almost all the blockers that prevent running the language server and streaming in the Web IDE. The only missing requirement is providing the authentication token to the language server.
What blockers are addressed by this Merge Request?
- It fixes a bug where
Position
andRange
objects are not serialized before sending them to the language server. Initially, I provided a solution that handled these objects in the language server gitlab-org/editor-extensions/gitlab-lsp!199 (closed). This approach is incorrect because I discovered that VSCode'sPosition
andRange
classes use computed properties for likeline
,character
, etc. The correct solution is converting these class-based objects to plain javascript objects. - It sends a
baseAssetsUrl
to the language server. This URL is used to property load Treesitter WASM files.
This Merge Request depends on the language server merge request: gitlab-org/editor-extensions/gitlab-lsp!201 (merged)
Related Issues
Resolves #[issue_number]
How has this been tested?
-
Check out gitlab-org/editor-extensions/gitlab-lsp!201 (merged) in the language server project.
-
Run
npm run bundle && npm link
in the language server project. -
Check out this branch in the web-ide's
gitlab-vscode-workflow
submodule. -
Run
npm link @gitlab-org/gitlab-lsp --save
. -
Create a Personal Access Token in gitlab.com
-
Apply the following patch in the submodule and set your PAT in the empty string
diff --git a/src/common/language_server/language_client_wrapper.ts b/src/common/language_server/language_client_wrapper.ts index 45c8ac8c..8cf07e05 100644 --- a/src/common/language_server/language_client_wrapper.ts +++ b/src/common/language_server/language_client_wrapper.ts @@ -71,7 +71,7 @@ export class LanguageClientWrapper { } const settings: IConfig = { baseUrl: platform.account.instanceUrl, - token: platform.account.token, + token: platform.account.token || '', telemetry: { actions: [{ action: TRACKING_EVENTS.ACCEPTED }], },
-
Run
yarn start:example
-
Use the web ide in
localhost:8000
. -
Enable the following feature flags:
languageServerWebIDE
andstreamCodeGenerations
in the User Settings JSON in the Web IDE. -
Reload the page.
-
Streaming and inline suggestions should work as demonstrated in the video below.
Screenshots (if appropriate):
The following video shows a demo of Streaming and Inline completions working in the Web IDE
language_server_in_web_ide_demo_compressed
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