Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Dec 11, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

markijbema and others added 18 commits December 10, 2025 17:39
…triggering

Implements intelligent autocomplete skip logic to reduce unnecessary LLM requests
and improve user experience by avoiding autocomplete in inappropriate contexts.

Key features:
- Language-aware statement terminator detection (supports 10+ language families)
- Skip autocomplete at end of complete statements (after ;, }, ), etc.)
- Skip during mid-word typing (for words longer than 2 characters)
- Comprehensive test coverage with 313 test cases
- Centralized configuration for easy language support expansion

Changes:
- Add contextualSkip.ts module with shouldSkipAutocomplete() entry point
- Integrate skip logic into GhostInlineCompletionProvider
- Add extensive test suite covering edge cases and language-specific behavior

Supported languages: JavaScript/TypeScript, Python, Ruby, Go, Rust, Shell,
SQL, Lisp family, C-like languages, and markup languages.
…contextualSkip

- Removed the /\s$/.test(beforeTerminator) condition from multi-character terminator matching
- Multi-character terminators (fi, done, end) now only match at the start of a line
- Updated tests to reflect the new behavior
- All 49 tests passing
- Removed entire multi-character terminator checking logic (lines 175-183)
- Multi-character terminators like 'fi', 'done', 'end' are no longer checked
- Only single-character terminators (;, }, )) are now validated
- Updated tests to reflect new behavior
- All 49 tests passing
- Changed isMidWordTyping return type from object to boolean
- Moved wordLength > 2 logic inside isMidWordTyping function
- Simplified shouldSkipAutocomplete to directly use boolean result
- All 49 tests passing
If wordLength >= 1, the regex match guarantees the last char is a word character, making the separate check redundant.
Combine the firstCharAfter extraction and regex test into a single expression using short-circuit evaluation.
- Remove redundant family name field and intermediate lookup map
- Keep family grouping in LANGUAGE_CONFIGS to avoid duplication
- Build LANGUAGE_TERMINATORS directly from configs for O(1) lookup
- Remove redundant fallback in isAtEndOfStatement (handled in getTerminatorsForLanguage)
- Add proper multi-character terminator support using endsWith()
- Fix shell test to correctly expect 'fi' to skip (it's a terminator)

Addresses review comments from @EamonNerbonne
Move cache lookup before shouldSkipAutocomplete() check so that
partial typing matches from cache are still returned. The contextual
skip logic now only blocks new LLM requests during mid-word typing,
not cached suggestions.
…racter

Change isMidWordTyping logic from AND to OR condition so that
autocomplete is skipped when either the prefix ends with a long word
OR the suffix starts with a word character. This prevents unwanted
completions when cursor is positioned before existing code.
…lete

feat(autocomplete): add contextual skip logic for smart autocomplete triggering
@pull pull bot locked and limited conversation to collaborators Dec 11, 2025
@pull pull bot added the ⤵️ pull label Dec 11, 2025
@pull pull bot merged commit 97ce14f into jasonkneen:main Dec 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant