mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2026-02-16 16:42:29 +01:00
refactor(ai): replace empty buffer with min input
- Replace ZSH_AUTOSUGGEST_ALLOW_EMPTY_BUFFER with AI_MIN_INPUT - Add ZSH_AUTOSUGGEST_AI_DEBUG environment variable - Add debug logging function to diagnose failures - Update history lines default from 20 to 5 - Update pwd history preference default to no Min input provides clearer semantics: set to 0 for empty-buffer suggestions or higher to require minimum input. Debug logging helps diagnose missing suggestions by showing API request flow. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
81672cc7fe
commit
cd66c5695a
7 changed files with 142 additions and 52 deletions
|
|
@ -195,7 +195,7 @@ EOFCURL
|
|||
end
|
||||
|
||||
context 'empty buffer suggestions' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_ALLOW_EMPTY_BUFFER=1", "ZSH_AUTOSUGGEST_STRATEGY=(ai)"] }
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_AI_MIN_INPUT=0", "ZSH_AUTOSUGGEST_STRATEGY=(ai)"] }
|
||||
|
||||
let(:before_sourcing) do
|
||||
-> {
|
||||
|
|
@ -216,8 +216,8 @@ EOFCURL
|
|||
end
|
||||
end
|
||||
|
||||
context 'empty buffer without flag' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_STRATEGY=(ai history)"] }
|
||||
context 'empty buffer with default min input' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_AI_MIN_INPUT=1", "ZSH_AUTOSUGGEST_STRATEGY=(ai history)"] }
|
||||
|
||||
let(:before_sourcing) do
|
||||
-> {
|
||||
|
|
@ -232,7 +232,7 @@ EOFCURL
|
|||
}
|
||||
end
|
||||
|
||||
it 'does not suggest on empty buffer by default' do
|
||||
it 'does not suggest on empty buffer when min input is 1' do
|
||||
with_history('git status') do
|
||||
sleep 0.5
|
||||
expect(session.content).to_not match(/git status/)
|
||||
|
|
@ -323,7 +323,7 @@ EOFCURL
|
|||
end
|
||||
|
||||
context 'dual prompt modes' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_ALLOW_EMPTY_BUFFER=1", "ZSH_AUTOSUGGEST_STRATEGY=(ai)"] }
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_AI_MIN_INPUT=0", "ZSH_AUTOSUGGEST_STRATEGY=(ai)"] }
|
||||
|
||||
context 'empty buffer mode' do
|
||||
let(:before_sourcing) do
|
||||
|
|
@ -366,7 +366,7 @@ EOFCURL
|
|||
end
|
||||
|
||||
context 'temperature configuration' do
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_ALLOW_EMPTY_BUFFER=1", "ZSH_AUTOSUGGEST_STRATEGY=(ai)"] }
|
||||
let(:options) { ["ZSH_AUTOSUGGEST_AI_API_KEY=test-key", "ZSH_AUTOSUGGEST_AI_MIN_INPUT=0", "ZSH_AUTOSUGGEST_STRATEGY=(ai)"] }
|
||||
|
||||
let(:before_sourcing) do
|
||||
-> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue