Support using the Language Server in the Web IDE

MR: Pending

Description

When integrating a Language Server (LS) into the Workflow extension, the extension has to send an access token to LS so the LS can make API requests for code suggestions. However, the VSCode Workflow Extension in the Web IDE doesn't have a token available, so it can't authenticate the request.

VSCode sandboxes the worker environment, so it won't be able to access the cookie on GitLab page.

The goal of this issue is identifying and fulfilling the requirements to run the Language Server in the Web IDE. In particular, we need to provide authentication credentials to the LS via an OAuth access token.

Acceptance Criteria

  • The Web IDE uses the Language Server to provide code suggestions or streaming.

Blockers

The blockers are listed as blockers in the "Linked items" list of the issue.

Technical Requirements

  • Troubleshoot the following error that happens when the Language Server initializes

    main.js:2123 Uncaught (in promise) DOMException: Failed to execute 'postMessage' on 'Worker': save(){return n.r()} could not be cloned.
    	at uS.write (http://localhost:8000/web-ide/public/vscode/extensions/gitlab-vscode-extension/browser.js#vscode-extension:56:17065)
    	at Object.sendNotification (http://localhost:8000/web-ide/public/vscode/extensions/gitlab-vscode-extension/browser.js#vscode-extension:56:2000)
    	at $D.sendNotification (http://localhost:8000/web-ide/public/vscode/extensions/gitlab-vscode-extension/browser.js#vscode-extension:155:106205)
    	at async R.eval [as value] (http://localhost:8000/web-ide/public/vscode/extensions/gitlab-vscode-extension/browser.js#vscode-extension:303:11848)
    workbench.web.main.js:748 Client GitLab Language Server: connection to server is erroring. Failed to execute 'postMessage' on 'Worker': save(){return n.r()} could not be cloned.

Impact Assessment

  • The legacy code suggestions implementation located in the VSCode Workflow Extension could be removed.
  • The Web IDE will have the latest features implemented for GitLab Duo code suggestions and streaming.
Edited by Enrique Alcántara