mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-12-27 22:43:41 +08:00
Make asynchronous suggestions disabled by default
While they are still experimental
This commit is contained in:
parent
40b96f6cfd
commit
83129dd796
|
@ -94,9 +94,9 @@ Widgets that modify the buffer and are not found in any of these arrays will fet
|
|||
Set `ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE` to an integer value to disable autosuggestion for large buffers. The default is unset, which means that autosuggestion will be tried for any buffer size. Recommended value is 20.
|
||||
This can be useful when pasting large amount of text in the terminal, to avoid triggering autosuggestion for too long strings.
|
||||
|
||||
### Disable Asynchronous Mode
|
||||
### Enable Asynchronous Mode
|
||||
|
||||
As of `v0.4.0`, suggestions are fetched asynchronously using the `zsh/zpty` module. To disable this behavior and fall back to fetching suggestions synchronously, unset the `ZSH_AUTOSUGGEST_USE_ASYNC` variable.
|
||||
As of `v0.4.0`, suggestions can be fetched asynchronously using the `zsh/zpty` module. To enable this behavior, set the `ZSH_AUTOSUGGEST_USE_ASYNC` variable (it can be set to anything).
|
||||
|
||||
|
||||
### Key Bindings
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
describe 'the zpty for async suggestions' do
|
||||
it 'is created with the default name' do
|
||||
session.run_command('zpty -t zsh_autosuggest_pty &>/dev/null; echo $?')
|
||||
wait_for { session.content }.to end_with("\n0")
|
||||
end
|
||||
context 'when async suggestions are enabled' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_USE_ASYNC="] }
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_ASYNC_PTY_NAME is set' do
|
||||
let(:options) { ['ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=foo_pty'] }
|
||||
|
||||
it 'is created with the specified name' do
|
||||
session.run_command('zpty -t foo_pty &>/dev/null; echo $?')
|
||||
describe 'the zpty for async suggestions' do
|
||||
it 'is created with the default name' do
|
||||
session.run_command('zpty -t zsh_autosuggest_pty &>/dev/null; echo $?')
|
||||
wait_for { session.content }.to end_with("\n0")
|
||||
end
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_ASYNC_PTY_NAME is set' do
|
||||
let(:options) { super() + ['ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=foo_pty'] }
|
||||
|
||||
it 'is created with the specified name' do
|
||||
session.run_command('zpty -t foo_pty &>/dev/null; echo $?')
|
||||
wait_for { session.content }.to end_with("\n0")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
describe 'suggestion fetching' do
|
||||
it 'is performed asynchronously'
|
||||
it 'is performed synchronously'
|
||||
|
||||
context 'when ZSH_AUTOSUGGEST_USE_ASYNC is unset' do
|
||||
it 'is performed synchronously'
|
||||
context 'when ZSH_AUTOSUGGEST_USE_ASYNC is set' do
|
||||
it 'is performed asynchronously'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,8 +61,5 @@ ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
|
|||
# Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound.
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=
|
||||
|
||||
# Use asynchronous mode by default. Unset this variable to use sync mode.
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC=
|
||||
|
||||
# Pty name for calculating autosuggestions asynchronously
|
||||
ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty
|
||||
|
|
|
@ -97,9 +97,6 @@ ZSH_AUTOSUGGEST_IGNORE_WIDGETS=(
|
|||
# Max size of buffer to trigger autosuggestion. Leave undefined for no upper bound.
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=
|
||||
|
||||
# Use asynchronous mode by default. Unset this variable to use sync mode.
|
||||
ZSH_AUTOSUGGEST_USE_ASYNC=
|
||||
|
||||
# Pty name for calculating autosuggestions asynchronously
|
||||
ZSH_AUTOSUGGEST_ASYNC_PTY_NAME=zsh_autosuggest_pty
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user