This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Prefer the left character if the character on the right of the cursor is semicolon.
ClosedPublic

Authored by hokein on Nov 28 2019, 2:31 AM.

Details

Summary

This would make go-to-def works on the cases like int A = abc^;

Diff Detail

Event Timeline

hokein created this revision.Nov 28 2019, 2:31 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 28 2019, 2:31 AM

Build result: pass - 60338 tests passed, 0 failed and 732 were skipped.

Log files: console-log.txt, CMakeCache.txt

sammccall accepted this revision.Nov 28 2019, 2:47 AM
sammccall added inline comments.
clang-tools-extra/clangd/Selection.cpp
517

Would you mind preserving the prev-character check?
I don't know how to observe it in tests, but when debugging SelectionTree (e.g. for (;;)) it's nice to have the internal state be what you expect.

I'd suggest extracting a lambda IsIgnoredChar or so to keep the condition simple.

This revision is now accepted and ready to land.Nov 28 2019, 2:47 AM
hokein updated this revision to Diff 231404.Nov 28 2019, 4:11 AM
hokein marked an inline comment as done.

address comments.

This revision was automatically updated to reflect the committed changes.