[PATCH] D70807: [clangd] Prefer the left character if the character on the right of the cursor is semicolon.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 28 02:53:10 PST 2019


sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/clangd/Selection.cpp:517
+  // But if that's whitespace/semicolon, we likely want the token on the left.
+  if (isWhitespace(Buf[Offset]) || Buf[Offset] == ';')
     return {Offset - 1, Offset};
----------------
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.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70807/new/

https://reviews.llvm.org/D70807





More information about the cfe-commits mailing list