Skip to content

Commit 36fb9bb

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: #544 #546
1 parent 33114f9 commit 36fb9bb

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
@@ -210,12 +210,19 @@ _make()
210210
fi
211211
done
212212

213-
# recognise that possible completions are only going to be displayed
214-
# so only the base name is shown
213+
# recognise that possible completions are only going to be displayed so
214+
# only the base name is shown.
215+
#
216+
# Note: This is currently turned off because the test suite of
217+
# bash-completion conflicts with it; it uses "set show-all-if-ambiguous
218+
# on" (causing COMP_TYPE == 37) to retrieve the action completion
219+
# results, and also the compact form with only the basenames is not
220+
# essentially needed. To re-enable it, please uncomment the following
221+
# if-statement.
215222
local mode=--
216-
if ((COMP_TYPE != 9 && COMP_TYPE != 37 && COMP_TYPE != 42)); then
217-
mode=-d # display-only mode
218-
fi
223+
# if ((COMP_TYPE != 9 && COMP_TYPE != 37 && COMP_TYPE != 42)); then
224+
# mode=-d # display-only mode
225+
# fi
219226

220227
local IFS=$' \t\n' script=$(_make_target_extract_script $mode "$cur")
221228
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)