argothiel wrote:

I agree that we don't need two helpers. The new method fixes the issues with 
the old one and could replace it.

Note that the logic in both methods is slightly different. 
`findTokenAfterCompletionPoint` assumes we're at the end of a token and is 
looking for the next token (ignoring whitespace); 
`findEndOfIdentifierContinuation` looks for the end of the identifier, parsing 
more thoroughly, and then we are already at the beginning of the next token.

This means we cannot reuse or rewrite the old method to express the new one: 
`findEndOfIdentifierContinuation` is a strictly more powerful primitive. On the 
other hand, we can express `findTokenAfterCompletionPoint` as 
`findEndOfIdentifierContinuation` + a raw-lex of one token from the returned 
location.

So the proposal: keep `findEndOfIdentifierContinuation` (it needs to be in 
`clang::Lexer` because it requires the lexer's internals), delete 
`findTokenAfterCompletionPoint` from clangd, and add a small raw-lex-one-token 
helper that takes the result of `findEndOfIdentifierContinuation` as input. 
Doing that unification would fix the FIXME at `CodeCompleteTests.cpp` by 
kirillbobyrev.

Happy to do it in this PR if you'd like, or split it into a follow-up to keep 
this one focused on InsertReplaceEdit and not changing the existing logic. Or 
maybe I should deliver the bug fix first and then return to this? What do you 
think?

https://github.com/llvm/llvm-project/pull/187623
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to