-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature: Highlight constants #28
Comments
This is an example of semantic highlighting: requires scanning prior source code and collecting constant symbols. Can be CPU consuming. Other elements get coloring purely after their syntax. |
The editor will rescan the document on open and save events. If you added or removed a new constant, it won't be reflecting in highlighting until you save the document. It saves a lot of resources on background scanning. |
A small preview on const/variable highlighting: Note the difference:
Opinions? |
I think it should be unified into one color. In addition, I think blue is not very good. @x87 Can I modify the highlight color by myself in the menu settings? |
It uses Variable color. |
The variable name uses the variable color (blue), and the constant name uses the color of the data type. I think the color in your example is indeed fine. |
@x87 Does Constants highlight support header files? I believe that many people write large cleos and usually use header file instructions to insert code. When I write const...end in the header file, will the code name of the cleo file be highlighted after my cleo uses the header file instruction? |
Good point! Yes it definitely should, however it makes it a bit more complicated. I will look into it |
Constants highlighting can be previewed in 3.7.0-alpha.0 Constants highlighting only works after file save/open events. It also accounts for included files. |
@x87 I did a highlight test for the new version. There is no problem with the highlighting of the declared data type (int float). However, the highlighting of const_end does not support the highlighting of hexadecimal data names:
Another strange question. It seems that for some cleo I wrote before, I opened the source code txt with SB, const will not be highlighted, even if I modify and save them, it still will not be highlighted. I noticed that the language service status of the lower display panel is "Disabled" , To be honest, I don't understand its meaning too much, but this kind of txt will not be highlighted. An additional question: highlighting will only be displayed after the file is saved. This seems inconvenient to write. Shouldn't this be your final plan? Is it possible to highlight when writing? |
thanks for noticing, I missed this.
Interesting. Do you have any Unicode characters in the opened file path? Do you have Language service enabled in the options (F10->Editor tab).
That was my initial plan to offload main thread and not block rendering. Now that I have a separate service that scans files in background I can probably revisit the initial approach and try to scan symbols in-memory. I will think about it. |
Any non-English paths are currently not supported. There is also a new problem:
@x87 When there is a comment behind, it will not be highlighted |
@XMDS Thanks for your feedback. I have published alpha.1 with some of the issues addressed. Please check it out: |
@x87 The alpha 1 version of the highlight has been greatly improved. But some minor problems:
ConstVar.txt:
CLEO.txt:
cleo.txt will not be highlighted. This hierarchical header file should be supported 3.The last problem is still an old one, just like SB does not support non-English paths since 3.6.0, highlighting usually does not support non-English paths, even if we use non-English naming cleo, it also does not support highlighting. |
this is by design. When you open CLEO.txt as a separate document in Sanny it has the isolated file tree. CLEO.txt does not have references to other files or const declarations so there is nothing to highlight. If you try to compile CLEO.txt Sanny throws an error as it does not know what _PLAYER is. _PLAYER will be highlighted only in the main document (one with $INCLUDE) and in ConstVar.txt. |
Can you please provide a screenshot of Sanny Builder window so I know what files you have opened and what symbols are not highlighted? |
When i open: @x87 I just tested it again, some cleo.txt is opened, and a few lines need to be added or deleted, otherwise it will not be highlighted |
In addition, I noticed that even if there are non-English characters behind the comment "//", they will still not be highlighted after saving it. |
@x87 I encountered a new problem. I am not sure how they came about. Maybe it is because the cleo code is long and bright, or it is caused by other reasons. I was writing cleo, and an error message appeared: |
@XMDS do you have sanny.log file next to sanny.exe? it may have some extra details regarding last error |
@x87 My latest crash just now:
|
@XMDS Please try alpha.2 version. It should be much more stable now. |
Let syntax highlighter colorize constants using the same rules as for values they represent.
The text was updated successfully, but these errors were encountered: