-
-
Notifications
You must be signed in to change notification settings - Fork 524
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
feat(config): add the includes field #4899
Conversation
8848003
to
6b34864
Compare
6b34864
to
53f9da6
Compare
53f9da6
to
d4f8b93
Compare
While I am testing the change, I noted some issues with our way of handling paths. Given the following hierarchy:
Biome will provide different paths to the glob matcher according to the command:
This was not causing any issue with We have to normalize the path provided on the CLI in order to solve the issue. I don't know how this affects our LSP. |
I was actually working on this PR before you mentioned that you were working on it, and I realised this, and I had already fixed the bug. When converting the We must apply this change in this PR, and once you'll do so we will have two tests that will break. You will realise that those regressions make sense because we don't apply |
@ematipico Thanks for the hint. Do you want to port your solution to this PR?
I already updated the failing tests. |
I will, thank you! |
I pushed my changes in Highlight of the changes:
|
f39271a
to
bc3bdb7
Compare
Is it normal that you didn't replace all occurrences of
Do you think we could eventually move the normalization in a higher level? |
I definitely missed them! Ooops
I think so, but that's not part of this PR but the traversal/workspace. Maybe we could strip the workspace directory from the file path inside the |
Fixed :) |
Released 0.9.16 :) |
@@ -1281,7 +1280,10 @@ fn does_not_format_ignored_files() { | |||
let mut console = BufferConsole::default(); | |||
let mut fs = MemoryFileSystem::default(); | |||
let file_path = Utf8Path::new("biome.json"); | |||
fs.insert(file_path.into(), CONFIG_FORMATTER_IGNORED_FILES.as_bytes()); | |||
fs.insert( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q: are we no longer using the constant here to improve maintainability (switching from an ignore-based configuration to an includes-based one with a negation)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure to understand what you mean.
This function is a test, I chose to use an inline configuration because this makes it easier to understand and edit the test.
This makes the test self-contained.
I don't know why we use constants in the first place: maybe to factorize some tests?
Most of them are only used by a single test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am going to merge the PR. Please let me know if I missed something. I will fix it in a future PR if needed.
fd3cd48
to
5d93da1
Compare
I updated |
Summary
Part of #4611
This PR adds the
includes
field.This PR is not a breaking change because I didn't remove
include
andignore
.I leave the removal of
include
andignore
to another PR.I also started a migration rule and decided to leave it for another PR.
I noted a minor "caveat": when we replace
ignore
withincludes
we have to add an include pattern to ensure that some files got processed.For example, the following config:
Have to be rewritten as:
I think it is fine.
Test Plan
I replaced all occurrences of
include
andignore
byincludes
in the tests.