-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-markdown-parsingArea: Markdown parsing for doc-commentsArea: Markdown parsing for doc-commentsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.
Description
At the moment, rustdoc uses only the lexer to do syntax highlighting (#75775). This has the benefits of simplicity & performance, and gets us 80% of the way quality wise, but it is not perfect. For example, lexer-based highlighting can't properly detect contextual keywords, glued/split operators, etc.
We can and probably should make this better, though this requires a lot of fundamental work on IDE-ification of the compiler
- the simple thing we can do is to use better heuristic to glue token (Use rustc_lexer for rustdoc syntax highlighting #75775 (comment))
- the next step is to use parser & syntax tree for highlighting. This probably should be done after parser library-ification (Form t-compiler/wg-parser-library compiler-team#338)
- the final step is to overlay semantic info, so that references are colored the same way as the things they refer to (which includes "clicking on the name should open the name's definition" as a subtask). This is already available in rust-analyzer, but will take some time to percolate to rustdoc
jyn514, camelid and pickfire
Metadata
Metadata
Assignees
Labels
A-markdown-parsingArea: Markdown parsing for doc-commentsArea: Markdown parsing for doc-commentsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant to the rustdoc team, which will review and decide on the PR/issue.