-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
EditorConfig #8534
Comments
I switch between a project that uses tabs and a project that uses spaces multiple times a day and I have to remember to jump into my Zed config and change the global setting each time. |
For what it's worth, Zed now supports folder-specific configuration (via a |
The reason we implemented that instead of EditorConfig, is that EditorConfig is pretty limited in what it can express, whereas with our own |
Implementing I understand that it makes more sense to implement project-specific |
Supporting |
Folder-specific configuration is handsome! 👏 However, for all the good reasons above, I'd still keep this issue open as something to consider to implement at some point in future. |
Lack of editorconfig support is now the only blocker for me to start using this as my default editor. I work with too many shared repos to "just" set up custom settings for each to mirror its editorconfig. |
I got a really small ball rolling with this script (gist) that intents to generate a |
If you're using Prettier, {
"formatter": {
"external": {
"command": "node_modules/.bin/prettier",
"arguments": ["--stdin-filepath", "{buffer_path}"]
}
}
} |
@steve-taylor sure, thanks. |
There is already a lib that could handle the parsing: https://github.com/TheDaemoness/ec4rs. I don't know if it is well known enough for Zed, but might worth a shot. And now that Zed is OSS, maybe @TheDaemoness would even be interested in that contribution ? |
If there's interest from the maintainers, I could look into integrating ec4rs into zed (as a plugin? Please advise). |
+1 for supporting |
I would like to use Zed as my daily driver, and the lack of support for |
@JosephTLyons do you plan on having rust interaction capable extensions ? Also TBH it still feels like it should be out of the box to me (as it is in many places). This is kind of a standard, and it would help a lot to have it not being an extension to ensure people are following project guidelines correctly! |
The aim is to move the majority of languages to extensions, separating development and improvements from Zed. Then, pick multiple language extensions that can be used out of the box. |
It still could be a language we ship directly - we havent fully decided which languages will be ultimately shipped and which ones will be made into extensions - I just moved all language requests into this repo to clean up the issues in the Zed repo. We can always move things into Zed, if it makes sense. |
I think there is a confusion here. The support of the editor config language is not the most important. What matters most is that it is used by zed to properly format the code. Hence I'm not sure it is about the language more than it is about the integration into Zed's settings. I don't want to talk for everyone, but for me that's the most important part. |
Yes, it's about supporting the editorconfig file for defining editor settings. As far as the language goes, I'm pretty sure it is just standard |
Yes, this issue is about making |
I see what you're saying. The fact that it was moved to this extensions repo confused me. I'm not sure this can be made into a plugin if we're talking about Zed inheriting the |
Ok, I understand this a bit more now. I've moved the issue back to the Zed repository. Thanks for bringing these details up (I've never messed with editorconfig myself). |
BuonOmo posted such a script in a comment up above. |
This kind of functionality can't currently be added through a Zed extension. Extensions only allow adding grammars, languages, and themes. |
I created a more elaborate solution at https://gitlab.com/bersace/zeditorconfig $ go run gitlab.com/bersace/zeditorconfig@latest This will handle braces, brackets and directory prefix. 🇫🇷 Merci @BuonOmo pour le script original en Ruby, je m'en suis inspiré ! It's my first project wrote entirely using Zed & lazygit, under Linux. It's awesome !! |
Sorry guys, but
Nothing worse than opening a PR and the project leader telling you “your PR is breaking our indentation and EOF that we have enforced on |
I think there's enough traction on this... I'll open a PR during next week! If any of you would like to pair on that during the week, email me :) |
@BuonOmo looking forward to that! |
Just to summarize current status:
|
The PR in question: #16349 Two main problems with it that it new plugin API now needs to pass a file path to get a language setting for, which was not the case before; and the fact that the PR changes the place to make a recursive FS lookup in a method, that is called during rendering, potentially up 120 times per second... To make it closer to amortisized O(1) without any FS checks, quite a different code has to be written, even the one in the code of the feature, related to parsing and merging the actual files. I've described a way to implement this in one of the comments to the PR #16349 (comment) and this has to wait before ssh remoting feature forms into some public form, otherwise the development work related to that ssh remoting might change things a lot, as it already did since the time the PR was open. |
Closes #8534 Supersedes #16349 Potential concerns: * we do not follow up to the `/` when looking for `.editorconfig`, only up to the worktree root. Seems fine for most of the cases, and the rest should be solved generically later, as the same issue exists for settings.json * `fn language` in `AllLanguageSettings` is very hot, called very frequently during rendering. We accumulate and parse all `.editorconfig` file contents beforehand, but have to go over globs and match these against the path given + merge the properties still. This does not seem to be very bad, but needs more testing and potentially some extra caching. Release Notes: - Added .editorconfig support --------- Co-authored-by: Ulysse Buonomo <[email protected]>
it's already working ? |
How to use this ? |
What are you struggling with? You probably did follow this manual - there was no extra step for me, it just worked. |
actually it should just work, but I faced with issue when for example there is 2 projects
if we open with zed project |
EditorConfig is somewhat of an industry-standard these days. Although not a priority for me, you might want to take into consideration being compatible with existing EditorConfig configurations.
The text was updated successfully, but these errors were encountered: