Improved config path resolution#18
Conversation
|
Hi, I don't think this is handled correctly here, I think is better if you open an issue. |
|
What is wrong in your opinion @ManuLinares ? I didn't know popular formatters had this features, but it seems to be pretty common (clang-format does it apparently). I don't really like the idea of a |
|
@lmichaudel this approach is used by Prettier and mentioned in the Zed documentation: https://zed.dev/docs/reference/all-settings#formatter The other option is to provide formatting via the LSP server, slightly slower but also doable. I'm trying to improve the editor experience in small steps :) If you prefer I can separate this change from the path resolution, which is useful in its own right. |
|
Ok I buy it 👍 I will still wait for @ManuLinares opinion before merging that though. |
|
adding "--stdin-filepath" is fine, no I was referring at the code itself, it's bad, that's why I was proposing ricardo to make an issue instead and lucas (or somebody else) can implement it correctly. 👍️ |
9dedd0a to
0a6697e
Compare
|
@ManuLinares thanks for the candor! I'm new to the language and trying to speed-run it with AI. I've refactored the code to use the stdlib, simplify the loop, match the existing style, and removed unnecessary comments. Hope this is better, otherwise feel free to close and I'll open an issue instead. |
|
Seems fine now but haven't properly tested it. |
I noticed that when formatting a single file, the
.c3fmtconfig is not picked up from a parent directory:The same happens when opening a standalone .c3 file in an editor (Zed in my case) and formatting via
--stdin.This PR fixes that by:
--stdin-filepathto provide the file path to the formatter along--stdinIncidentally this allows having a global config at
$HOME/.c3fmt- which I find quite useful as my preference deviates from the defaults.Example Zed config: