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

Add IDE analyzer for invalid .editorconfig files #19055

Open
sharwell opened this issue Apr 27, 2017 · 9 comments
Open

Add IDE analyzer for invalid .editorconfig files #19055

sharwell opened this issue Apr 27, 2017 · 9 comments

Comments

@sharwell
Copy link
Member

Version Used: N/A

Steps to Reproduce:

Add an invalid .editorconfig (cannot be parsed).

Expected Behavior:

A warning appears in the IDE that the .editorconfig file is ignored due to errors parsing it.

This error cannot occur during builds (compat issue), so it needs to be an IDE analyzer only.

@Pilchie
Copy link
Member

Pilchie commented May 26, 2017

Sadly, this editorconfig work isn't going to fit for 15.3, but we're going to continue targeting the next foundation update.

@jinujoseph jinujoseph modified the milestones: 15.5, 15.7 Oct 14, 2017
@jinujoseph jinujoseph modified the milestones: 15.7, Unknown Nov 1, 2017
@jasonmalinowski jasonmalinowski removed their assignment Nov 6, 2017
@tannergooding
Copy link
Member

👍 on this. I have hit multiple issues now (typos, forgetting to add the capitalization option for a naming style, etc).

Not getting any output indicating this badness and having to debug into this is a major pain.

@sharwell
Copy link
Member Author

This should be added for naming styles if for no other reason.

@Youssef1313
Copy link
Member

@sharwell @mavasani @CyrusNajmabadi My initial thoughts on this is it will be divided into two parts:

  • Compiler: Reports a hidden diagnostic for parsing/syntax errors. This diagnostic will be used the same way as the unused using one. This is because the compiler is what's responsible for parsing the editorconfig.
  • IDE side: Reports the hidden diagnostic and also diagnostics for invalid option names/values. This is because the compiler doesn't know anything about the code-style options available.

What do you think on that?

@Eli-Black-Work
Copy link

I was initially all for this, but now that VS2022 comes with a GUI-based .editorconfig editor, I wonder how relevant this is.

Even when my .editorconfig file contains rules for non-.cs files, VS still opens it in the GUI-based editor, so I have to edit .editorconfig files via notepad. (Is that a bug that I should file?)

Given this, then I if my .editorconfig file only contains rules for .cs files, I'm not sure how helpful this analyzer would be, since the GUI-based .editorconfig editor ensures that the resulting .editorconfig file is always correct. If my .editorconfig file contains rules for non-.cs files, then the analyzer still might not be too helpful, because I can't easily use VS to edit these types of .editorconfig files anyway 🙂

I guess the main use case would be that if I edited my .editorconfig file via an external editor and got the syntax wrong, then VS would show a warning, which would be nice 🙂

@Eli-Black-Work
Copy link

Ah, NVM, I just found #53120, so it sounds like this analyzer is still relevant 🙂

@paul1956
Copy link
Contributor

There is also a need to include check for conflicts and duplicate entries, the current GUI adds missing entries that duplicate dedicated entries below. I entered as separate issue on that and the fact that it adds missing entries that can conflict.

@sharwell
Copy link
Member Author

the current GUI adds missing entries that duplicate dedicated entries below

This is caused by #59325. The UI is expected to only ever add items that the user has changed.

@sharwell
Copy link
Member Author

Here's a case where the same property was defined multiple times, but the user was not aware:
https://developercommunity.visualstudio.com/t/editorconfig-and-IDE0160/10727150

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

10 participants