This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.
Closed by commit rL367453: [clangd] Ignore semicolons, whitespace, and comments
in SelectionTree. (authored by sammccall, committed by ).
Herald added a project: LLVM.
Herald added
sammccall marked 2 inline comments as done.
sammccall added inline comments.
Comment at: clang-tools-extra/clangd/Selection.cpp:50
+ S.StartOffset = SM.getFileOffset(Tok.location());
+ S.EndOffset = S.StartOffset + Tok.length();
+ if (S.StartOffset >= SelBegin && S
SureYeaah added inline comments.
Comment at: clang-tools-extra/clangd/Selection.cpp:50
+ S.StartOffset = SM.getFileOffset(Tok.location());
+ S.EndOffset = S.StartOffset + Tok.length();
+ if (S.StartOffset >= SelBegin && S.EndOffset <= SelEnd)
Would
kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.
Thanks for the comments, LGTM!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65486/new/
https://reviews.llvm.org/D65486
_
sammccall updated this revision to Diff 212536.
sammccall added a comment.
Improve comments in SelectedTokens.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65486/new/
https://reviews.llvm.org/D65486
Files:
clang-tools-extra/clangd/Selection.cpp
sammccall added a comment.
It occurs to me that `claim` is `O(node_tokens + log total_tokens)` which is
bad when the nodes are large.
Indeed for an input like `namespace { namespace { namespace { ... } } }` time
is quadratic.
I think this is probably fine in practice. Against adversarial input
sammccall created this revision.
sammccall added reviewers: SureYeaah, kadircet.
Herald added subscribers: cfe-commits, arphaman, jkorous, MaskRay.
Herald added a project: clang.
Whitespace and comments are a clear bugfix: selecting some
comments/space near a statement doesn't mean you're selectin