Skip to content

Anything ending in _t is highlighted as if it was a valid type #2305

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

Open
3 tasks done
php4fan opened this issue Dec 10, 2023 · 1 comment
Open
3 tasks done

Anything ending in _t is highlighted as if it was a valid type #2305

php4fan opened this issue Dec 10, 2023 · 1 comment
Labels
type: imperfection Perceived defect in any part of project

Comments

@php4fan
Copy link

php4fan commented Dec 10, 2023

Describe the problem

I'm not fluent in C++.
I seemed to remember there was a type called address_t, so before I even googled it I just thought I'd try, and I wrote:

//......
int x = 8;
address_t idx = 0;
//...

As soon as I typed the "t" in "address_t", the supposed type name became highlighted in the same color as other correct types, like int in the line above.

So that made me think that it was correct.

Then I compiled, and it doesn't compile:

Compilation error: 'address_t' does not name a type

So I tried and replaced address_t with lkjsnldf_t and that gets highlighted too.

It's not because of the position either. If I write "lsdfnvlsdnv", it does not get highlighted.

Apparently anything ending in _t gets recognized as a valid type name.

To reproduce

Type:

kvbsv_t x = 0;

Expected behavior

kvbsv_t shouldn't get highlighted as a type name.

Arduino IDE version

2.2.1

Operating system

Linux

Operating system version

Manjaro Linux

Additional context

No response

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
@php4fan php4fan added the type: imperfection Perceived defect in any part of project label Dec 10, 2023
@kittaakos
Copy link
Contributor

This is Textmate token scope: support.type.built-in.posix-reserved.cpp support.type.posix-reserved.cpp source.cpp

Screenshot 2023-12-11 at 16 50 59

Steps to reproduce:

  1. Have a sketch (The funny thing is even the default cpp syntax coloring marks kvbsv_t as a type 👇):
void setup() {}
void loop() {}

kvbsv_t x = 0;
  1. Execute the Developer: Inspect Token command,
  2. Select kvbsv_t

I got the same behavior from VS Code and the Theia Blueprint applicant. I doubt this is an issue in IDE2 or something we can fix, but I will investigate where the scope comes from VS Code or the no grammar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants