-
Notifications
You must be signed in to change notification settings - Fork 386
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
Make target completion doesn't work with subdirectories #544
Comments
I could reproduce 1 but not 2.
This seems to be $ git cat-file -p 1a633f3a551154ac3c70bfdc5263d73d8b3d9f3f:completions/make | md5sum
84866af8ff59c9e1698f90a8f3a67f22 - I tried with this version but still cannot reproduce behavior 2 (with bash 5.1.8 on Fedora 31). This is the diff of the trace ( --- trace1.txt^I2021-06-13 21:58:06.993893157 +0900
+++ trace2.txt^I2021-06-13 21:57:38.461345637 +0900
@@ -1,5 +1,4 @@
-+++ _on_command_start
-�[?2004h�[38;5;214mᛋ �[97;1mmake abc/+ local cur prev words cword split
+$ make abc/+ local cur prev words cword split
+ _init_completion -s
+ local exclude= flag outx errx inx OPTIND=1
+ getopts n:e:o:i:s flag -s
@@ -174,7 +173,6 @@
+ [[ abc/ =~ ^(\$(\{[!#]?)?)([A-Za-z0-9_]*)$ ]]
+ [[ abc/ =~ ^(\$\{[#!]?)([A-Za-z0-9_]*)\[([^]]*)$ ]]
+ [[ abc/ =~ ^\$\{[#!]?[A-Za-z0-9_]*\[.*]$ ]]
-+ case ${prev-} in
+ return 1
+ [[ abc/ == @(?([0-9])<|?([0-9&])>?(>)|>&)* ]]
+ [[ make == @(?([0-9])<|?([0-9&])>?(>)|>&) ]]
@@ -210,17 +208,16 @@
+ (( i < 2 ))
+ local mode=--
+ (( COMP_TYPE != 9 ))
-+ mode=-d
-++ _make_target_extract_script -d abc/
-++ local mode=-d
+++ _make_target_extract_script -- abc/
+++ local mode=--
++ shift
++ local prefix=abc/
+++ command sed 's/[][\,.*^$(){}?+|/]/\\&/g'
++ local 'prefix_pat=abc\/'
++ local basename=
++ local dirname_len=4
-++ [[ -d == -d ]]
-++ local 'output=\2'
+++ [[ -- == -d ]]
+++ local 'output=\1\2'
++ cat
++ [[ -z abc\/ ]]
++ [[ abc\/ == */ ]]
@@ -248,7 +245,7 @@
/^$/ { # end of target block
x; # unhold target
/^$/d; # dont print blanks
- s|^\(.\{4\}\)\(.\{0\}[^:/]*/\{0,1\}\)[^:]*:.*$|\2|p;
+ s|^\(.\{4\}\)\(.\{0\}[^:/]*/\{0,1\}\)[^:]*:.*$|\1\2|p;
d; # hide any bugs
}
@@ -301,7 +298,7 @@
/^$/ { # end of target block
x; # unhold target
/^$/d; # dont print blanks
- s|^\(.\{4\}\)\(.\{0\}[^:/]*/\{0,1\}\)[^:]*:.*$|\2|p;
+ s|^\(.\{4\}\)\(.\{0\}[^:/]*/\{0,1\}\)[^:]*:.*$|\1\2|p;
d; # hide any bugs
}
@@ -329,9 +326,5 @@
h; # hold target
d; # delete line
}'
-+ [[ -d != -d ]]
-����xyz
-�[C�[C�[Kset +x && exec 2>/dev/tty
-�[?2004l
-++ _on_command_start
-+ set +x
++ [[ -- != -d ]]
++ [[ abc/xyz == */ ]] This implies that $ _make_debug() { printf 'COMP_TYPE=%q\n' "$COMP_TYPE" >/dev/tty; } $ complete -F _make_debug make $ make abc/TAB |
I have |
OK. Thank you for the information! I could reproduce the behavior with I guess we should also check for Besides, it is a good suggestion to complete the full path |
In the display-only mode where COMP_TYPE=9, 37, or 42, only a part of the completion is stored in COMPREPLY for displaying purposes. For example, "xyz" is stored in COMPREPLY when "abc/xyz" is the candidate and "abc/" is already inserted. However, the test framework extracts generated completions using COMP_TYPE=37 by setting "set show-all-if-ambiguous off", which would be broken by the display-only mode. There is no simple way to make it work with the test framework, and the display-only mode does not seem to be essential. For the time being, we deactivate the display-only mode. See also discussions in the following links: scop#544 scop#546
In the display-only mode where COMP_TYPE=9, 37, or 42, only a part of the completion is stored in COMPREPLY for displaying purposes. For example, "xyz" is stored in COMPREPLY when "abc/xyz" is the candidate and "abc/" is already inserted. However, the test framework extracts generated completions using COMP_TYPE=37 by setting "set show-all-if-ambiguous off", which would be broken by the display-only mode. There is no simple way to make it work with the test framework, and the display-only mode does not seem to be essential. For the time being, we deactivate the display-only mode. See also discussions in the following links: scop#544 scop#546
In the display-only mode where COMP_TYPE=9, 37, or 42, only a part of the completion is stored in COMPREPLY for displaying purposes. For example, "xyz" is stored in COMPREPLY when "abc/xyz" is the candidate and "abc/" is already inserted. However, the test framework extracts generated completions using COMP_TYPE=37 by setting "set show-all-if-ambiguous off", which would be broken by the display-only mode. There is no simple way to make it work with the test framework, and the display-only mode does not seem to be essential. For the time being, we deactivate the display-only mode. See also discussions in the following links: scop#544 scop#546
In the display-only mode where COMP_TYPE=9, 37, or 42, only a part of the completion is stored in COMPREPLY for displaying purposes. For example, "xyz" is stored in COMPREPLY when "abc/xyz" is the candidate and "abc/" is already inserted. However, the test framework extracts generated completions using COMP_TYPE=37 by setting "set show-all-if-ambiguous off", which would be broken by the display-only mode. There is no simple way to make it work with the test framework, and the display-only mode does not seem to be essential. For the time being, we deactivate the display-only mode. See also discussions in the following links: scop#544 scop#546
When many targets in subdirectories are defined in Makefile, we typically want to list the files or subdirectories in the current directory. However, when the file in the subdirectory is unique, we may generate the full path. See also the discussion on GitHub: scop#544 scop#546 (comment)
In the display-only mode where COMP_TYPE=9, 37, or 42, only a part of the completion is stored in COMPREPLY for displaying purposes. For example, "xyz" is stored in COMPREPLY when "abc/xyz" is the candidate and "abc/" is already inserted. However, the test framework extracts generated completions using COMP_TYPE=37 by setting "set show-all-if-ambiguous off", which would be broken by the display-only mode. There is no simple way to make it work with the test framework, and the display-only mode does not seem to be essential. For the time being, we deactivate the display-only mode. See also discussions in the following links: scop#544 scop#546
Describe the bug
Make target completion doesn't work when target files are in subdirectories.
To reproduce
There are two behaviours that happen here. Sample makefile:
For clarity, i've marked spaces with
·
make·TAB
the result ismake·abc/·
make·abc/TAB
the result ismake·xyz·
Expected behavior
Both described cases should auto complete to
make·abc/xyz·
because it is unambiguous.Versions (please complete the following information)
5.1.8(1)-release
2.11
(md5sum completions/make =84866af8ff59c9e1698f90a8f3a67f22
)Additional context
Debug trace
The text was updated successfully, but these errors were encountered: