-
Notifications
You must be signed in to change notification settings - Fork 659
feat(rome_service): traverse upwards the fs to discover the config file #4224
Conversation
✅ Deploy Preview for docs-rometools canceled.
|
CI is failing on ubuntu... it seems the some code hits an infinite loop |
I like this idea and I think this is useful, nonetheless I would appreciate it if this could become an optional opt-in feature, for example with a flag |
let config_name = file_system.config_name(); | ||
let configuration_path = match base_path { | ||
BasePath::Lsp(ref path) | BasePath::FromUser(ref path) => path.join(config_name), | ||
let mut configuration_path = match base_path { |
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 think it would be helpful for users, if we could show a message when a rome.json configuration file was found using upwards-traversal (auto-search).
Alternatively, we could always show the path of the current rome.json configuration file (if any).
The from_parent
variable is a bool
primitive.
let mut configuration_path = match base_path { | |
let mut from_parent = false; | |
let mut configuration_path = match base_path { |
Are you open to having the feature opt-out, instead? I made the feature like this because it's used by the LSP too, and this is a feature requested by many users. And, as far as I understood, the prettier/eslint VSCode extensions do the same. What do you think? |
Yes of course, opt-out is fine. In Bazel, the path to the rome.json configuration path is set explicitly using the new |
Maybe auto-traversal could be disabled, when the |
That's a good suggestion! I like it! |
Summary
This PR adds a way to discover
rome.json
by traversing the file system upwards.Test Plan
I manually tested the feature using the CLI in our internal repository, and tested manually the VSCode extension.
Below a recording to demonstrate the feature:
Screen.Recording.2023-02-21.at.11.57.24.mov
Documentation