Skip to content

Syntax coloring stops after long Strings #1723

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

Closed
3 tasks done
francwalter opened this issue Nov 30, 2022 · 8 comments
Closed
3 tasks done

Syntax coloring stops after long Strings #1723

francwalter opened this issue Nov 30, 2022 · 8 comments
Assignees
Labels
conclusion: duplicate Has already been submitted type: imperfection Perceived defect in any part of project

Comments

@francwalter
Copy link

Describe the problem

I have Arduino IDE 2.0.2 and I have some long concatenated Strings. At the end of the String I can see that the Syntax Coloring stops working, all is brown now:

grafik

Here is the end of that string:

grafik

To reproduce

Create a very long string and see how the Syntax Coloring stops working after.

Expected behavior

It should still color variables etc.

Arduino IDE version

2.0.2

Operating system

Windows

Operating system version

10

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
@francwalter francwalter added the type: imperfection Perceived defect in any part of project label Nov 30, 2022
@kittaakos
Copy link
Contributor

I have some long concatenated Strings

Can you share a snippet? Maybe related #1614

@francwalter
Copy link
Author

You are perfectly right, this is a dupe :)
Sorry for it, didnt find it.
Could just resolve it with:
CTRL+SHIFT+P > Preferences: Open Settings (UI) > editor.maxTokenizationLineLength = 750 (UI / Workspace)
Closed the IDE and reopen and all colors back again :)
My line was 619 characters, by the way.
Thank!
frank

@CptHolzschnauz
Copy link

750 is IMHO a fair value for perfomance vs. avoid this issue. In my case, it led to strange compiler behaviour vs. a minority have this long lines. Computers are fast nowadays.

@kittaakos
Copy link
Contributor

In my case, it led to strange compiler behaviour

Syntax coloring and compilation are unrelated. Do you have a reproducible example, I am happy to look into it.

@CptHolzschnauz
Copy link

No, not really reproducable (Just happend on one system).
The behaviour was:

  • Unformatted : Compiles
  • Autoformatted : Error from the compiler
    At the end, the ide went mad with formatted serial monitor and flaky behaviour:

screenshot_mad_ide

After reinstall, it was fine again, so not worth your time to sort out.

Ergo: Root cause for the IDE madness was, IMHO, that too long line, that's why i suggest 750
#1614

PS: I'll try to reproduce later and post a video, i can't share the source.
PS2: Thank you for all your effort and contributions kittakoos

@kittaakos
Copy link
Contributor

The behaviour was:

  • Unformatted : Compiles
  • Autoformatted : Error from the compiler
    At the end, the ide went mad with formatted serial monitor and flaky behaviour:

The formatter might have bugs and makes compiler errors (#1674), but the formatter is not the same as the syntax coloring. I think we are talking about different things. Anyway, if you have a reproducible sketch you can share, please do it, and I check what's going on.

@francwalter
Copy link
Author

francwalter commented Dec 1, 2022

I have a different question, a small one, dont want to open an issue and I dont find a discussion site in this repo:
In the Workspace Editor, when I press Enter to make a new line and the cursor is first at the identation of my code, but jumps to the very beginning of the next line, after about 2 seconds.
Can I disable this (maybe nice) feature?
Makes me more often use the arrow-keys 😏
Thank
I found this post about it: https://forum.arduino.cc/t/cursor-jumping-problem/1023535/5
and the setting: editor.trimAutoWhitespace (disable) fixes it, siehe issue 1669 :)
All good 😏

@per1234 per1234 added the conclusion: duplicate Has already been submitted label Dec 1, 2022
@per1234 per1234 self-assigned this Dec 1, 2022
@kittaakos
Copy link
Contributor

I have a different question, a small one, dont want to open an issue

No need to: #437 ;)

Can I disable this (maybe nice) feature?

This is very much likely the same issue as clangd/vscode-clangd#357, and it is not directly done by IDE2 but by the Arduino Language Server. We need to look into how to intercept and tweak the textDocument/completion. But this is just a guess so far.

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

No branches or pull requests

4 participants