Skip to content
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

Should we disable editorconfig if .dir-locals is present? #148

Open
xuhdev opened this issue Nov 17, 2017 · 5 comments
Open

Should we disable editorconfig if .dir-locals is present? #148

xuhdev opened this issue Nov 17, 2017 · 5 comments

Comments

@xuhdev
Copy link
Member

xuhdev commented Nov 17, 2017

.dir-locals.el often specifies a lot of style settings (and can be more detailed). Should we disable editorconfig in this case? Or, at least, leave this option to be set in .dir-locals?

@jgkamat
Copy link
Contributor

jgkamat commented Apr 5, 2018

See #141 for a little more in-depth analysis.

I personally like the existing behavior (let dir-locals overwrite editorconfig values), but I think disabling editorconfig entirely when dir-locals are present seems good too. It would be nice to have this configurable too :)

@10sr
Copy link
Member

10sr commented Jul 23, 2018

Really sorry I totally forgot to respond to this thread.

IMO we don't need to worry about this, in most cases the values in .editorconfig and .dir-locals.el should be consistent so it should be "fixed" if values in .editorconfig and dir-locals are different.
And checking the existence of dir-locals configs will make impl a bit complicated...: what should be done if configs for c-mode is only defined in dir-locals and configs for js-mode only in .editorconfig?

AFAIK currently editorocnfig-emacs does not touch variables if they are not defined in .editorconfig (so the values from dir-locals will be used if defined), and it is OK.

@anholt
Copy link

anholt commented Aug 1, 2018

It would be nice if editorconfig in a subdirectory still applied if .dir-locals.el isn't in that directory. Mesa has a top level dir-locals and editorconfig, and then also editorconfig in some subdirectories to override the top level behavior. Now I think the top level dir-locals overrides the local editorconfig.

@10sr
Copy link
Member

10sr commented Aug 2, 2018

Thanks!

It makes sense, but unfortunately it is difficult because editorconfig command cannot tell where values are defined... (for example when output of editorconfig /path/to/file is key1=value1, we cannot know if it is defined in /path/.editorconfig, or /path/to/.editorconfig)
It is true that t is possible to implement editorconfig-core.el so that it can do this, but I don't like the idea of providing features that editorconfig-core-c does not provide.

@10sr
Copy link
Member

10sr commented Jun 2, 2024

I added two variables editorconfig-override-file-local-variables and editorconfig-override-dir-local-variables in #338 . When these variables are set to nil, editorconfig plugin does not override local variable values. 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants