Skip to content
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

VSCode terminal support #1

Open
ssnyder opened this issue Nov 3, 2023 · 19 comments
Open

VSCode terminal support #1

ssnyder opened this issue Nov 3, 2023 · 19 comments

Comments

@ssnyder
Copy link

ssnyder commented Nov 3, 2023

I'm not sure I am putting this in the correct location, but I am using VSCode to a remote server, and when I try to do a completion to a subdirectory of my bookmark it does not work. I assume this has something to do with running the shell from within the VSCode IDE, but cannot figure out what I need to do to get that to work. It works fine with my regular shell. Let me know what info you need from me to assist.

Thanks

@micans
Copy link
Owner

micans commented Nov 3, 2023

If this occurs in the shell version of apparix (supported in this repository) then I can assist. However, this shell version works for me in VSCode terminal, so I reckon you may be using the (much older) C version of apparix. The C version was also written by me but I no longer support it.
If you use the C version (available on a few Linux bistros, e.g. with apt-get install apparix) then apparix --version will give some meaningful output. If that's the case, my best (and sadly only) advice is to switch to the shell version in this repository; it is a matter of obtaining a single file and adding one line to your .bashrc (see main page).

If you already use this shell version, let me know (it will be puzzling).

@ssnyder
Copy link
Author

ssnyder commented Nov 3, 2023

Since I can't install anything using apt or yum, I am confident that I am running the version from this repository. Let me know what information you need from me to start tracking this down :) The only thing that does not seem to work is when I try to do auto-complete for a subdirectory of a bookmark. i.e.

</home/sharon_snyder/work/git> $ bm git
and under this git directory I have a number of other directories for misc. git repos I work with. (i.e. myJnotebooks, myDotFiles, projectA, etc.)

</home/sharon_snyder/work/git> $ to git my ------- no autocompletion happens when in vscode terminal window

I do the same thing from my ssh shell window, and it works fine

@micans
Copy link
Owner

micans commented Nov 3, 2023

What is the output of apparix git (both in IDE shell and ssh terminal)? Perhaps it has a different mount point depending on access manner.

@ssnyder
Copy link
Author

ssnyder commented Nov 3, 2023

the command apparix does not exist - I have only the . file

@micans
Copy link
Owner

micans commented Nov 3, 2023

Sorry, that should be apparish git (or a git)

@ssnyder
Copy link
Author

ssnyder commented Nov 3, 2023

the same result in both environments: /home/sharon_snyder/work/git

@micans
Copy link
Owner

micans commented Nov 3, 2023

Can you try bind '"\t":menu-complete' ; if I unset that I get the same (lack of) behaviour. Perhaps there is a difference in that setting between the two access ways.

@micans
Copy link
Owner

micans commented Nov 6, 2023

Let me know if this is still an issue you'd like to pursue, otherwise I'll close it.

@micans
Copy link
Owner

micans commented Nov 6, 2023

Unclear if this was solved or not.

@micans micans closed this as completed Nov 6, 2023
@ssnyder
Copy link
Author

ssnyder commented Nov 6, 2023

sorry to not respond sooner - I did try that (as the script told me to do so when I source it), and that does not work either in vs code - I can try it in an ssh window as well if you think it helpful

@micans micans reopened this Nov 6, 2023
@micans
Copy link
Owner

micans commented Nov 6, 2023

Ah ok, an intriguing puzzle, thank you for persisting. What shell are you running, bash, or zsh? Could you give the output of $BASH --version if bash, or the equivalent if zsh? Could you also give the output of bind -P, as well as env | grep -i apparix? I'm not sure if we can learn much, but perhaps there is something there. You could potentially spot a difference with your ssh access, I can compare it with my vscode terminal. What is the remote server running? In my case it's on Azure.

@ssnyder
Copy link
Author

ssnyder commented Nov 7, 2023

I use bash. The output of $BASH --version in vscode is:

$BASH --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

bind -P output in vscode:

abort can be found on "\C-g", "\C-x\C-g", "\e\C-g".
accept-line can be found on "\C-j", "\C-m".
alias-expand-line is not bound to any keys
arrow-key-prefix is not bound to any keys
backward-byte is not bound to any keys
backward-char can be found on "\C-b", "\eOD", "\e[D".
backward-delete-char can be found on "\C-h", "\C-?".
backward-kill-line can be found on "\C-x\C-?".
backward-kill-word can be found on "\e\C-h", "\e\C-?".
backward-word can be found on "\e\e[D", "\e[1;3D", "\e[1;5D", "\e[5D", "\eb".
beginning-of-history can be found on "\e<".
beginning-of-line can be found on "\C-a", "\eOH", "\e[1~", "\e[H".
bracketed-paste-begin can be found on "\e[200~".
call-last-kbd-macro can be found on "\C-xe".
capitalize-word can be found on "\ec".
character-search can be found on "\C-]".
character-search-backward can be found on "\e\C-]".
clear-screen can be found on "\C-l".
complete can be found on "\e\e".
complete-command can be found on "\e!".
complete-filename can be found on "\e/".
complete-hostname can be found on "\e@".
complete-into-braces can be found on "\e{".
complete-username can be found on "\e~".
complete-variable can be found on "\e$".
copy-backward-word is not bound to any keys
copy-forward-word is not bound to any keys
copy-region-as-kill is not bound to any keys
dabbrev-expand is not bound to any keys
delete-char can be found on "\C-d", "\e[3~".
delete-char-or-list is not bound to any keys
delete-horizontal-space can be found on "\e\".
digit-argument can be found on "\e-", "\e0", "\e1", "\e2", "\e3", ...
display-shell-version can be found on "\C-x\C-v".
do-lowercase-version can be found on "\C-xA", "\C-xB", "\C-xC", "\C-xD", "\C-xE", ...
downcase-word can be found on "\el".
dump-functions is not bound to any keys
dump-macros is not bound to any keys
dump-variables is not bound to any keys
dynamic-complete-history can be found on "\e\C-i".
edit-and-execute-command can be found on "\C-x\C-e".
emacs-editing-mode is not bound to any keys
end-kbd-macro can be found on "\C-x)".
end-of-history can be found on "\e>".
end-of-line can be found on "\C-e", "\eOF", "\e[4~", "\e[F".
exchange-point-and-mark can be found on "\C-x\C-x".
forward-backward-delete-char is not bound to any keys
forward-byte is not bound to any keys
forward-char can be found on "\C-f", "\eOC", "\e[C".
forward-search-history can be found on "\C-s".
forward-word can be found on "\e\e[C", "\e[1;3C", "\e[1;5C", "\e[5C", "\ef".
glob-complete-word can be found on "\eg".
glob-expand-word can be found on "\C-x*".
glob-list-expansions can be found on "\C-xg".
history-and-alias-expand-line is not bound to any keys
history-expand-line can be found on "\e^".
history-search-backward is not bound to any keys
history-search-forward is not bound to any keys
history-substring-search-backward is not bound to any keys
history-substring-search-forward is not bound to any keys
insert-comment can be found on "\e#".
insert-completions can be found on "\e*".
insert-last-argument can be found on "\e.", "\e_".
kill-line can be found on "\C-k".
kill-region is not bound to any keys
kill-whole-line is not bound to any keys
kill-word can be found on "\e[3;5~", "\ed".
magic-space is not bound to any keys
menu-complete can be found on "\C-i".
menu-complete-backward is not bound to any keys
next-history can be found on "\C-n", "\eOB", "\e[B".
next-screen-line is not bound to any keys
non-incremental-forward-search-history can be found on "\en".
non-incremental-forward-search-history-again is not bound to any keys
non-incremental-reverse-search-history can be found on "\ep".
non-incremental-reverse-search-history-again is not bound to any keys
old-menu-complete is not bound to any keys
operate-and-get-next can be found on "\C-o".
overwrite-mode is not bound to any keys
possible-command-completions can be found on "\C-x!".
possible-completions can be found on "\e=", "\e?".
possible-filename-completions can be found on "\C-x/".
possible-hostname-completions can be found on "\C-x@".
possible-username-completions can be found on "\C-x~".
possible-variable-completions can be found on "\C-x$".
previous-history can be found on "\C-p", "\eOA", "\e[A".
previous-screen-line is not bound to any keys
print-last-kbd-macro is not bound to any keys
quoted-insert can be found on "\C-q", "\C-v", "\e[2~".
redraw-current-line is not bound to any keys
re-read-init-file can be found on "\C-x\C-r".
reverse-search-history can be found on "\C-r".
revert-line can be found on "\e\C-r", "\er".
self-insert can be found on " ", "!", """, "#", "$", ...
set-mark can be found on "\C-@", "\e ".
shell-backward-kill-word is not bound to any keys
shell-backward-word is not bound to any keys
shell-expand-line can be found on "\e\C-e".
shell-forward-word is not bound to any keys
shell-kill-word is not bound to any keys
skip-csi-sequence is not bound to any keys
start-kbd-macro can be found on "\C-x(".
tab-insert is not bound to any keys
tilde-expand can be found on "\e&".
transpose-chars can be found on "\C-t".
transpose-words can be found on "\et".
tty-status is not bound to any keys
undo can be found on "\C-x\C-u", "\C-".
universal-argument is not bound to any keys
unix-filename-rubout is not bound to any keys
unix-line-discard can be found on "\C-u".
unix-word-rubout can be found on "\C-w".
upcase-word can be found on "\eu".
vi-append-eol is not bound to any keys
vi-append-mode is not bound to any keys
vi-arg-digit is not bound to any keys
vi-back-to-indent is not bound to any keys
vi-backward-bigword is not bound to any keys
vi-backward-word is not bound to any keys
vi-bword is not bound to any keys
vi-bWord is not bound to any keys
vi-change-case is not bound to any keys
vi-change-char is not bound to any keys
vi-change-to is not bound to any keys
vi-char-search is not bound to any keys
vi-column is not bound to any keys
vi-complete is not bound to any keys
vi-delete is not bound to any keys
vi-delete-to is not bound to any keys
vi-editing-mode is not bound to any keys
vi-end-bigword is not bound to any keys
vi-end-word is not bound to any keys
vi-eof-maybe is not bound to any keys
vi-eword is not bound to any keys
vi-eWord is not bound to any keys
vi-fetch-history is not bound to any keys
vi-first-print is not bound to any keys
vi-forward-bigword is not bound to any keys
vi-forward-word is not bound to any keys
vi-fword is not bound to any keys
vi-fWord is not bound to any keys
vi-goto-mark is not bound to any keys
vi-insert-beg is not bound to any keys
vi-insertion-mode is not bound to any keys
vi-match is not bound to any keys
vi-movement-mode is not bound to any keys
vi-next-word is not bound to any keys
vi-overstrike is not bound to any keys
vi-overstrike-delete is not bound to any keys
vi-prev-word is not bound to any keys
vi-put is not bound to any keys
vi-redo is not bound to any keys
vi-replace is not bound to any keys
vi-rubout is not bound to any keys
vi-search is not bound to any keys
vi-search-again is not bound to any keys
vi-set-mark is not bound to any keys
vi-subst is not bound to any keys
vi-tilde-expand is not bound to any keys
vi-unix-word-rubout is not bound to any keys
vi-yank-arg is not bound to any keys
vi-yank-pop is not bound to any keys
vi-yank-to is not bound to any keys
yank can be found on "\C-y".
yank-last-arg can be found on "\e.", "\e
".
yank-nth-arg can be found on "\e\C-y".
yank-pop can be found on "\ey".

There is no output when I do the "env | grep -i apparix" command. I tried apparish and app instead of apparix, and still nothing.

The remote server is running Ubuntu 20.04.3 LTS (focal)

@micans
Copy link
Owner

micans commented Nov 7, 2023

Thank you .. it's been a while since I was immersed in bash completion and input bindings, and I can't say I ever really understood all the shenanigans. I'm now wondering if VScode is stealing your <TAB> keystroke. I've searched in VScode settings, but haven't found a smoking gun yet. However, could you perhaps try <CTRL-i> instead of <TAB>, so to git my<CTRL-i>. If that doesn't work, perhaps try <CTRL-n> as well. It would not be a solution but a useful datapoint.

@micans
Copy link
Owner

micans commented Nov 8, 2023

I have nagging feeling it may be some VScode setting (that I solved it in the past and forgot how). From https://stackoverflow.com/questions/63759337/how-to-enable-git-autocomplete-in-integrated-terminal-in-vscode
comes a suggestion to check whether the file $HOME/.bashrc loads a file such as /etc/bash_completion.

There is also https://stackoverflow.com/questions/35519538/visual-studio-code-tab-key-does-not-insert-a-tab
which I assume is not relevant but which I'll list for completeness, concerning the VScode 'Toggle Tab Key Moves Focus' keybinding. If pressing <TAB> changes focus this might be relevant (in that case, in several places I read "Using (Ctrl + M) return Tab button to its normal working status.").

Also see previous comment, if you could try to git my<CTRL-i> and to git my<CTRL-n>.

@ssnyder
Copy link
Author

ssnyder commented Nov 10, 2023

The git a and and all work in my vscode - they autocomplete to git commands starting with 'a'. I will read those stack overflow links and see if I can get any further

@micans
Copy link
Owner

micans commented Nov 12, 2023

Could you try, in a VScode terminal,

bind '"\C-i":menu-complete'

and then try complete e.g. with to git my<CTRL-i> ?

@ssnyder
Copy link
Author

ssnyder commented Nov 14, 2023

running the bind command and it is the same result - no autocomplete for the subdirectories

@micans
Copy link
Owner

micans commented Nov 17, 2023

Are you running VScode on Windows, Mac or another system? I see quite a large number of differences between your key-bindings and mine. I'm running out of sane ideas to test; one thing that came to mind was to test this on a bookmark that's not called git just in case git triggers another completion mechanism. I know of no way this could happen .. but in debugging to keep prodding from different angles, however improbable, gives at least some prodding joy.
I have in the past debugged apparix by inserting echo statements in the source functions, but doing this over a GitHub issue channel seems too daunting.

@ssnyder
Copy link
Author

ssnyder commented Nov 17, 2023

I am running on Windows 11, and even using another bookmark, still same thing - no subdirectory autocomplete. If I type out the subdirectory, it works as expected, but not the auto-complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants