atom / language-c

C support in Atom
Other
116 stars 154 forks source link

Enhancement: Highlight unclosed #if/#ifdef/#elif/#else sections #322

Closed mcandre closed 5 years ago

mcandre commented 5 years ago

language-c does a decent job highlighting plain C code. However, C preprocessor directives in user source code files like #if ... with no closing #end directive, can lead to subtle downstream problems. Could we update the grammar to treat these situations as syntax errors, similar to unclosed brackets?

rsese commented 5 years ago

Chatted with another maintainer about this and they mentioned that with Tree-sitter, it does error recovery when it finds an error so it can't necessarily specifically say where an error occurred but what you're describing could be possible. At the same time however, it's not something that would get worked on right now since the team is prioritizing other work like bug fixes.

We'll reopen (or create a more general issue since this could apply across languages) if this is something that's picked up in the future.