Open Hoshock opened 2 months ago
The last line of log says that you're trying to format a file that parsing errors, that's why it's not working.
@ematipico It doesn't matter. Even if there is no parsing error, the issue happens.
Any chance you can provide the Daemon logs?
@ematipico It may be a stupid question, but what is the Daemon log? Is it different from the log I've attatched? Could you tell me how to retrieve the Daemon log?
@ematipico I found the Daemon log.
I can't seem to find anything that hints to an error. At this point you'll have to create a reproduction via npm create @biomejs/create-reproduction
@ematipico Thank you for the investigation. I've realized obvious settings change in the Daemon log even though I didn't change biome.json at all.
β Indent style: Tab
β Indent width: 2
β Line ending: LF
β Line width: 80
β Quote style: Double Quotes
β JSX quote style: Double Quotes
β Quote properties: As needed
β Trailing commas: All
β Semicolons: Always
β Arrow parentheses: Always
β Bracket spacing: true
β Bracket same line: false
β Attribute Position: Auto
β Indent style: Space
β Indent width: 4
β Line ending: LF
β Line width: 120
β Quote style: Double Quotes
β JSX quote style: Double Quotes
β Quote properties: As needed
β Trailing commas: All
β Semicolons: As needed
β Arrow parentheses: Always
β Bracket spacing: true
β Bracket same line: false
β Attribute Position: Auto
Could you try the latest nightly to see if it solves your issue?
@nhedger Thank you. I've tried, but it reproduces. And I realized the quickest way to reproduce this issue.
biome.json
and save itIs it possible that the configuration file has errors? What can you see from the Daemon logs? You can tail them to check real time logs
I'll check if I can reproduce it consistently with the instructions you gave us
Here is the Daemon log diff
biome.json
has not errors. Here are the configuration.
Step 2
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 120
},
"javascript": {
"formatter": {
"semicolons": "asNeeded"
}
}
}
Step 4
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"formatter": {
"indentStyle": "space",
"indentWidth": 4,
"lineWidth": 120
},
"javascript": {
"formatter": {
"semicolons": "asNeeded"
}
}
}
Found the issue
49s ERROR biome_fs::fs Biome couldn't open the file "/Users/ish-ts/Projects/ENV-GitHub-Test/biome.json", reason:
β Os { code: 2, kind: NotFound, message: "No such file or directory" }
βββbiome_fs:
The configuration file can't be read. Probably your workspace/editor changes the privileges of the document?
It's worth noting that the configuration file is in two separate folders...
ββ 48s WARN tower_lsp Got a textDocument/didSave notification, but it is not implemented
ββ 49s INFO biome_lsp::session Detected workspace folder.
ββ 49s INFO biome_lsp::session Attempt to load the configuration file in Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/Users/ish-ts/Projects/NCPD-GitHub-Actions", query: None, fragment: None }
βββbiome_fs::fs::os::OsFileSystem::open_with_options{path="/Users/ish-ts/Projects/NCPD-GitHub-Actions/biome.json", options=OpenOptions { read: true, write: false, truncate: false, create: false, create_new: false }}
βββ
βββbiome_fs::fs::os::OsFile::read_to_string{}
βββ
βββbiome_json_parser::parse{}
βββ
ββ 49s INFO biome_lsp::session Loaded workspace setting
ββ 49s INFO biome_lsp::session Attempt to load the configuration file in Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/Users/ish-ts/Projects/ENV-GitHub-Test", query: None, fragment: None }
βββbiome_fs::fs::os::OsFileSystem::open_with_options{path="/Users/ish-ts/Projects/ENV-GitHub-Test/biome.json", options=OpenOptions { read: true, write: false, truncate: false, create: false, create_new: false }}
βββ
Not sure what's going on, it's definitely something about the workspace you're using.
Please provide specifics about your workspace.
Would be interesting to see the permissions on that biome.json
file before and after.
ls -la /Users/ish-ts/Projects/NCPD-GitHub-Actions/biome.json
Thank you for your deep investigation. I'm using VSCode workspace settings below.
project.code-workspace
{
"folders": [
{
"name": "NCPD-GitHub-Actions",
"path": ".."
},
{
"name": "ENV-GitHub-Test",
"path": "../../ENV-GitHub-Test"
},
{
"name": "NCPD-GitHub-Monitoring",
"path": "../../NCPD-GitHub-Monitoring"
}
]
}
NCPD-GitHub-Actions
has biome.json
at its root, but ENV-GitHub-Test
and NCPD-GitHub-Monitoring
doesn't. Is that some of the reason?
Would be interesting to see the permissions on that
biome.json
file before and after.ls -la /Users/ish-ts/Projects/NCPD-GitHub-Actions/biome.json
Permisson hasn't changed (-rw-r--r--@
).
BTW, the .ts file I want to edit is under NCPD-GitHub-Actions
.
We're going to need a minimal reproduction.
Create a fresh repo, and inside reproduce the structure of your workspace, but only provide the smallest amount of files that trigger the issue.
Without that, it's virtually impossible to help you troubleshoot.
@nhedger I've created minimal reproduction. https://github.com/Hoshock/Biome-Issue304-Reproduction
@nhedger I've created minimal reproduction. https://github.com/Hoshock/Biome-Issue304-Reproduction
Thanks, will look into it !
I'm afraid I can't reproduce it following your instructions :/ (using the latest nightly)
Just in case, did you open default.code-workspace and enter the workspace (by clicking green open workspace button)? If I don't enter the workspace, the issue doesn't occur.
I opened the workspace by clicking the green button.
Hmm, I'll check if there are other factors.
I'll close this for now, we'll re-open when you circle back.
I was able to reproduce the issue on a mac
1876m ERROR biome_fs::fs Biome couldn't open the file "/Users/redactedbutitsdefinatelythere/packages/app/biome.json", reason:
β Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }
perms on that file are -rw-r--r--
I was able to fix the issue by forcibly giving full disk access to the binary file in mac os settings /Users/irdkwmnsb-mac/Library/Application Support/Code/User/workspaceStorage/0ade50184995cbb61ae311ac477de5d5/biomejs.biome/biome
After LSP server restart biome is able to read the settings, but only for a short moment.
But killing the process means it's path will change under the "workspaceStorage" and you would have to again give full disk access.
I was able to fix the issue by forcibly giving full disk access to the binary file in mac os settings
But that's probably just a coincidence since if the binary had no access to the file it wouldn't be able to change the source code of the files I want formatted, yet it can format
After more testing the issue persists even with the binary having full disk access
Will look into it more.
My set up is a workspace with subworkspaces for each app in a monorepo
I have a biome.json for one of the apps
@nhedger can we get this reopened? Still facing this issue on v2.3.0
VS Code version
1.92.1
Extension version
2.3.0
Biome version
1.8.3
Operating system
Description
I set
biome.json
andsettings.json
as follows.biome.json
settiings.json
It works well for typescript at first, but after a while (30 minutes or 1 hour?), code formatting on save breaks, which means it looks VSCode ignores biome.json and apply default format style. This will be fixed if I restart VSCode, but after a while, the same phenomenon happens. I also found it will be fixed if I do not restart VSCode and keep using VSCode for a while. I totally don't have any idea of this cyclic bug. Any ideas?
Steps to reproduce
Expected behavior
Consistent formatting is expected with biome.json.
Does this issue occur when using the CLI directly?
Not sure / Not applicable
Logs