Repository navigation
Config: Report when a wrongly named config file is present - #1996
Merged
Merged
Conversation
`.herb.yml` stays the only configuration filename Herb reads, following the
convention used by Rails and most other Ruby tooling. A file named
`.herb.yaml`, `herb.yml`, or `herb.yaml` was previously either rejected with a
hard error (JavaScript and Rust) or ignored without a word (Ruby), so it looked
like the configuration simply had no effect.
All three runtimes now report the file instead, and the hard errors are gone:
⚠ Ignoring /project/.herb.yaml: Herb only reads `.herb.yml`. Rename it to `.herb.yml` to apply it.
The language server reports the same thing as a `wrong_file_extension`
diagnostic for every misnamed variant, not just `.herb.yaml`.
Co-authored-by: Kryštof Korb <krystof@korb.cz>
marcoroth
marked this pull request as ready for review
August 4, 2026 18:27
🌿 Interactive Playground and Documentation PreviewA preview deployment has been built for this pull request. Try out the changes live in the interactive playground: 🌱 Grown from commit ✅ Preview deployment has been cleaned up. |
commit: |
marcoroth
added a commit
that referenced
this pull request
Aug 4, 2026
Follow up on #1996, which started reporting a config file that Herb doesn't read, but only on the CLI: ``` ⚠ Ignoring /your-project/.herb.yaml: Herb only reads `.herb.yml`. Rename it to `.herb.yml` to apply it. ``` In the editor a `.herb.yaml`, `herb.yml`, or `herb.yaml` still showed nothing at all. That is the same impression the file already gives on its own, so the one place where the mistake is most likely to be made was also the one place that stayed quiet about it. The reason is that these documents never reached the language server. The VS Code document selector and the file watchers on both sides only ever matched `.herb.yml`, so the server was never told the file existed. This pull request opens that path and reports the file once it arrives. The document gets an error spanning its entire contents: ``` Herb only reads `.herb.yml`, so this file is ignored. Rename it to `.herb.yml` to apply it. ``` The status bar turns red and reads `.herb.yaml (Not Read)`, with a tooltip naming every misnamed file found and what to rename it to. Clicking it opens the file: <img width="2638" height="1954" alt="CleanShot 2026-08-04 at 21 17 06@2x" src="https://github.com/user-attachments/assets/6cda238c-852b-460d-adcf-fad4831eb0af" />
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inspired by #1678, which ran into a real friction point: creating
.herb.yamlinstead of.herb.ymldidn't work, and the way it didn't work was unhelpful..herb.ymlstays the only configuration filename Herb reads, following the convention used by Rails and most other Ruby tooling. Supporting both extensions at the same time would mean two places a setting can live, and it isn't obvious which one wins. The problem worth fixing isn't the filename, it's that a misnamed file looks like it should work.So
herb-lintwould hard fail in one situation, and in Ruby a.herb.yamlfull of carefully written excludes was silently doing nothing. The Ruby case is almost certainly how this gets discovered in the first place.This pull request replaces all of that with a warning at config discovery time, in every runtime:
The run continues instead of aborting, so a stray file can't block linting or formatting. Ruby prefixes it with
[Herb], matching the other warnings there.Detection also covers a missing leading dot, not just the wrong extension:
The warning fires whether or not a valid config exists, which covers the case a hard error never reached. With both files present,
.herb.ymlis still read and the.herb.yamlis reported as ignored:Passing a misnamed file explicitly is reported too, since
--config-file .herb.yamlpreviously fell back to discovery without saying so.Language Server
The
wrong_file_extensiondiagnostic already existed but only looked for.herb.yaml. It now reports every variant and derives the filename from the file it found:Supersedes #1678