This is the initial version. The cross-file rename is purely based on
the index (plus a text-match verification).
It is hidden under a command-line flag, and only available for a small set
of symbols.
Differential D69263
[clangd] Implement cross-file rename. hokein on Oct 21 2019, 8:13 AM. Authored by
Details
This is the initial version. The cross-file rename is purely based on It is hidden under a command-line flag, and only available for a small set
Diff Detail
Unit Tests
Event TimelineThere are a very large number of changes, so older changes are hidden. Show Older Changes Comment Actions Build result: fail - 33608 tests passed, 1 failed and 462 were skipped. failed: LLVM.tools/llvm-ar/mri-utf8.test Log files: cmake-log.txt, ninja_check_all-log.txt, CMakeCache.txt Comment Actions Thanks for implementing this. Would definitely be nice to have some unit-tests for this. Another important concern is surfacing errors to the users: silently dropping ranges for stale files is definitely not the nicest option, I'm afraid this will lead to non-explainable failure modes and users will be incredibly unhappy...
Comment Actions Thanks for the comments. Agree, I think we should surface this error to users when the index is stale or we don't have enough confident to perform the rename. Thinking more about this -- we have a dynamic index (for all opened files) which is overlaid on a static index (which is a background index in open-source world), so for all affected files, they are either in
Comment Actions Not sure that holds. What if the file in question is being rebuilt right now? We do not wait until all ASTs are built (and the dynamic index gets the new results).
To summarize, I think files can be stale in both cases and we should patch the ranges in both cases. Comment Actions I'm not sure this would happen quite often in practice (probably depends on users' behavior). but yes, patching ranges would mitigate this issue.
I have the same feeling of using dirty buffers for open files, let's discuss offline.
Comment Actions Build result: fail - 59475 tests passed, 2 failed and 805 were skipped. failed: Clangd.Clangd/rename.test failed: LLVM.tools/llvm-ar/mri-utf8.test Log files: cmake-log.txt, ninja_check_all-log.txt, CMakeCache.txt Comment Actions Build result: fail - 59518 tests passed, 1 failed and 763 were skipped. failed: Clangd.Clangd/rename.test Log files: cmake-log.txt, ninja_check_all-log.txt, CMakeCache.txt
Comment Actions Based on the offline discussion, we decide to use dirty buffers for opened files.
Comment Actions Build result: fail - 59520 tests passed, 1 failed and 763 were skipped. failed: Clangd.Clangd/rename.test Log files: cmake-log.txt, ninja_check_all-log.txt, CMakeCache.txt
Comment Actions address comments:
Comment Actions Build result: pass - 59701 tests passed, 0 failed and 763 were skipped. Comment Actions Thanks, mostly LG! The only important comment I have left is about limiting the number of references. Others are NITs.
Comment Actions Build result: pass - 59816 tests passed, 0 failed and 762 were skipped.
Comment Actions Build result: pass - 59816 tests passed, 0 failed and 762 were skipped.
Comment Actions address comments:
Comment Actions Build result: pass - 59816 tests passed, 0 failed and 762 were skipped.
Comment Actions Build result: fail - 59795 tests passed, 21 failed and 762 were skipped. failed: lld.ELF/linkerscript/filename-spec.s failed: Clang.Index/index-module-with-vfs.m failed: Clang.Modules/double-quotes.m failed: Clang.Modules/framework-public-includes-private.m failed: Clang.VFS/external-names.c failed: Clang.VFS/framework-import.m failed: Clang.VFS/implicit-include.c failed: Clang.VFS/include-mixed-real-and-virtual.c failed: Clang.VFS/include-real-from-virtual.c failed: Clang.VFS/include-virtual-from-real.c failed: Clang.VFS/include.c failed: Clang.VFS/incomplete-umbrella.m failed: Clang.VFS/module-import.m failed: Clang.VFS/module_missing_vfs.m failed: Clang.VFS/real-path-found-first.m failed: Clang.VFS/relative-path.c failed: Clang.VFS/test_nonmodular.c failed: Clang.VFS/umbrella-framework-import-skipnonexist.m failed: Clang.VFS/vfsroot-include.c failed: Clang.VFS/vfsroot-module.m failed: Clang.VFS/vfsroot-with-overlay.c Log files: console-log.txt, CMakeCache.txt
Comment Actions Build result: fail - 59861 tests passed, 21 failed and 763 were skipped. failed: lld.ELF/linkerscript/filename-spec.s failed: Clang.Index/index-module-with-vfs.m failed: Clang.Modules/double-quotes.m failed: Clang.Modules/framework-public-includes-private.m failed: Clang.VFS/external-names.c failed: Clang.VFS/framework-import.m failed: Clang.VFS/implicit-include.c failed: Clang.VFS/include-mixed-real-and-virtual.c failed: Clang.VFS/include-real-from-virtual.c failed: Clang.VFS/include-virtual-from-real.c failed: Clang.VFS/include.c failed: Clang.VFS/incomplete-umbrella.m failed: Clang.VFS/module-import.m failed: Clang.VFS/module_missing_vfs.m failed: Clang.VFS/real-path-found-first.m failed: Clang.VFS/relative-path.c failed: Clang.VFS/test_nonmodular.c failed: Clang.VFS/umbrella-framework-import-skipnonexist.m failed: Clang.VFS/vfsroot-include.c failed: Clang.VFS/vfsroot-module.m failed: Clang.VFS/vfsroot-with-overlay.c Log files: console-log.txt, CMakeCache.txt Comment Actions Thanks, this is in a good shape!
Comment Actions LGTM. It's probably worth collecting a list of things we need to fix before enabling cross-file rename and putting it somewhere (a GitHub issue, maybe?)
There are definitely more.
Comment Actions Thanks, filed at issues#193.
Comment Actions Build result: pass - 60175 tests passed, 0 failed and 732 were skipped. |
NIT: rename to FE