[clang] [clang-tools-extra] [clangd] Add InsertReplaceEdit for code completion (PR #187623)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 19 19:49:32 PDT 2026


================
@@ -2230,16 +2274,54 @@ CompletionPrefix guessCompletionPrefix(llvm::StringRef Content,
   return Result;
 }
 
+// If Offset is inside what looks like argument comment (e.g.
+// "/*^*/" or "/* foo = ^*/"), returns the offset pointing past the closing "*/".
+static std::optional<unsigned>
+maybeFunctionArgumentCommentEnd(const PathRef FileName, const unsigned Offset,
----------------
argothiel wrote:

Maybe not consistent with finding the beginning of the comment (which is ASCII-only), but it's definitely more correct, and we always have Sema context here, so why not use it.

Finding the beginning of the comment can be fixed to use more comprehensive lexing in the future, but it's outside the scope of this change. As searching forward and backward are pretty different actions, it will be a separate code anyway.

https://github.com/llvm/llvm-project/pull/187623


More information about the cfe-commits mailing list