Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 formatter.ignore matched against absolute paths #4868

Open
2 of 3 tasks
ahumeau opened this issue Jan 9, 2025 · 1 comment
Open
2 of 3 tasks

🐛 formatter.ignore matched against absolute paths #4868

ahumeau opened this issue Jan 9, 2025 · 1 comment
Assignees
Labels
A-Core Area: core A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug

Comments

@ahumeau
Copy link

ahumeau commented Jan 9, 2025

VS Code version

1.96.2

Extension version

2.3.0

Biome version

1.9.4

Operating system

  • Windows
  • macOS
  • Linux

Description

When trying out biome and the biome VSCode extension on a project, I was not able to get the extension to format js/jsx/ts/tsx files. Running Format Document did nothing and no feedback was apparent.

The extension and daemon logs showed an error but with no message (see attached logs).

Running biome through the CLI worked as expected.

I pinpointed the issue to one of the entries in formatter.ignore matching one of the parent directories of my project (removing such entry or renaming the parent directory fixed the issue). It looks like formatter.ignore is getting matched against the files' absolute path instead of their path relative to the project root which does not feel like the correct behavior. Better error logs would also have helped.

NB: I encountered no issue formatting JSON files

Steps to reproduce

  1. Clone the attached reproduction repo.
  2. cd into it
  3. Run yarn
  4. Open the repo in VSCode
  5. Install the Biome VSCode extension
  6. Run Format Document on src/index.js

Expected behavior

  • src/index.js should get formatted, it does not.
  • No error should appear in the logs or at least a message should be attached to them

Does this issue occur when using the CLI directly?

No

Link to a minimal reproduction

https://github.com/ahumeau/biome-vscode-formatter-ignore-matched-against-absolute-paths

Logs

Biome extension logs:

Executing Biome from: /home/antoine/.config/Code/User/workspaceStorage/a689310513eb39e2997d67e833732853/biomejs.biome/biome
[cli-stdout] data 46
[cli-stderr] end
[cli-stderr] finish
[cli-stdout] end
[cli-stdout] finish
[cli] exit 0
Connecting to "/home/antoine/.cache/biome/biome-socket-1.9.4" ...
[cli-stdout] close
[cli] close 0
[cli-stderr] close
[Info  - 8:14:40 AM] Server initialized with PID: 916581
[Error - 8:16:16 AM] 


Biome Daemon logs:
├─ DEBUG biome_lsp::handlers::analysis Suggested actions: 
│ []
└─┐biome_lsp::handlers::formatting::format{params=DocumentFormattingParams { text_document: TextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: false, use>
  └─┐biome_service::file_handlers::try_from_path{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="ts"}
    ┌─┘
  ┌─┘
  ├─ DEBUG biome_service::workspace::server File capabilities: Js(JsFileSource { language: TypeScript { definition_file: false }, variant: Standard, module_kind: Module, ve>
  └─┐biome_service::file_handlers::try_from_path{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="ts"}
    ┌─┘
  ┌─┘
  └─┐biome_service::file_handlers::try_from_path{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="ts"}
    ┌─┘
  ┌─┘
  └─┐biome_service::workspace::with_settings_and_language{file_source=Js(JsFileSource { language: TypeScript { definition_file: false }, variant: Standard, module_kind: Mod>
    ├─ DEBUG biome_service::workspace The file /home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts has the following feature set>
    │ {Format: Supported, OrganizeImports: FeatureNotEnabled, Search: Supported, Assists: Supported, Debug: Supported, Lint: FeatureNotEnabled}
  ┌─┘
  └─┐biome_service::file_handlers::try_from_path{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    └─┐biome_service::file_handlers::try_from_well_known{path="/home/antoine/vroomly/biome-vscode-formatter-ignore-matched-against-absolute-paths/src/index.ts"}
    ┌─┘
    └─┐biome_service::file_handlers::try_from_extension{extension="ts"}
    ┌─┘
  ┌─┘
  ├─ ERROR biome_lsp::handlers::formatting error=
┌─┘
└─┐biome_lsp::handlers::text_document::did_close{params=DidCloseTextDocumentParams { text_document: TextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: fa>
┌─┘
└─┐biome_lsp::handlers::text_document::did_close{params=DidCloseTextDocumentParams { text_document: TextDocumentIdentifier { uri: Url { scheme: "file", cannot_be_a_base: fa>
┌─┘
@ahumeau ahumeau changed the title 🐛 🐛 formatter.ignore matched against absolute paths Jan 9, 2025
@ematipico ematipico transferred this issue from biomejs/biome-vscode Jan 9, 2025
@ematipico ematipico added A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug A-Core Area: core labels Jan 9, 2025
@ekoeditaa
Copy link
Contributor

I can work on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Core Area: core A-LSP Area: language server protocol S-Bug-confirmed Status: report has been confirmed as a valid bug
Projects
None yet
Development

No branches or pull requests

3 participants