FS#64146 - [code] Bash completion does not work

Attached to Project: Community Packages
Opened by Nathan Monfils (Azertyfun) - Wednesday, 16 October 2019, 09:29 GMT
Last edited by Filipe Laíns (FFY00) - Sunday, 10 November 2019, 18:45 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Filipe Laíns (FFY00)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

Description:
When using bash (and presumably zsh) completion with `code`, the shell freezes for a short while then does nothing. Expected behavior is to complete directories or command line options.

Additional info:
* package version(s): code 1.39.1-2

Steps to reproduce:

* Run code ~/<TAB>

Propsed fix:

The following changes the the PKGBUILD fixed the issue for me:
```
From 915e4191d1c0b88f57cd40ca76397e3a09330d75 Mon Sep 17 00:00:00 2001
From: Nathan Monfils <nmo@escaux.com>
Date: Wed, 16 Oct 2019 10:52:07 +0200
Subject: [PATCH] Proposed fix for bash-completion issue

---
trunk/PKGBUILD | 2 ++
1 file changed, 2 insertions(+)

diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD
index 658200a..97248df 100644
--- a/trunk/PKGBUILD
+++ b/trunk/PKGBUILD
@@ -77,9 +77,11 @@ prepare() {

# Add missing exectable name to bash completion
sed -i 's|complete -F _code code|complete -F _code code code-oss|' resources/completions/bash/code
+ sed -i 's|@@APPNAME@@|code|g' resources/completions/bash/code
# Create new zsh completion file for our binary
cp resources/completions/zsh/_code resources/completions/zsh/_code-oss
sed -i 's|#compdef code|#compdef code code-oss|' resources/completions/zsh/_code-oss
+ sed -i 's|@@APPNAME@@|code-oss|g' resources/completions/zsh/_code-oss

# Fix bin path
sed -i "s|return path.join(path.dirname(execPath), 'bin', \`\${product.applicationName}\`);|return '/usr/bin/code';|g
--
2.23.0
```
This task depends upon

Closed by  Filipe Laíns (FFY00)
Sunday, 10 November 2019, 18:45 GMT
Reason for closing:  Fixed
Additional comments about closing:  code 1.40.0-3
Comment by Lex Onderwater (ReLaxLex) - Thursday, 17 October 2019, 06:43 GMT
I also ran into this issue, changed the file /usr/share/bash-completion/completions/code-oss directly as a quick fix (/usr/share/bash-completion/completions/code is a symbolic link to code-oss):

--- code-oss.orig 2019-10-15 09:58:29.000000000 +0200
+++ code-oss 2019-10-16 15:24:59.262101909 +0200
@@ -1,4 +1,4 @@
-_@@APPNAME@@()
+_code-oss()
{
local cur prev words cword split
_init_completion -s || return
@@ -58,4 +58,4 @@

_filedir
} &&
-complete -F _@@APPNAME@@ @@APPNAME@@
+complete -F _code-oss code-oss code
Comment by Ulf Winkelvos (uwinkelvos) - Wednesday, 30 October 2019, 13:27 GMT
I also fixed this issue before looking at the changes here. I also did some other improvements. The bash completion files are actually being processed by gulp build and written to the build dir. Apparently also the executable path sed line is not necessary.

Loading...