-
Notifications
You must be signed in to change notification settings - Fork 105
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
Syntax Highlighting Improvements #284
Comments
Wow! Nice work. Thanks for putting this together. Now to solve them |
Really nice list. Quite a range on difficulty. |
Awesome work putting this together! |
@ehuss it might be an idea to create some issues which are "good first contribution" bugs and we can mark them as easy |
I added numbers to the list. If anyone wants to work on any, be sure to comment here which ones. I'll probably start working through the list sometime in the upcoming week. |
I'll take on # 20 |
Turns out # 20 could be as simple as adding !? to |
This makes a few changes to strings and byte/char literals: - Allow _ in unicode escapes. - Reject byte/char literals with too many chars. - Reject non-ascii in byte literals. - Reject ascii escape with >0x7f. - Reject bad escape sequences. cc rust-lang#284
This makes a few changes to strings and byte/char literals: - Allow _ in unicode escapes. - Reject byte/char literals with too many chars. - Reject non-ascii in byte literals. - Reject ascii escape with >0x7f. - Reject bad escape sequences. cc rust-lang#284
This makes a few changes to strings and byte/char literals: - Allow _ in unicode escapes. - Reject byte/char literals with too many chars. - Reject non-ascii in byte literals. - Reject ascii escape with >0x7f. - Reject bad escape sequences. cc rust-lang#284
got another one fn is_base64_char(c: u8) -> bool {
match c {
| b'A'...b'Z' | b'a'...b'z' | b'0'...b'9' | b'/' | b'+' | b'=' => true,
_ => false,
}
} the first |
This comment has been minimized.
This comment has been minimized.
This makes a few changes to strings and byte/char literals: - Allow _ in unicode escapes. - Reject byte/char literals with too many chars. - Reject non-ascii in byte literals. - Reject ascii escape with >0x7f. - Reject bad escape sequences. cc #284
This comment has been minimized.
This comment has been minimized.
Request (feel free to tell me if this is more appropriate as a separate issue): 31: support Hashed Syntax Highlighting for identifiers (https://www.sublimetext.com/docs/3/color_schemes.html#hashed_syntax_highlighting). Essentially you define a range of colors, and sublime will uniquely assign a color to each identifier, making them easier to distinguish from each other while still being collectively distinct from other syntax highlighting. There's an example here: https://www.sublimetext.com/blog/articles/sublime-text-3-point-1 |
@Lucretiel I believe the hashed color highlighting is part of your color scheme, not the syntax definition. |
Oh, my apologies! Will check it out.
…On Fri, Dec 7, 2018, 5:36 PM ehuss ***@***.*** wrote:
@Lucretiel <https://github.com/Lucretiel> I believe the hashed color
highlighting is part of your color scheme, not the syntax definition.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#284 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABvSrbSAbjhnRtIaDwTMh4g0qO49oNvMks5u2xeCgaJpZM4UOuYW>
.
|
I find that Result<(), Box<dyn Error>> |
@Boscop Unstable/unfinished nightly features are tracked in #333. In general, it is more helpful to file new issues for syntax issues, as they will likely be lost in the sea of comments. This issue was just to help organize problems found during a top-down review; I don't particularly want to keep adding to it. |
I've done a survey of syntax issues of some things I think can be highlighted better. Syntax highlighting can be subjective so it's not always clear how things should work. I'm thinking it would be preferred to try to address issues with individual PRs rather than trying to do massive changes, however, that might cause a lot of merge conflicts and may be a pain for @jasonwilliams to review (thoughts?). @dten would you be willing to help, or at least review changes or make suggestions?
1.
type-any-identifiers
not referenced.2. Global const and static values don't show up in goto symbol.
Const identifier should include
entity.name.constant.
(and possiblyvariable.other.constant.
?) and addentity.name.constant
toRustSymbols
.I'm not sure what scope static identifiers should have. Most other syntaxes don't seem to have special support.
3. Turbofish calls don't get colored the same as regular calls.
They get assigned
meta.path.rust
instead ofsupport.function.rust
.4.
mut
highlights weird when part of the type of a trait impl.I think it should be
storage.modifier
, not part of the name.5. Function and closure parameters don't highlight irrefutable patterns as regular parameters. I think it looks weird.
6. Newlines in closure arguments breaks highlighting.
7. Comments in strange places doesn't always work.
8. Macro calls should not break highlighting on unusual tokens. It would be nice to retain some Rust-like expression handling within macros since that is the common case, however, it shouldn't break down when given invalid syntax since macros can contain almost anything. I hit this most frequently with serde's macro where the
struct
keyword breaks highlighting until the next block closes.9. Add support for
dyn
trait object type keyword. See stabilizedyn Trait
in Rust 2015 rust#49218 for some valid/invalid examples.10. Hex codes above 0x7f are invalid in string escapes.
11. Unicode escape sequences can include underscores.
12. Tuple indexes show up with float highlighting. I don't think the dot should be highlighted (like a field access expression), but I'm uncertain if the number should be highlighted (probably not?).
13.
super
andself
when used as a path highlight differently, although they are generally the same thing. I think they should be the same (althoughself
should probably stay asvariable.language.rust
when used as a method parameter/variable).14. Support attributes for type or lifetime parameters. (48848)
15.
where
clauses tend to avoid highlighting much, leaving large blocks of unhighlighted text. Here are some examples, but there are probably many more.16.
for
as a trait bound does not highlight as a keyword in a few situations.17. Visibility modifiers on struct/union fields doesn't seem to support anything besides plain
pub
.18. enums don't highlight any generics.
19. Trait definitions don't highlight bounds or type parameters.
20. Opt-out trait impls highlight weird.
21. Type qualified paths highlight as less-than/greater-than operators when they shouldn't.
22. break/continue labels are highlighted as lifetimes, but probably should be
entity.name.label
.23. (2018) Anonymous lifetimes
24. match-beginning-vert (RFC #1925)
25. Macro blocks need to support semicolons between matches.
26. Lifetime bounds on a trait do not highlight as a lifetime.
27. Lifetime parameter in enum does not highlight as a lifetime.
28. Support unreserved keywords in 1.28.
pure
,sizeof
,alignof
,offsetof
. Andproc
from 1.27.29. Add lifetime specifier to macro_rules! (1.28)
30. Raw const pointer in function parameter is not highlighted correctly.
31. Raw pointer types still aren't quite right.
*const
and*mut
should be the same. I thinkmut
should bestorage.type
in this case. Also, it looks like*const
is getting confused withconst FOO
, so the type immediately after*const
is wrong.32. Closures fail to highlight in some positions. In this example the second closure fails.
33.
type
aliases do not properly handle generic arguments.Grammar references:
Currently tested on Rust Enhanced 2.11.0.
The text was updated successfully, but these errors were encountered: