Skip to content

Conversation

@liangmiQwQ
Copy link
Contributor

Update the linter client enabling status after config changing

@liangmiQwQ liangmiQwQ requested a review from camc314 as a code owner November 26, 2025 13:36
@graphite-app
Copy link
Contributor

graphite-app bot commented Nov 26, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot added A-editor Area - Editor and Language Server C-enhancement Category - New feature or request labels Nov 26, 2025
@liangmiQwQ liangmiQwQ force-pushed the fix-vscode/stop-client-while-enabling-changes branch from bb7d187 to e0a08fe Compare November 26, 2025 13:46
@liangmiQwQ
Copy link
Contributor Author

Oh, the test failed, but I don't know if it is related to this change because the most errors are about the vscode commends and I didn't change them

@liangmiQwQ liangmiQwQ marked this pull request as draft November 26, 2025 13:52
@Sysix
Copy link
Member

Sysix commented Nov 26, 2025

@liangmiQwQ you are toggling the client even if another configuration is effected. You need to check it the key is effected, here an example with a lsp configuration:

public effectsConfigChange(event: ConfigurationChangeEvent): boolean {
if (event.affectsConfiguration(`${ConfigService.namespace}.configPath`, this.workspace)) {
return true;
}

@liangmiQwQ liangmiQwQ force-pushed the fix-vscode/stop-client-while-enabling-changes branch from e0a08fe to c19a1df Compare November 26, 2025 21:58
@liangmiQwQ
Copy link
Contributor Author

Updated! Thanks for the guidance. but I'm not sure if it changes its behavior because toggleClient actually just updates the client state based on the enabled settings in the vsconfig, so if we call it when other configs change, it has no effect to the client

As for the test, I tried locally on the main branch, and it seems to be failed as well, I guess there are something different between the test snapshot and the oxfmt latest output, anyway this is outside the scope of this PR.

> [email protected] test /Users/liangmi/code/voidzero/oxc/editors/vscode
> cross-env TEST=true pnpm run compile && vscode-test


> [email protected] compile /Users/liangmi/code/voidzero/oxc/editors/vscode
> rolldown -c rolldown.config.ts

✔ Validated version: 1.106.3
✔ Found existing install in /Users/liangmi/code/voidzero/oxc/editors/vscode/.vscode-test/vscode-darwin-arm64-1.106.3
[main 2025-11-26T22:07:55.097Z] update#setState disabled
[main 2025-11-26T22:07:55.097Z] update#ctor - updates are disabled by the environment
ChatSessionStore: Migrating 0 chat sessions from storage service to file system
Started local extension host with pid 61935.
Loading development extension at /Users/liangmi/code/voidzero/oxc/editors/vscode
MCP Registry configured: https://api.mcp.github.com
Settings Sync: Account status changed from uninitialized to unavailable

  runExecutable
    ✔ should create Node.js executable for .js files
    ✔ should create Node.js executable for .cjs files
    ✔ should create Node.js executable for .mjs files
    ✔ should create binary executable for non-Node files
    ✔ should use shell on Windows for binary executables
    ✔ should prepend nodePath to PATH
  E2E Server Linter
    ✔ simple debugger statement (275ms)
    ✔ file extension astro (single folder workspace) (278ms)
    ✔ file extension cjs (single folder workspace) (281ms)
    ✔ file extension cts (single folder workspace) (443ms)
    ✔ file extension js (single folder workspace) (284ms)
    ✔ file extension jsx (single folder workspace) (292ms)
    ✔ file extension mjs (single folder workspace) (315ms)
    ✔ file extension mts (single folder workspace) (313ms)
    ✔ file extension svelte (single folder workspace) (411ms)
    ✔ file extension ts (single folder workspace) (436ms)
    ✔ file extension tsx (single folder workspace) (353ms)
    ✔ file extension vue (single folder workspace) (359ms)
    1) detects diagnostics on run (single folder workspace)
    ✔ empty oxlint configuration behaves like default configuration (779ms)
    ✔ setting rule to error, will report the diagnostic as error (941ms)
    ✔ auto detect changing `fixKind` with fixAll command (1129ms)
    2) nested configs severity
    - changing config from `extends` will revalidate the diagnostics
    3) changing oxc.tsConfigPath will revalidate the diagnostics (single folder workspace)
    - changing oxc.typeAware will revalidate the tsgolint diagnostics
  E2E Server Formatter
    ✔ formats code with `oxc.fmt.experimental` (718ms)
    ✔ formats code with `oxc.fmt.configPath` (602ms)
  E2E Diagnostics
    4) simple debugger statement
    5) file extension astro (single folder workspace)
    6) file extension cjs (single folder workspace)
    7) file extension cts (single folder workspace)
    ✔ file extension js (single folder workspace) (322ms)
    8) file extension jsx (single folder workspace)
    9) file extension mjs (single folder workspace)
    10) file extension mts (single folder workspace)
    11) file extension svelte (single folder workspace)
    12) file extension ts (single folder workspace)
    13) file extension tsx (single folder workspace)
    14) file extension vue (single folder workspace)
    15) detects diagnostics on run (single folder workspace)
    ✔ empty oxlint configuration behaves like default configuration (559ms)
    ✔ setting rule to error, will report the diagnostic as error (941ms)
    ✔ auto detect changing `fix_kind` flag with fixAll command (1103ms)
    16) nested configs severity
    - changing config from `extends` will revalidate the diagnostics
    17) changing oxc.tsConfigPath will revalidate the diagnostics (single folder workspace)
    18) changing oxc.typeAware will revalidate the tsgolint diagnostics (single folder workspace)
    19) formats code with `oxc.fmt.experimental`
    ✔ formats code with `oxc.fmt.configPath` (656ms)
  commands
    ✔ listed commands (single folder workspace)
    ✔ oxc.showOutputChannel (single folder workspace) (506ms)
    ✔ oxc.toggleEnable (single folder workspace) (1074ms)
    ✔ oxc.fixAll (76ms)
  code actions
    20) listed code actions (single folder workspace)
    21) code action `source.fixAll.oxc` on editor.codeActionsOnSave
    ✔ code action `source.fixAll.oxc` ignores "ignore this rule for this line/file" (2580ms)
    ✔ changing configuration flag "fix_kind" will reveal more code actions (593ms)
    ✔ changing configuration "unusedDisableDirectives" will reveal more code actions (577ms)
  WorkspaceConfig
    ✔ default values on initialization
    ✔ deprecated values are respected
    ✔ updating values updates the workspace configuration (136ms)
    ✔ toLanguageServerConfig method (132ms)
    ✔ toOxlintConfig method (121ms)
    ✔ toOxfmtConfig method (46ms)
  VSCodeConfig
    ✔ default values on initialization (single folder workspace)
    ✔ deprecated values are respected (single folder workspace)
    ✔ updating values updates the workspace configuration (single folder workspace) (77ms)
  validateSafeBinaryPath
    ✔ should return true for valid binary paths
    ✔ should accept case variations of oxc_language_server
    ✔ should reject paths with directory traversal
    ✔ should reject paths with malicious characters
  ConfigService
    getUserServerBinPath
      ✔ resolves relative server path with workspace folder (single folder workspace)
      ✔ returns undefined for unsafe server path (single folder workspace)
      ✔ returns backslashes path on Windows (single folder workspace)
  51 passing (41s)
  3 pending
  21 failing
  1) E2E Server Linter
       detects diagnostics on run (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

1 !== 0

      + expected - actual

      -1
      +0
      
        at Context.<anonymous> (out/e2e_server_linter.spec.js:1:1921)

  2) E2E Server Linter
       nested configs severity:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

1 !== 0

      + expected - actual

      -1
      +0
      
        at Context.<anonymous> (out/e2e_server_linter.spec.js:1:4614)

  3) E2E Server Linter
       changing oxc.tsConfigPath will revalidate the diagnostics (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server_linter.spec.js:1:5808)

  4) E2E Diagnostics
       simple debugger statement:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:945)

  5) E2E Diagnostics
       file extension astro (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  6) E2E Diagnostics
       file extension cjs (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  7) E2E Diagnostics
       file extension cts (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  8) E2E Diagnostics
       file extension jsx (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  9) E2E Diagnostics
       file extension mjs (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  10) E2E Diagnostics
       file extension mts (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  11) E2E Diagnostics
       file extension svelte (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  12) E2E Diagnostics
       file extension ts (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  13) E2E Diagnostics
       file extension tsx (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  14) E2E Diagnostics
       file extension vue (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

0 !== 1

      + expected - actual

      -0
      +1
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:1633)

  15) E2E Diagnostics
       detects diagnostics on run (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

1 !== 0

      + expected - actual

      -1
      +0
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:2035)

  16) E2E Diagnostics
       nested configs severity:
     TypeError: Cannot read properties of undefined (reading 'code')
        at Context.<anonymous> (out/e2e_server.spec.js:1:4771)

  17) E2E Diagnostics
       changing oxc.tsConfigPath will revalidate the diagnostics (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

1 !== 0

      + expected - actual

      -1
      +0
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:6073)

  18) E2E Diagnostics
       changing oxc.typeAware will revalidate the tsgolint diagnostics (single folder workspace):

      AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

  i((await t.getDiagnostics(`index.ts`)).length!=0)

      + expected - actual

      -false
      +true
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:6895)

  19) E2E Diagnostics
       formats code with `oxc.fmt.experimental`:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected

+ 'class X { foo() { return 42; } }\n'
- 'class X {\n  foo() {\n    return 42;\n  }\n}\n'

      + expected - actual

      -class X { foo() { return 42; } }
      +class X {
      +  foo() {
      +    return 42;
      +  }
      +}
      
        at Context.<anonymous> (out/e2e_server.spec.js:1:7458)

  20) code actions
       listed code actions (single folder workspace):

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected
... Skipped lines

  [
    {
      isPreferred: true,
      title: 'Remove the debugger statement'
    },
...
      isPreferred: false,
+     title: 'Disable no-debugger for this file'
-     title: 'Disable no-debugger for this whole file'
    }
  ]

      + expected - actual

           "title": "Disable no-debugger for this line"
         }
         {
           "isPreferred": false
      -    "title": "Disable no-debugger for this file"
      +    "title": "Disable no-debugger for this whole file"
         }
       ]
      
        at Context.<anonymous> (out/code_actions.spec.js:1:987)

  21) code actions
       code action `source.fixAll.oxc` on editor.codeActionsOnSave:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
+ actual - expected
... Skipped lines

  ' export function processChanges(changeHistory, maxChangesToShow) {\n' +
    '  if (!changeHistory || !changeHistory.changes) {\n' +
    '      return [];\n' +
    '  }\n' +
    '\n' +
...
    '      switch (op) {\n' +
+   "          case 'add':\n" +
-   "          case 'add': {\n" +
    '              // Special handling for references\n' +
    '              if (path.match(/^\\/references\\/\\d+$/)) {\n' +
    "                  if (value && typeof value === 'object' && 'key' in value) {\n" +
    '                      summaryItems.push({\n' +
    "                          label: 'References.' + value.key,\n" +
...
    '              break;\n' +
-   '          }\n' +
    '\n' +
+   "          case 'remove':\n" +
-   "          case 'remove': {\n" +
    '              summaryItems.push({\n' +
    '                  label: displayPath,\n' +
    "                  displayValue: <span className='text-red-600 font-medium'>Removed</span>\n" +
    '              });\n' +
    '              break;\n' +
-   '          }\n' +
    '\n' +
+   "          case 'replace':\n" +
-   "          case 'replace': {\n" +
    '              // Skip version changes as we display them separately\n' +
    "              if (path === '/version') return;\n" +
    '\n' +
    '              summaryItems.push({\n' +
    '                  label: displayPath,\n' +
...
    '              break;\n' +
-   '          }\n' +
    '\n' +
+   '          default:\n' +
-   '          default: {\n' +
    '              summaryItems.push({\n' +
    '                  label: displayPath,\n' +
    "                  displayValue: <span className='text-gray-600'>{op}</span>\n" +
    '              });\n' +
-   '          }\n' +
    '      }\n' +
    '  });\n' +
    '\n' +
    '  // Add metadata about more changes\n' +
    '  summaryItems.moreChangesCount = Math.max(0, totalChanges - maxChangesToShow);\n' +

      + expected - actual

             processedPaths.add(displayPath);
       
             // Handle different operation types
             switch (op) {
      -          case 'add':
      +          case 'add': {
                     // Special handling for references
                     if (path.match(/^\/references\/\d+$/)) {
                         if (value && typeof value === 'object' && 'key' in value) {
                             summaryItems.push({
--
                             displayValue: <span className='text-green-600 font-medium'>Added</span>
                         });
                     }
                     break;
      +          }
       
      -          case 'remove':
      +          case 'remove': {
                     summaryItems.push({
                         label: displayPath,
                         displayValue: <span className='text-red-600 font-medium'>Removed</span>
                     });
                     break;
      +          }
       
      -          case 'replace':
      +          case 'replace': {
                     // Skip version changes as we display them separately
                     if (path === '/version') return;
       
                     summaryItems.push({
                         label: displayPath,
                         displayValue: <span className='text-blue-600 font-medium'>Updated</span>
                     });
                     break;
      +          }
       
      -          default:
      +          default: {
                     summaryItems.push({
                         label: displayPath,
                         displayValue: <span className='text-gray-600'>{op}</span>
                     });
      +          }
             }
         });
       
         // Add metadata about more changes
      
        at Context.<anonymous> (out/code_actions.spec.js:1:1899)

21 tests failed.

@liangmiQwQ liangmiQwQ marked this pull request as ready for review November 26, 2025 22:24
const firstDiagnostics = await getDiagnostics('debugger.js');
strictEqual(firstDiagnostics.length, 1);

await workspace.getConfiguration('oxc').update('enable', false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to reset this configuration. Try the teardown function at the top, or at the end of this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated! Tysm!

@liangmiQwQ liangmiQwQ force-pushed the fix-vscode/stop-client-while-enabling-changes branch from ad6be59 to df8cf2f Compare November 27, 2025 13:38
@liangmiQwQ liangmiQwQ marked this pull request as draft November 27, 2025 13:45
@liangmiQwQ liangmiQwQ marked this pull request as ready for review November 27, 2025 22:12
@liangmiQwQ liangmiQwQ marked this pull request as draft November 27, 2025 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-editor Area - Editor and Language Server C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants