-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[READY] Add an option to make relative paths in flags from extra conf absolute #795
Conversation
Looks like Travis recently added the
We need to merge PR #793 first to add the Reviewed 4 of 4 files at r1. Comments from Reviewable |
27de625
to
e2e37c5
Compare
Codecov Report
@@ Coverage Diff @@
## master #795 +/- ##
==========================================
+ Coverage 94.75% 94.79% +0.03%
==========================================
Files 79 79
Lines 5317 5375 +58
Branches 170 170
==========================================
+ Hits 5038 5095 +57
- Misses 232 233 +1
Partials 47 47 |
e2e37c5
to
92991db
Compare
I worry that this is possibly a breaking change by default. By manipulating the paths when the new flag is not specified we are introducing silent change in behaviour, which I worry will break existing (working) installations. I am fairly certain that this would break my setup at work for example, where the relative nature of the include paths is accommodated in the make system integration. Review status: 3 of 4 files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
This only affects relative paths. Are you passing relative paths to libclang? What's the expected behavior in that case? Seems undefined to me. Reviewed 1 of 1 files at r2. Comments from Reviewable |
I'm pretty sure we pass -I. and it is interpreted relative to the TU. Memory could be off in that. Passing relative paths to a compiler is pretty normal behaviour. I suppose I t might be interpreted relative to the wd of ycmd, but (especially in the case of a global extra conf), I can't see a good justification for assuming that the YCM extra conf path as the root of such relative paths. The relative paths in a standard cc invocation are interpreted relative to the wd of the compiler when invoked which is (let's say) typically the path of the cc file. In the compilation database case, we set the calls relative to the compiler wd entry in the database, not relative to the compile commands file. Ofc every project is different, but that's why I'm nervous about making assumptions about users' project structure or paradigms. Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
I think @puremourning is right; this would break some people. We could perhaps do this without the new default of always resolving relative paths; we'd only do it when Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
Seems really convoluted to write include paths in its
Because that's natural. When writing relative paths in a file, users expect them to be relative to this file.
This defeats the purpose of this PR which is helping users writing I'd also like to point out that, in addition to being less than obvious (what is the actual working directory?), the current behavior for relative paths is undocumented. Do we want to go as far as not breaking backward compatibility for undocumented and obscure behavior? Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
The use case in question is where the flags are not actually writen into the In any case, the current behaviour actually relative to the ycmd wd: Given the following file structure:
with: ./test.h = #include <test.h>
#include <stdio.h>
int main()
{
printf( "%c", test );
} and def FlagsForFile( file_name, **kwargs ):
return {
'flags': [
'-x', 'c++',
'-I.'
]
}
I confess that it (currently) being relative to ycmd working directory is arbitrary. However, I'm still not convinced that making it relative to the If we were to pick a "default", I would suggest making it relative to the To be clear: I'm totally up for adding the Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
You convinced me. I'll update the PR to only make the paths absolute when Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed. Comments from Reviewable |
03533fb
to
3e66c3c
Compare
Maybe we should straight up call a spoon a spoon and call it |
3e66c3c
to
1bbb410
Compare
Not at all against a clearer name than
I'd say the proportion of users who learn how to write an extra conf file by taking ycmd's (which we link to from the docs) and then change it to suit them is >95%. :D So if we use it, they'll know about the option. Review status: 0 of 4 files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
1bbb410
to
bdcc993
Compare
5738dfe
to
94bf0db
Compare
dc313e4
to
5719ebb
Compare
[READY] Pin YCM extra conf version in documentation By linking to a specific version of [ycmd `.ycm_extra_conf.py` file](https://github.com/Valloric/ycmd/blob/master/cpp/ycm/.ycm_extra_conf.py) in the docs, users following the link won't copy a version of this file that's incompatible with the current version of YCM when that file is modified because of a change in our `.ycm_extra_conf.py` specs (like in PR ycm-core/ycmd#795), and ycmd submodule is not yet updated. Also, link to the raw file instead of the github page. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2737) <!-- Reviewable:end -->
5719ebb
to
c0cdb55
Compare
Add an option in .ycm_extra_conf.py file to specify the directory to which the include paths in the list of flags are relative. By default, these paths are relative to ycmd working directory.
c0cdb55
to
0f3aa20
Compare
Renamed the option to Reviewed 4 of 4 files at r3, 4 of 4 files at r4, 1 of 1 files at r5, 2 of 2 files at r6. Comments from Reviewable |
Reviewed 2 of 4 files at r4, 1 of 1 files at r5, 2 of 2 files at r6. Comments from Reviewable |
Thanks! Review status: all files reviewed at latest revision, all discussions resolved. Comments from Reviewable |
Seems to work as expected. Thanks.
Seeing that @puremourning was the last one asking questions, I'll let him trigger @zzbot.
Reviewed 2 of 4 files at r4, 1 of 1 files at r5, 2 of 2 files at r6. Comments from Reviewable |
Thanks! @zzbot r+ Review status: all files reviewed at latest revision, all discussions resolved, all commit checks successful. Comments from Reviewable |
📌 Commit 0f3aa20 has been approved by |
[READY] Add an option to make relative paths in flags from extra conf absolute Since PR #680, all the infrastructure is here to convert any relative paths in the list of flags from the `.ycm_extra_conf.py` file to absolute ones. We just need to use the `_MakeRelativePathsInFlagsAbsolute` function. This PR adds a new optional key `working_directory` to the dictionary returned by the `FlagsForFile` function in the `.ycm_extra_conf.py` file. This option allows specifying the working directory i.e. the directory for which the paths in the list of flags are relative to. Update YCM's own `.ycm_extra_conf.py` file to reflect this change. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/795) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
[READY] Update ycmd This new version of ycmd includes the following changes: - PR ycm-core/ycmd#795: add option to make relative paths in flags from extra conf absolute; - PR ycm-core/ycmd#802: fix compilation on Haiku; - PR ycm-core/ycmd#804: add libclang detection on FreeBSD; - PR ycm-core/ycmd#808: write python used during build before installing completers; - PR ycm-core/ycmd#810: support unknown languages from tags; - PR ycm-core/ycmd#811: update Universal Ctags languages list; - PR ycm-core/ycmd#814: resolve symlinks in extra conf glob patterns; - PR ycm-core/ycmd#815: update JediHTTP; - PR ycm-core/ycmd#816: update Boost to 1.65.0; - PR ycm-core/ycmd#819: filter and sort candidates when query is empty; - PR ycm-core/ycmd#820: improve LLVM root path search for prebuilt binaries; - PR ycm-core/ycmd#822: inline critical utility functions; - PR ycm-core/ycmd#824: do not sort header paths in filename completer; - PR ycm-core/ycmd#825: implement partial sorting; - PR ycm-core/ycmd#830: add max_num_candidates option; - PR ycm-core/ycmd#831: fix multiline comments and strings issues; - PR ycm-core/ycmd#832: update Clang to 5.0.0. The `g:ycm_max_num_candidates` and `g:ycm_max_num_identifier_candidates` options are added to the documentation. The link to ycmd extra conf is updated. Fixes #2562. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2768) <!-- Reviewable:end -->
[READY] Update ycmd This new version of ycmd includes the following changes: - PR ycm-core/ycmd#795: add option to make relative paths in flags from extra conf absolute; - PR ycm-core/ycmd#802: fix compilation on Haiku; - PR ycm-core/ycmd#804: add libclang detection on FreeBSD; - PR ycm-core/ycmd#808: write python used during build before installing completers; - PR ycm-core/ycmd#810: support unknown languages from tags; - PR ycm-core/ycmd#811: update Universal Ctags languages list; - PR ycm-core/ycmd#814: resolve symlinks in extra conf glob patterns; - PR ycm-core/ycmd#815: update JediHTTP; - PR ycm-core/ycmd#816: update Boost to 1.65.0; - PR ycm-core/ycmd#819: filter and sort candidates when query is empty; - PR ycm-core/ycmd#820: improve LLVM root path search for prebuilt binaries; - PR ycm-core/ycmd#822: inline critical utility functions; - PR ycm-core/ycmd#824: do not sort header paths in filename completer; - PR ycm-core/ycmd#825: implement partial sorting; - PR ycm-core/ycmd#830: add max_num_candidates option; - PR ycm-core/ycmd#831: fix multiline comments and strings issues; - PR ycm-core/ycmd#832: update Clang to 5.0.0. The `g:ycm_max_num_candidates` and `g:ycm_max_num_identifier_candidates` options are added to the documentation. The link to ycmd extra conf is updated. Fixes #2562. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2768) <!-- Reviewable:end -->
Since PR #680, all the infrastructure is here to convert any relative paths in the list of flags from the
.ycm_extra_conf.py
file to absolute ones. We just need to use the_MakeRelativePathsInFlagsAbsolute
function.This PR adds a new optional key
working_directory
to the dictionary returned by theFlagsForFile
function in the.ycm_extra_conf.py
file. This option allows specifying the working directory i.e. the directory for which the paths in the list of flags are relative to.Update YCM's own
.ycm_extra_conf.py
file to reflect this change.This change is