kadircet added inline comments.

================
Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:254
+    // Remove the ending sentinal "*/" from the block comment range.
+    if (Code.substr(EndOffset(*LastComment) - 2, 2) == "*/") {
+      End.character -= 2;
----------------
this is actually not true, we might have `// foo */`, so we need to check if it 
has `/*` in the beginning again.

also can we have it in an explicit variable instead `bool IsBlockComment`


================
Comment at: clang-tools-extra/clangd/SemanticSelection.cpp:259
+      // Always show last line of a block comment.
+      if (Code.substr(StartOffset(*LastComment), 2) == "/*" &&
+          StartPosition(*LastComment).line != EndPosition(*LastComment).line) {
----------------
so it actually gets pretty annoying with mixture of block and line comments 
back to back, but also with multiple block comments back to back, e.g:

```
/* foo
  * bar*/
```

vs

```
/* foo */
/* bar */
```

vs

```
// foo
/* bar */
```

which is rare, so i don't think it's worth handling. but at least to make it 
consistent, rather than checking for the start/end lines of the lastcomment, we 
should actually be looking at the whole range and whether we've started the 
range with a blockcomment. (sorry for noticing it too late)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131154

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to