Skip to content

Commit f1d83fd

Browse files
committed
fix(make): deactivate the display-only mode
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
1 parent dabec2e commit f1d83fd

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

completions/make

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,19 @@ _make()
159159
fi
160160
done
161161

162-
# recognise that possible completions are only going to be displayed
163-
# so only the base name is shown
162+
# recognise that possible completions are only going to be displayed so
163+
# only the base name is shown.
164+
#
165+
# Note: This is currently turned off because the test suite of
166+
# bash-completion conflicts with it; it uses "set show-all-if-ambiguous
167+
# on" (causing COMP_TYPE == 37) to retrieve the action completion
168+
# results, and also the compact form with only the basenames is not
169+
# essentially needed. To re-enable it, please uncomment the following
170+
# if-statement.
164171
local mode=--
165-
if ((COMP_TYPE != 9 && COMP_TYPE != 37 && COMP_TYPE != 42)); then
166-
mode=-d # display-only mode
167-
fi
172+
# if ((COMP_TYPE != 9 && COMP_TYPE != 37 && COMP_TYPE != 42)); then
173+
# mode=-d # display-only mode
174+
# fi
168175

169176
local IFS=$' \t\n' script=$(_make_target_extract_script $mode "$cur")
170177
COMPREPLY=($(LC_ALL=C \

test/t/test_make.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_2(self, bash, completion):
1818

1919
@pytest.mark.complete("make .cache/", cwd="make", require_cmd=True)
2020
def test_3(self, bash, completion):
21-
assert completion == "1 2".split()
21+
assert completion == ".cache/1 .cache/2".split()
2222
os.remove(f"{bash.cwd}/make/extra_makefile")
2323

2424
@pytest.mark.complete("make ", cwd="shared/empty_dir")
@@ -36,7 +36,7 @@ def test_6(self, bash, completion):
3636

3737
@pytest.mark.complete("make .cache/.", cwd="make", require_cmd=True)
3838
def test_7(self, bash, completion):
39-
assert completion == ".1 .2".split()
39+
assert completion == ".cache/.1 .cache/.2".split()
4040
os.remove(f"{bash.cwd}/make/extra_makefile")
4141

4242
@pytest.mark.complete("make -C make ", require_cmd=True)
@@ -61,7 +61,7 @@ def test_github_issue_544_2(self, bash):
6161

6262
def test_github_issue_544_3(self, bash):
6363
completion = assert_complete(bash, "make 123/")
64-
assert completion == ["xaa", "xbb"]
64+
assert completion == ["123/xaa", "123/xbb"]
6565

6666
def test_github_issue_544_4(self, bash):
6767
completion = assert_complete(bash, "make 123/xa")

0 commit comments

Comments
 (0)