Skip to content

feat: if gitlab.debug is on, show language server stacktraces

Description

This MR lets us initialize the Language Server with --use-source-maps option, which results in readable error stack traces.

This MR works together with the companion LS MR: gitlab-org/editor-extensions/gitlab-lsp!451 (merged)

Related Issues

Resolves gitlab-org/editor-extensions/gitlab-lsp#160 (closed)

How has this been tested?

  1. Checkout the LS MR gitlab-org/editor-extensions/gitlab-lsp!451 (merged)

  2. Add an error to the LS code

    • For example use this patch
    diff --git a/src/common/config_service.ts b/src/common/config_service.ts
    index 5e7ba05..251e023 100644
    --- a/src/common/config_service.ts
    +++ b/src/common/config_service.ts
    @@ -138,6 +138,7 @@ export class DefaultConfigService implements ConfigService {
       }
     
       merge(newConfig: Partial<IConfig>) {
    +    throw new Error('test error on config update');
         mergeWith(this.#config, newConfig, (target, src) => (isArray(target) ? src : undefined));
         this.#triggerChange();
       }
  3. Checkout this MR

  4. Connect LS to VS Code (with the watch mode)

  5. Start VS Code Extension in development mode

  6. See the nice stacktrace in the GitLab Language Server output logs

/Users/tomas/workspace/gl/gitlab-vscode-extension/dist-desktop/assets/src/common/config_service.ts:141
    throw new Error('test error on config update');
          ^
Error: test error on config update
    at jp.merge (/Users/tomas/workspace/gl/gitlab-vscode-extension/dist-desktop/assets/src/common/config_service.ts:141:11)
    at notificationHandler (/Users/tomas/workspace/gl/gitlab-vscode-extension/dist-desktop/assets/src/common/message_handler.ts:253:25)
    at handleNotification (/Users/tomas/workspace/gl/gitlab-vscode-extension/dist-desktop/assets/node_modules/vscode-jsonrpc/lib/common/connection.js:640:25)
    at handleMessage (/Users/tomas/workspace/gl/gitlab-vscode-extension/dist-desktop/assets/node_modules/vscode-jsonrpc/lib/common/connection.js:342:13)
    at processMessageQueue (/Users/tomas/workspace/gl/gitlab-vscode-extension/dist-desktop/assets/node_modules/vscode-jsonrpc/lib/common/connection.js:362:17)
    at Immediate.<anonymous> (/Users/tomas/workspace/gl/gitlab-vscode-extension/dist-desktop/assets/node_modules/vscode-jsonrpc/lib/common/connection.js:334:13)
    at processImmediate (node:internal/timers:478:21)

Screenshots (if appropriate)

What CHANGELOG entry will this MR create?

  • fix: Bug fix fixes - a user-facing issue in production - included in changelog
  • feature: New feature - a user-facing change which adds functionality - included in changelog
  • BREAKING CHANGE: (fix or feature that would cause existing functionality to change) - should bump major version, mentioned in the changelog
  • None - other non-user-facing changes
Edited by Tomas Vik (OOO back on 2024-11-19)

Merge request reports

Loading