Skip to content

Commit

Permalink
Make debugging & bug reporting easier
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonrichert committed Sep 25, 2021
1 parent b2078e7 commit b0d6753
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 30 deletions.
44 changes: 24 additions & 20 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ assignees: ''

---

* `zsh-autocomplete` version: <!-- git -C ~zsh-autocomplete rev-parse @ -->
* Zsh version: <!-- print =zsh $ZSH_PATCHLEVEL -->
* Framework: <!-- Oh My Zsh, Prezto, Zimfw, etc. or just "none" -->
* Plugin manager: <!-- Znap, Zinit, Antigen, etc. or just "none" -->
* Operating system: <!-- print $OSTYPE -->
<!-- Describe your problem here, then complete the next two sections. -->

1. Paste the following into your terminal and press <kbd>Enter</kbd>:
```zsh
cd $(mktemp -d)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
print 'PS1="%# " PS2=" " RPS2="< %^"; setopt transientrprompt
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
' > .zshrc
SHELL==zsh
exec -c zsh -fc "HOME=$PWD SHELL=$SHELL TERM=$TERM exec $SHELL -d"
```
1. Once you're able to reproduce your problem in the shell session created
above, copy-paste the contents of your terminal here:
```zsh
% # Copy-paste your shell session here.
```
### Environment
<!-- Replace the contents of this block with the output of the commands below: -->
```zsh
git -C ~zsh-autocomplete log --oneline -n1
print $_autocomplete__funcfiletrace
print $VENDOR $OSTYPE $SHELL $ZSH_ARGZERO $ZSH_PATCHLEVEL
```

### Steps to reproduce
<!-- Run the following commands: -->
```zsh
cd $(mktemp -d)
git clone --depth 1 -- https://github.com/marlonrichert/zsh-autocomplete.git
> .zshrc <<EOF
PS1="%# " PS2=" "; setopt transientrprompt
source ~/zsh-autocomplete/zsh-autocomplete.plugin.zsh
EOF
env -i HOME=$PWD PATH=$PATH FPATH=$FPATH TERM=$TERM zsh -d
```
<!--
In the shell created above, try to reproduce your problem.
Once you're done, copy-paste your entire shell session into the block above.
-->
5 changes: 3 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ assignees: ''
<!-- Give a brief summary of the feature. -->

## Why do you want this?
<!-- Explain what you need this for or how this would improve your experience. -->
<!-- Explain what you would use this for or how this would enhance your experience. -->

## Who else would benefit from this?
<!-- Describe what kind of users would enjoy this feature. -->

## Explain in detail how you would expect this to work
## Example scenario

Given the following situation:
* <!-- State the circumstance under which this feature would apply. -->

Expand Down
18 changes: 11 additions & 7 deletions scripts/.autocomplete.async
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ builtin autoload -Uz add-zle-hook-widget

typeset -gHi _autocomplete__buffer_start_line=1
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=yes
private -a log_functions=()

builtin zle -N history-incremental-search-backward .autocomplete.async.history-incremental-search
builtin zle -N history-incremental-search-forward .autocomplete.async.history-incremental-search
Expand Down Expand Up @@ -106,7 +107,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in
done

typeset -gHi _autocomplete__buffer_start_line=$(( min( max( Y - i, 1 ), LINES ) ))
} 2>>| $_autocomplete__log_file
}

.autocomplete.async.history-incremental-search() {
if [[ $curcontext == $WIDGET* ]]; then
Expand Down Expand Up @@ -246,7 +247,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in
print -rNC1 -- "$SECONDS" "${text%$'\0\C-C'}"
}
} 2>>| $_autocomplete__log_file
# functions -T .autocomplete.async.start.inner
log_functions+=( .autocomplete.async.start.inner )

.autocomplete.async.pty() {
typeset -gH _autocomplete__lbuffer="$LBUFFER" _autocomplete__rbuffer="$RBUFFER"
Expand All @@ -255,6 +256,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in
local __tmp__=
builtin vared __tmp__
} 2>>| $_autocomplete__log_file
log_functions+=( .autocomplete.async.pty )

.autocomplete.async.pty.no-op() {
:
Expand All @@ -281,7 +283,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in
builtin kill $sysparams[pid]
}
} 2>>| $_autocomplete__log_file
# functions -t .autocomplete.async.pty.zle-widget.inner
log_functions+=( .autocomplete.async.pty.zle-widget.inner )

.autocomplete.async.pty.completion-widget() {
.autocomplete.async.pty.completion-widget.inner "$@"
Expand Down Expand Up @@ -321,7 +323,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in
print -rNC1 -- "$compstate[list_lines]" "$_autocomplete__mesg" "$_autocomplete__comp_mesg[@]"
}
} 2>>| $_autocomplete__log_file
# functions -t .autocomplete.async.pty.completion-widget.inner
log_functions+=( .autocomplete.async.pty.completion-widget.inner )

.autocomplete.async.pty.message() {
typeset -gH _autocomplete__mesg=$mesg
Expand Down Expand Up @@ -371,7 +373,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in
fi
return 0
} 2>>| $_autocomplete__log_file
# functions -T .autocomplete.async.complete.fd-widget.inner
log_functions+=( .autocomplete.async.complete.fd-widget.inner )

.autocomplete.async.insufficient-input() {
local min_input=
Expand All @@ -396,7 +398,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in
.autocomplete.async.list-choices.completion-widget() {
unset _autocomplete__mesg _autocomplete__comp_mesg _autocomplete__words _autocomplete__current

if [[ ! -v 1 || $1 != <->.<-> || ! -v 2 || $2 != <-> ]]; then
if [[ $1 != <->.<-> || $2 != <-> ]]; then
compstate[list]=
return
fi
Expand Down Expand Up @@ -435,7 +437,7 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in

return 2 # Don't return 1, to prevent beeping.
} 2>>| $_autocomplete__log_file
# functions -t .autocomplete.async.list-choices.completion-widget
log_functions+=( .autocomplete.async.list-choices.completion-widget )

.autocomplete.async.list-choices.post() {
[[ -v _autocomplete__partial_list ]] &&
Expand Down Expand Up @@ -575,3 +577,5 @@ builtin zle -N history-incremental-search-forward .autocomplete.async.history-in

return _ret_
}

typeset -gHa _autocomplete__log_functions=( $log_functions[@] )
3 changes: 2 additions & 1 deletion zsh-autocomplete.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ setopt NO_flowcontrol NO_singlelinezle

() {
emulate -L zsh
zmodload -F zsh/parameter p:functions
zmodload -F zsh/parameter p:funcfiletrace p:functions
typeset -gH _autocomplete__funcfiletrace=${(F)funcfiletrace[2,-2]}

typeset -gHa _autocomplete__func_opts=(
localoptions extendedglob clobber
Expand Down

0 comments on commit b0d6753

Please sign in to comment.