[PATCH] D88881: [clangd] Add a NewName optional parameter to clangdServer::prepareRename.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 7 02:04:38 PDT 2020


hokein added a comment.

In D88881#2313863 <https://reviews.llvm.org/D88881#2313863>, @sammccall wrote:

> Can you add a bit more context to the commit message?
>
> And should we expose this as an extension on `textDocument/prepareRename`?

no needed right now. AFAIK, there are no lsp clients that would use that.



================
Comment at: clang-tools-extra/clangd/ClangdServer.cpp:404
                                  const RenameOptions &RenameOpts,
                                  Callback<RenameResult> CB) {
+  auto Action = [Pos, File = File.str(), CB = std::move(CB),
----------------
sammccall wrote:
> we can fail already here if the name is specified and empty
yeah, we could do that, but not sure this is a good idea:

- adding special-case code (I'd like to avoid)
- error-message might be re-prioritized -- if an invalid pos, and empty new name are passed through this API, we will emit error message "the name is empty" rather than "no symbol was found", I think "no symbol was found" is slightly more important than the "name is empty"; 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88881



More information about the cfe-commits mailing list