ycmd
ycmd copied to clipboard
Switch source header
Implements clangd's SwitchSourceHeader feature. Currenly issued as a GoTo response that will jump to the first line and column of the corresponding header/source of the current buffer.
The main reasons for choosing SwitchSourceHeader are:
-
It maps directly to the clangd command name https://code.woboq.org/llvm/clang-tools-extra/clangd/ClangdLSPServer.h.html#130 Note that clangd also has commands of the GoTo* style, and it has decided against using that form for jumping to the source/header file.
-
It is more explicit than GoToAssociatedFile.
There are plusses and minusses to explicitness of course. The looseness of GoToAssociatedFile means that command could be repurposed for other types of jumps in other languages. The downside is if there ever came about another kind of jump in C/C++, that is if we had some notion of an associated file that is not the corresponding source or header and a server that can allow us to jump to it, then we would not be able to simple use GoToAssociatedFile for that. What might the associated file be if not the source or header? I don't know. Perhaps C++ 20 modules will have some need for something like that (or not, I am not read up on them) or a future version of the language.
But I'm not completely against GoToAssociatedFile either. Just wanted to raise my rationale.
I believe I've made all changes except for the name change to GoToAssociatedFile in e01b536f081aac73aa12c490553b059b8a3af46b If you still feel it should be GoToAssociatedFile given my rational above, then I'll go ahead and make that change as well.
Thanks for the updates! Looking good. Just a few style nits things to tidy up, and I think the tests are failing in CI ?
@MergifyIO rebase
rebase
✅ Branch has been successfully rebased
tests are failing
Seems abandoned.
@mergifyio rebase
rebase
☑️ Nothing to do
- [ ]
-closed
[:pushpin: rebase requirement]
@mergifyio rebase
⚠️ This pull request got rebased on behalf of a random user of the organization. This behavior will change on the 1st February 2022, Mergify will pick the author of the pull request instead.
To get the future behavior now, you can configure bot_account
options (e.g.: bot_account: { author }
or update_bot_account: { author }
.
Or you can create a dedicated github account for squash and rebase operations, and use it in different bot_account
options.
rebase
✅ Branch has been successfully rebased
I believe these tests could be fixed by the following changes. Unfortunately I'm not allowed to post these changes as a "suggestion" nor test them locally but maybe you'll want to give it a try.
--- ycmd/tests/clang/subcommands_test.py
+++ ycmd/tests/clang/subcommands_test.py
@@ -56,6 +56,7 @@ def RunGoToTest_all( app, filename, command, test ):
}
common_response = {
'filepath': os.path.abspath( PathToTestFile( filename ) ),
+ 'file_only': False,
}
if 'extra_conf' in test:
@@ -103,6 +104,7 @@ def RunGoToIncludeTest( app, command, test ):
'filepath' : PathToTestFile( 'test-include', test[ 'response' ] ),
'line_num' : 1,
'column_num' : 1,
+ 'file_only' : False,
}
Thanks @xpac27 - I've pushed that change. let's see.
Codecov Report
Merging #1623 (7dfda1c) into master (c65849a) will decrease coverage by
0.02%
. The diff coverage is100.00%
.
Additional details and impacted files
@@ Coverage Diff @@
## master #1623 +/- ##
==========================================
- Coverage 95.47% 95.45% -0.03%
==========================================
Files 90 90
Lines 8156 8164 +8
Branches 164 164
==========================================
+ Hits 7787 7793 +6
- Misses 318 320 +2
Partials 51 51
Thanks for sending a PR!