-
Notifications
You must be signed in to change notification settings - Fork 664
feat(rome_lsp): read configuration file #2872
Conversation
1a97b28
to
3c70fbb
Compare
a415e4b
to
4a1cdf9
Compare
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.
Maybe we should consider deprecating loading the configuration from the editor settings. Would it be possible to emit a warning diagnostic in the vscode settings file if we detect a configuration section there ?
VSCode marks the removed settings with warning (yellow) underline. Those settings are marked as "BETA" in the VSCode interface. Maybe in the next release if the configuration file land and it's stable, we can just remove them directly. They were in BETA anyway. In the changelog we can add a paragraph as migration strategy. |
Summary
Closes #2861
This PR adds a feature to read the configuration
rome.json
file from the LSP. In order to do so, theSession
has been extended with two new properties:file_system
, the trait that we use to read filesconfiguration
, where we save the configuration read from the fileThere's an intentional limitation here, which is if the a configuration file is found and it doesn't throw any errors, the workspace settings will use all the settings coming from the configuration.
This means that if we both have a configuration file with
lineWidth
set to120
, and then we have also a custom line width in the VSCode extension set to160
, the LSP will use the one inside the configuration.Another intentional limitation is the fact that if we change the
rome.json
, the LSP won't pick the new change. In order to watch the change, we would need to enable the extension also for JSON language, but doing so would also enable the formatting for JSON files. Trying to format a JSON file, now, would emit a modal error inside VSCode. Not sure if that's what we want, but for now I left it out of scope.Test Plan
I manually created
rome.json
config file and opened a project.Here's the logging:
And when formatting a file, here's a piece of snippet: