Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cormacrelf
Copy link
Contributor

@cormacrelf cormacrelf commented Nov 25, 2025

This is probably contributing to the issues around hundreds of gigabytes of logs in #7538

Summary

Look at #7538.

└─┐biome_lsp::handlers::text_document::did_change{url=file:///home/cormac/code/oss/biome/e2e-tests/stdin-nested-config/subdirectory/lib.js, version=23}
  ├─ DEBUG biome_lsp::handlers::text_document old document: "let y              = 65;\n\nfunction indent() {\n         return y;\n}\n"
  ├─ DEBUG biome_lsp::handlers::text_document content changes: [TextDocumentContentChangeEvent { range: Some(Range { start: Position { line: 3, character: 8 }, end: Position { line: 3, character: 9 } }), range_length: Some(1), text: "" }]
  ├─ DEBUG biome_lsp::handlers::text_document new document: "let y              = 65;\n\nfunction indent() {\n        return y;\n}\n"

That's the entire document, dumped twice on every keystroke. No wonder we are producing 125GB per hour.

Test Plan

I looked at the logs.

Docs

n/a

@changeset-bot
Copy link

changeset-bot bot commented Nov 25, 2025

🦋 Changeset detected

Latest commit: 31f82bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the A-LSP Area: language server protocol label Nov 25, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 25, 2025

Walkthrough

This change reduces logging verbosity in the LSP text document handler: debug-level logs for document changes (old_text and new_text) are downgraded to trace level, trace logging is added for content_changes, and a changeset documents a patch release for biome referencing PR 7538. Functional behaviour is unchanged. The changeset advises running biome clean to remove large logs.

Possibly related PRs

  • biomejs/biome PR 7901 — similar edits in crates/biome_lsp/src/handlers/text_document.rs adjusting logging levels for open/change handlers.

Suggested reviewers

  • Netail
  • dyc3

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: reducing excessive LSP logging by eliminating duplicate full file content logs on every keystroke.
Description check ✅ Passed The description clearly explains the problem with references to issue #7538, provides concrete logging examples, and outlines the motivation (gigabytes of logs per hour).
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 537120f and 31f82bc.

📒 Files selected for processing (1)
  • .changeset/shy-berries-poke.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/shy-berries-poke.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: Test Node.js API
  • GitHub Check: Documentation
  • GitHub Check: End-to-end tests
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: autofix

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
.changeset/shy-berries-poke.md (1)

5-6: Consider clarifying what changed.

The description explains the problem but not the solution. Users might wonder how the logging was reduced.

Consider rewording to:

-Less logging in the LSP server. We were logging the entire text document twice,
-on almost every keystroke. This may have contributed to #7538.
+The LSP server now logs document changes at trace level instead of debug level.
+Previously, Biome logged the entire text document twice on almost every keystroke
+at debug level, which may have contributed to #7538.
crates/biome_lsp/src/handlers/text_document.rs (1)

167-170: Consider clarifying the comment.

The comment reads as if it's warning about current behaviour, but you've already addressed the issue by moving to trace level.

Perhaps reword to make it clearer this is now trace-only:

-    // Careful, this logs the entire text document (twice) on almost every keystroke.
-    // Default log level = max debug.
+    // Trace level only: logs the entire text document on every keystroke.
     trace!("old document: {:?}", old_text);
     trace!("content changes: {:?}", params.content_changes);
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98ca2ae and eeddf6f.

📒 Files selected for processing (2)
  • .changeset/shy-berries-poke.md (1 hunks)
  • crates/biome_lsp/src/handlers/text_document.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit inference engine (CONTRIBUTING.md)

**/*.rs: Use the Rust dbg!() macro for debugging output during test execution, and pass the --show-output flag to cargo test to display debug output.
Use snapshot testing with the insta crate for testing in Rust projects. Accept or reject snapshots using cargo insta accept, cargo insta reject, or cargo insta review.
Write doc comments as doc tests in Rust using code blocks with assertions that will be executed during the testing phase.
Use rustdoc inline documentation for rules, assists, and their options. Create corresponding documentation PRs for other documentation updates against the next branch of the website repository.
Set the version metadata field in linter rule implementations to 'next' for newly created rules. Update this field to the new version number when releasing a minor or major version.

Files:

  • crates/biome_lsp/src/handlers/text_document.rs
**/.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Files:

  • .changeset/shy-berries-poke.md
🧠 Learnings (4)
📚 Learning: 2025-11-24T18:05:27.784Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:05:27.784Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Use the `dbg_write!` macro to debug formatter output instead of other logging methods

Applied to files:

  • crates/biome_lsp/src/handlers/text_document.rs
📚 Learning: 2025-11-24T18:04:57.290Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_diagnostics/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:04:57.290Z
Learning: Applies to crates/biome_diagnostics/**/*.rs : Use helper types from the biome_diagnostics::v2 module (CodeFrameAdvice, CommandAdvice, DiffAdvice, LogAdvice) or implement the Advices trait yourself for custom advice handling

Applied to files:

  • crates/biome_lsp/src/handlers/text_document.rs
📚 Learning: 2025-11-24T18:06:03.536Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:06:03.536Z
Learning: Applies to crates/biome_parser/**/language_kind.rs : Add a new language prefix to the `LANGUAGE_PREFIXES` constant in `language_kind.rs` file

Applied to files:

  • crates/biome_lsp/src/handlers/text_document.rs
📚 Learning: 2025-11-24T18:03:52.014Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.

Applied to files:

  • .changeset/shy-berries-poke.md
🧬 Code graph analysis (1)
crates/biome_lsp/src/handlers/text_document.rs (1)
crates/biome_lsp/src/utils.rs (1)
  • apply_document_changes (361-412)
🔇 Additional comments (2)
crates/biome_lsp/src/handlers/text_document.rs (2)

13-13: Import looks good.

Correctly adds trace for the new trace-level logging below.


178-178: Looks good.

Consistent with the trace-level changes above.

@cormacrelf cormacrelf changed the title fix(lsp): Do not log full file contents twice on every keystroke fix(lsp): do not log full file contents twice on every keystroke Nov 25, 2025
@cormacrelf cormacrelf changed the title fix(lsp): do not log full file contents twice on every keystroke fix(lsp): do not log full file contents twice on every keystroke Nov 25, 2025
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

That's a good start, thank you

This is probably causing the issues around hundreds of gigabytes of logs.
@cormacrelf cormacrelf force-pushed the less-logging-full-file-contents branch from eeddf6f to 4c06279 Compare November 25, 2025 23:26
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eeddf6f and 4c06279.

📒 Files selected for processing (2)
  • .changeset/shy-berries-poke.md (1 hunks)
  • crates/biome_lsp/src/handlers/text_document.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/biome_lsp/src/handlers/text_document.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Files:

  • .changeset/shy-berries-poke.md
🧠 Learnings (3)
📚 Learning: 2025-11-24T18:03:52.014Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.014Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.

Applied to files:

  • .changeset/shy-berries-poke.md
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • .changeset/shy-berries-poke.md
📚 Learning: 2025-11-24T18:03:52.013Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.013Z
Learning: Applies to **/.changeset/*.md : Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Applied to files:

  • .changeset/shy-berries-poke.md
🪛 LanguageTool
.changeset/shy-berries-poke.md

[style] ~6-~6: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...the LSP server. Biome has been creating very large (100GB+) log files. It was logging the ...

(EN_WEAK_ADJECTIVE)


[typographical] ~10-~10: The word “otherwise” is an adverb that can’t be used like a conjunction, and therefore needs to be separated from the sentence.
Context: ...ue, you can run biome clean to delete logs, otherwise they are cleaned up weekly by default. ...

(THUS_SENTENCE)


[style] ~12-~12: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...lt. If you still find Biome is creating very large log files after this change, please com...

(EN_WEAK_ADJECTIVE)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: End-to-end tests
  • GitHub Check: Documentation
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: autofix
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Check Dependencies
  • GitHub Check: Test Node.js API

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c06279 and 537120f.

📒 Files selected for processing (1)
  • .changeset/shy-berries-poke.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/.changeset/*.md

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Files:

  • .changeset/shy-berries-poke.md
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.024Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.
📚 Learning: 2025-11-24T18:03:52.024Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.024Z
Learning: For bugfix/feature PRs visible to Biome toolchain users or affecting published crates, create a changeset using the `just new-changeset` command with appropriate package selection, change type (major/minor/patch), and description.

Applied to files:

  • .changeset/shy-berries-poke.md
📚 Learning: 2025-08-05T14:43:29.581Z
Learnt from: dyc3
Repo: biomejs/biome PR: 7081
File: packages/@biomejs/biome/configuration_schema.json:7765-7781
Timestamp: 2025-08-05T14:43:29.581Z
Learning: The file `packages/biomejs/biome/configuration_schema.json` is auto-generated and should not be manually edited or reviewed for schema issues; any changes should be made at the code generation source.

Applied to files:

  • .changeset/shy-berries-poke.md
📚 Learning: 2025-09-25T12:32:59.003Z
Learnt from: arendjr
Repo: biomejs/biome PR: 7593
File: crates/biome_service/src/workspace/server.rs:1306-1306
Timestamp: 2025-09-25T12:32:59.003Z
Learning: In the biomejs/biome project, do not flag compilation errors during code review as they are handled by the existing test infrastructure and CI. Focus on other code quality aspects instead.

Applied to files:

  • .changeset/shy-berries-poke.md
📚 Learning: 2025-11-24T18:03:52.024Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: CONTRIBUTING.md:0-0
Timestamp: 2025-11-24T18:03:52.024Z
Learning: Applies to **/.changeset/*.md : Changeset descriptions should be user-facing, use past tense for actions taken (e.g., 'Added new feature'), and present tense for Biome behavior (e.g., 'Biome now supports...'). Include issue links, rule links, and code examples where applicable.

Applied to files:

  • .changeset/shy-berries-poke.md
🪛 GitHub Actions: Pull request Markdown
.changeset/shy-berries-poke.md

[error] 6-6: markdownlint: MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]

🪛 GitHub Check: lint
.changeset/shy-berries-poke.md

[failure] 6-6: Trailing spaces
.changeset/shy-berries-poke.md:6:39 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1] https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md009.md

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
  • GitHub Check: autofix
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Documentation
  • GitHub Check: Check Dependencies
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test Node.js API
🔇 Additional comments (1)
.changeset/shy-berries-poke.md (1)

5-8: Much better—follows the guidelines now.

The changeset now adheres to the style guidance with proper tense usage (past for actions, present for behaviour), user-facing language, and a concise description. Once you fix the trailing whitespace above, this should be good to go.

@ematipico ematipico merged commit 893e36c into biomejs:main Nov 27, 2025
13 checks passed
@github-actions github-actions bot mentioned this pull request Nov 27, 2025
@cormacrelf cormacrelf deleted the less-logging-full-file-contents branch November 27, 2025 15:56
This was referenced Dec 15, 2025
l0ngvh pushed a commit to l0ngvh/biome that referenced this pull request Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LSP Area: language server protocol

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants