Fix: strip leading asterisk decoration from block doc comments - #22901
Fix: strip leading asterisk decoration from block doc comments#22901kivancgnlp wants to merge 1 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
|
Did you write the PR description using AI? I'm not sure you did, but if yes, please note that our AI policy forbids doing that. |
|
Looking at the code, it's pretty clear that you used AI for the code as well without disclosing it, also contrary to our AI policy. And I'm not sure it's properly reviewed either: I am pretty sure it's possible to implement the same thing using at most half the lines, and probably with better perf. |
Yes I used Claude for draft message but then I edit the message. |
|
So, this is also disallowed. Please take notice for the next time. |
Claude generated the initial code and tests. I reviewed the changes and tests by myself. I'm sorry that I discovered the policy afterward. I also evaluated possible pitfalls and alternative solutions. I’ll simplify the code. |
98508e8 to
42dc49c
Compare
Block doc comments (`/** ... */`) commonly decorate each line with a leading `*`. rust-analyzer previously left this decoration in the rendered docs, so hover and doc-link resolution saw literal `* foo` lines. Normalize the common `[ \t]*\*` prefix during doc extraction, mirroring rustdoc's `beautify_doc_string`, while keeping the source map offsets accurate for `find_ast_range`. Fixes rust-lang#1759
42dc49c to
de72f8f
Compare
|
|
Hi @ChayimFriedman2, just checking in on this one. As noted above, I simplified the implementation and removed the AI-generated parts entirely. The current version reflects my own review and manual testing (verified with a local rust-analyzer server and VS Code, doc-comment stars are stripped correctly, formatting stays intact, and the documentation link still resolves). Happy to make further changes if the simplified approach still isn't the right shape. Let me know what you'd like adjusted. |
Summary
*decoration from multiline block doc comments, matching rustdoc behavior.#[doc = "..."]attributes,*foo, and blocks without a consistent star column.Tests Passed :
cargo test -p hir-defcargo test -p ide -- hover doc_linkscargo test -p ide -- syntax_highlightingcargo fmt -p hir-def -p ide -- --checkcargo clippy -p hir-def -p ide --all-targets -- --cap-lints warnFixes #1759