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

Incorrect syntax highlighting after some preprocessor directives #1598

Open
3 tasks done
yodapuces63 opened this issue Oct 29, 2022 · 1 comment
Open
3 tasks done
Labels
topic: theia Related to the Theia IDE framework type: imperfection Perceived defect in any part of project

Comments

@yodapuces63
Copy link

yodapuces63 commented Oct 29, 2022

Describe the problem

After #elif and #error, the text are wrong coloured
see de screenshot

2022-10-29_18-36-00

To reproduce

Copy this in editor

//---Config pour l'ESP-----------------------
#ifdef ARDUINO_ESP8266_GENERIC
  #define ESPMOD      //pour module ESP12
  #define TelNetDEBUG       //mode TelNet debug (via port 23)
//#define CommErTRACE         //TRACE les compteurs d'erreures de comm

//---Config pour le ProMini------------------
#elif ARDUINO_AVR_PRO
  #define PROMOD      //pour module ProMini

#else
  #error              //Si pas une de ces deux carte => Stop la compilation
#endif

Expected behavior

#elif definition should be blue
#error //comment should be green

Arduino IDE version

2.0.1

Operating system

Windows

Operating system version

10

Additional context

Additional reports

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details
@yodapuces63 yodapuces63 added the type: imperfection Perceived defect in any part of project label Oct 29, 2022
@per1234
Copy link
Contributor

per1234 commented Oct 30, 2022

Thanks for your report @yodapuces63.

This is an upstream bug that originates in the "TextMate" grammar hosted here:

https://github.com/jeff-hykin/better-cpp-syntax

That grammar is used by the "C/C++ Language Basics" extension built-in to VS Code and the Eclipse Theia IDE framework Arduino IDE 2.x is built on.

As they explain here, the fixes must first be made in the originating repository, from which they would eventually propagate to Arduino IDE through the dependency chain:

"This file has been converted from https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/syntaxes/cpp.tmLanguage.json",
"If you want to provide a fix or improvement, please create a pull request against the original repository.",
"Once accepted there, we are happy to receive an update request."

There are two separate issues here, both of which I verified also occur with v1.16.3 of the "Better C++ Syntax" extension installed in VS Code:

Inconsistent highlighting of expression following #elif directive

Minimal demonstration code:

#define FOO false
#define BAR false

#if FOO  // Coloration of expression is as expected

#elif BAR  // Coloration of expression is NOT as expected

#endif

image

I see there is an existing report here: jeff-hykin/better-cpp-syntax#532

Incorrect highlighting of comments following #error/#warning directives w/o message

Minimal demonstration code:

// Normal comment coloration

#warning foo  // Coloration of comment is as expected

#warning  // Coloration of comment is NOT as expected

#error bar  // Coloration of comment is as expected

#error  // Coloration of comment is NOT as expected

image

I did not find an existing report about this in the upstream repository, so I submitted one: jeff-hykin/better-cpp-syntax#611

@per1234 per1234 added the topic: theia Related to the Theia IDE framework label Oct 30, 2022
@per1234 per1234 changed the title Wrong Coloured after Compilation directive Incorrect syntax highlighting after some preprocessor directives Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: theia Related to the Theia IDE framework type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants