[clang-tools-extra] [clangd] Fix crash on completion with out-of-range position (PR #196112)
Krzysztof Jędruczyk via cfe-commits
cfe-commits at lists.llvm.org
Thu May 7 03:57:24 PDT 2026
kjedruczyk wrote:
The reason I haven't changed the result of `shouldRunCompletion` is twofold:
1. If we return false, we'll just reply with empty result as you noticed, logging `vlog("ignored auto-triggered completion, preceding char did not match");`. I'm not sure this is the intended behaviour of the API - I assumed passing invalid location should be reported to the client as error as it shouldn't really happen. Unless we change the signature of `shouldRunCompletion` we can't really trigger error response from there.
2. There's already precedent for letting the completion code handle error reporting in the line before (the `getDraft` call can return nullptr - we still return `true` there knowing the completion code will return error to the client).
Would we rather prefer silently (from client's perspective) ignoring the invalid position?
https://github.com/llvm/llvm-project/pull/196112
More information about the cfe-commits
mailing list