Skip to content

Conversation

@markijbema
Copy link
Contributor

llm generated, needs selfrreview

Previously, when a cached suggestion was available, getFromLLM() would
return an empty GhostSuggestionsState, causing the cached suggestion to
never be used. This resulted in unnecessary LLM calls and poor performance.

Now properly constructs and returns a GhostSuggestionsState containing
the cached suggestion, allowing the cache to work as intended.
Previously, the cancellation token parameter was ignored (prefixed with _),
meaning VSCode's cancellation requests would not stop ongoing LLM requests.
This could lead to wasted API calls and resources.

Now listens to token.onCancellationRequested and calls cancelRequest() to
properly handle cancellation. Includes guard for test compatibility where
the mock token may not have this method.
The cache check in getFromLLM() was redundant because
provideInlineCompletionItems() already checks the cache before calling
getFromLLM(). This duplication added unnecessary complexity and made the
code flow harder to understand.

Removed the cache check from getFromLLM() to simplify the code and
establish a clear separation of concerns: provideInlineCompletionItems()
handles caching, getFromLLM() handles LLM requests.
The local variable 'context' was shadowing the function parameter 'context'
(vscode.InlineCompletionContext), making the code harder to read and
potentially confusing for maintainers.

Renamed the local variable to 'suggestionContext' to clearly distinguish
it from the parameter and improve code clarity.
Removed console.log statement that was left in production code for
debugging purposes. This reduces console noise and follows best
practices for production code.
@changeset-bot
Copy link

changeset-bot bot commented Oct 29, 2025

⚠️ No Changeset found

Latest commit: a0ceab6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@markijbema markijbema closed this Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants