Skip to content

refactor(language_server): store LintService instead of Linter#12016

Merged
graphite-app[bot] merged 1 commit intomainfrom
07-01-refactor_language_server_store_lintservice_instead_of_linter_
Jul 11, 2025
Merged

refactor(language_server): store LintService instead of Linter#12016
graphite-app[bot] merged 1 commit intomainfrom
07-01-refactor_language_server_store_lintservice_instead_of_linter_

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Jul 1, 2025

I tried a basic usage with htop and @react-three/fiber as an import. The test setup should be included. Run npm install in the fixture folder.

The results are looking not good. 😢

Would like to know more how I can memory check the server. My first guess is to modify it to a lib and then run a custom program with the methods of the impl LanguageServer.

Current main:

memory-main

This PR:

memory-pr12016

oxc_resolver.clear_cache() as the first call on Runtime.run_source():

memory-clear-cache

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jul 1, 2025
Copy link
Member Author

Sysix commented Jul 1, 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.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 1, 2025

CodSpeed Instrumentation Performance Report

Merging #12016 will not alter performance

Comparing 07-01-refactor_language_server_store_lintservice_instead_of_linter_ (6e54645) with main (8a7c9e8)

Summary

✅ 34 untouched benchmarks

@Sysix Sysix force-pushed the 07-01-refactor_language_server_store_lintservice_instead_of_linter_ branch 2 times, most recently from 5bd45dd to 6dcaef8 Compare July 6, 2025 17:15
@Sysix Sysix force-pushed the 07-01-refactor_linter_move_lintserviceoptions.paths_to_lintservice.with_paths_ branch from bbebd4d to 39fe6ad Compare July 6, 2025 17:15
@Sysix Sysix force-pushed the 07-01-refactor_linter_move_lintserviceoptions.paths_to_lintservice.with_paths_ branch from 39fe6ad to 82a398f Compare July 9, 2025 16:30
@Sysix Sysix force-pushed the 07-01-refactor_language_server_store_lintservice_instead_of_linter_ branch 2 times, most recently from eb594bd to dfe5826 Compare July 9, 2025 16:33
@Sysix Sysix force-pushed the 07-01-refactor_linter_move_lintserviceoptions.paths_to_lintservice.with_paths_ branch from 82a398f to a7f6d5d Compare July 9, 2025 16:33
@Sysix Sysix force-pushed the 07-01-refactor_language_server_store_lintservice_instead_of_linter_ branch from dfe5826 to d3a7d65 Compare July 9, 2025 16:35
@Sysix Sysix force-pushed the 07-01-refactor_linter_move_lintserviceoptions.paths_to_lintservice.with_paths_ branch from a7f6d5d to ccfd937 Compare July 9, 2025 16:39
@Sysix Sysix force-pushed the 07-01-refactor_language_server_store_lintservice_instead_of_linter_ branch 2 times, most recently from dc938af to 1f898f2 Compare July 9, 2025 17:00
@Sysix Sysix force-pushed the 07-01-refactor_language_server_store_lintservice_instead_of_linter_ branch from 1f898f2 to fba7ac3 Compare July 9, 2025 17:04
@Sysix Sysix marked this pull request as ready for review July 9, 2025 17:10
@Sysix Sysix requested a review from camc314 as a code owner July 9, 2025 17:10
@Sysix Sysix requested a review from Boshen July 9, 2025 17:10
@Sysix
Copy link
Member Author

Sysix commented Jul 9, 2025

I'm testing your PR, it seems like memory no longer go up after a few saves 🤔

@Boshen

On my machine, this happens too on main. (with htop)
For the heaptrack part:
I forget to add the line cd crates/oxc_language_server/fixtures/linter/oxc_resolver_memory_leak && npm i into the setup description.
The node_modules folder needs to be filled inside the fixture. With sleep 500 I still get the growing memory :(

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Jul 11, 2025
Copy link
Member

Boshen commented Jul 11, 2025

Merge activity

@Boshen
Copy link
Member

Boshen commented Jul 11, 2025

I'll continue explore the memory leak after this PR.

…12016)

I tried a basic usage with `htop` and @react-three/fiber as an import. The test setup should be included. Run `npm install` in the fixture folder.

The results are looking not good. 😢

Would like to know more how I can memory check the server. My first guess is to modify it to a `lib` and then run a custom program with the methods of the `impl LanguageServer`.

Current main:

![memory-main](https://github.com/user-attachments/assets/f76dea0d-b620-4c9e-b031-2781763dd54d)

This PR:

![memory-pr12016](https://github.com/user-attachments/assets/7cf37b8a-64c7-404f-9e2e-acce4b48c2a5)

`oxc_resolver.clear_cache()` as the first call on `Runtime.run_source()`:

![memory-clear-cache](https://github.com/user-attachments/assets/951c767f-1a34-4a50-b39b-5753f684789b)
@graphite-app graphite-app bot force-pushed the 07-01-refactor_linter_move_lintserviceoptions.paths_to_lintservice.with_paths_ branch from ccfd937 to 113cf8c Compare July 11, 2025 14:50
@graphite-app graphite-app bot force-pushed the 07-01-refactor_language_server_store_lintservice_instead_of_linter_ branch from fba7ac3 to 6e54645 Compare July 11, 2025 14:50
Base automatically changed from 07-01-refactor_linter_move_lintserviceoptions.paths_to_lintservice.with_paths_ to main July 11, 2025 14:58
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jul 11, 2025
@graphite-app graphite-app bot merged commit 6e54645 into main Jul 11, 2025
27 checks passed
@graphite-app graphite-app bot deleted the 07-01-refactor_language_server_store_lintservice_instead_of_linter_ branch July 11, 2025 15:00
camc314 added a commit that referenced this pull request Jul 16, 2025
## [1.7.0] - 2025-07-16

### 🚀 Features

- 5e428a4 linter/eslint-plugin-next: No-html-link-for-pages rule
addition (#12194) (Gabriel Díaz Aguilera)
- 9b14fbc ast: Add `ThisExpression` to `TSTypeName` (#12156) (Boshen)
- c551b8f linter: Report diagnostics from custom plugins (#12219)
(camc314)
- d387729 linter: JS custom rules config (#12160) (camc314)
- 152e59d napi/oxlint: Read source text into start of allocator (#12122)
(overlookmotel)
- bde1ef1 linter: Load custom JS plugins (#11980) (camc314)
- d4ebd14 linter: Add `oxlint2`/`disable_oxlint2` feature flags (#12130)
(camc314)
- a4dae73 linter: Introduce `LintPlugins` to store builtin + custom
plugins (#12117) (camc314)

### 🐛 Bug Fixes

- 3f9a1f0 linter/no-unused-private-class-members: Fix false positive
with nullish coalescing assignments (#12317) (camc314)
- 47fad0e linter/no-empty-file: False positive with empty file with
triple slash directive (#12293) (camc314)
- 633ba30 linter: False positive with unknown plugins when unmatched
eslint rule (#12285) (camc314)
- 9720774 linter: Report implicit config parse errors (#12260) (Simon
Buchan)
- 1920c6b language_server: Respect the root `.oxlintrc.json` file for
`ignorePatterns` (#12171) (Sysix)
- 98708eb linter: Fix inconsistent behavior in `no-duplicate-imports`
rule (#12192) (yefan)
- 853d2bc linter, language_server: Correctly identify usage of `import`
plugin (#12157) (overlookmotel)

### 🚜 Refactor

- ee761de ast: Remove `AstKind` for `AssignmentTarget` (#12252) (Tyler
Earls)
- c68b607 ast: Rename `TemplateLiteral::quasi` to
`TemplateLiteral::single_quasi` (#12266) (Dunqing)
- 32c32af ast: Check whether there is a single `quasi` in
`TemplateLiteral::quasi` (#12265) (Dunqing)
- 8f6a1da linter/js-plugins: Use `u32` for IDs (#12243) (overlookmotel)
- 36cd364 linter/js-plugins: Clean up code (#12242) (overlookmotel)
- 8c02ebd linter/js-plugins: Rename `specifiers` to `paths` (#12241)
(overlookmotel)
- 3adaf98 linter: Simplify getting nodes count (#12239) (overlookmotel)
- 6e54645 language_server: Store `LintService` instead of `Linter`
(#12016) (Sysix)
- 113cf8c linter: Move `LintServiceOptions.paths` to
`LintService.with_paths` (#12015) (Sysix)
- acfac68 oxlint: Adjust ignore patterns by counting bytes instead of
chars (#12209) (Sysix)
- 729b82b linter: Rename `plugin_name` to `plugin_specifier` (#12148)
(overlookmotel)
- 532b816 linter: Use `to_string` instead of `into` (#12147)
(overlookmotel)
- 89f2a69 linter: TODO comment (#12146) (overlookmotel)
- f90d3e1 linter: Feature gate `load_external_plugin` by both `oxlint2`
and `disable_oxlint2` features (#12141) (overlookmotel)
- 12e4ec7 linter: Make `tokio` dependency optional (#12140)
(overlookmotel)
- 1d2eaca oxlint2: Introduce `force_test_reporter` feature for
consistent graphical outputs (#12133) (camc314)
- 8814c53 ast: Remove `AstKind` for `PropertyKey` (#12108) (camchenry)
- 228cff5 semantic,linter: Assert that Program is always the first node
(#12123) (Ulrich Stark)
- e8e2a25 ast: Remove `AstKind` for `AssignmentTargetPattern` (#12105)
(camchenry)
- f7c675d linter: Rename `LintPlugins` to `BuiltinLintPlugins` (#12116)
(camc314)
- a9e5ec0 linter: Access plugins through config instead of storing
directly (#12115) (camc314)
- 9736a7f linter: Simplify `unicorn/require-post-message-target-origin`
(#12110) (shulaoda)

### 📚 Documentation

- 2e3db46 linter: Add missing backtick preventing website from building
(#12113) (camc314)

### ⚡ Performance

- d0f8b88 linter/js-plugins: Do not copy `Vec` (#12248) (overlookmotel)
- 4284d19 linter/js-plugins: Use hashmap `Entry` API + remove temp `Vec`
(#12247) (overlookmotel)
- c7889c3 semantic,linter: Simplify implementation and uses of ancestors
iterators (#12164) (Ulrich Stark)
- f99959c linter: Move work out of loop (#12145) (overlookmotel)
- 514d40c linter: Do not create `Resolver` unless required (#12142)
(overlookmotel)
- 7103527 linter/no-constructor-return: Optimize loop (#12138)
(overlookmotel)

### 🧪 Testing

- d1194e8 oxlint: Ignore test on windows (#12262) (camc314)

Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-editor Area - Editor and Language Server A-linter Area - Linter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants