Skip to content

Conversation

@markijbema
Copy link
Contributor

Changed the getPrompts method signature to align with autocomplete system architecture:

  • Now accepts AutocompleteInput, prefix, suffix, and languageId as separate parameters
  • Made GhostSuggestionContext optional since data is provided through other params
  • Updated all callers in GhostProvider, tests, and utilities

This change extracts parts from PR #3102 to make the API more flexible and better aligned with the autocomplete input structure used throughout the system.

@changeset-bot
Copy link

changeset-bot bot commented Oct 21, 2025

⚠️ No Changeset found

Latest commit: e1a89c2

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

}

// Add current position
if (context.range && context.document) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it removes these ifs, but i do not think they were ever necessary tbh

return false
}

export function extractComment(document: TextDocument, currentLine: number): string {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated, but when i removed use of another import of autotrigger strategy i noticed this was unused as well

@markijbema markijbema marked this pull request as ready for review October 21, 2025 11:34
…pleteInput

Changed the getPrompts method signature to align with autocomplete system architecture:
- Now accepts AutocompleteInput, prefix, suffix, and languageId as separate parameters
- Made GhostSuggestionContext optional since data is provided through other params
- Updated all callers in GhostProvider, tests, and utilities

This change extracts parts from PR #3102 to make the API more flexible and
better aligned with the autocomplete input structure used throughout the system.

Modified files:
- src/services/ghost/strategies/AutoTriggerStrategy.ts
- src/services/ghost/GhostProvider.ts
- src/services/ghost/strategies/__tests__/AutoTriggerStrategy.test.ts
- src/services/ghost/__tests__/GhostRecentOperations.spec.ts
- src/services/ghost/__tests__/GhostModelPerformance.spec.ts
- src/test-llm-autocompletion/strategy-tester.ts

All tests passing (28/28)
Now the getPrompts methods actually use the AutocompleteInput parameter:
- getUserPrompt uses autocompleteInput.recentlyEditedRanges and autocompleteInput.pos
- getCommentsUserPrompt extracts comment from prefix instead of context.document
- Both methods build code with cursor from prefix/suffix instead of document
- Updated test to properly populate AutocompleteInput.recentlyEditedRanges

This completes the refactoring to make the API truly independent of
GhostSuggestionContext, using the autocomplete input structure instead.
…tPrompts()

- Removed unused context?: GhostSuggestionContext parameter from getPrompts method
- Updated all callsites in GhostProvider and test files
- All tests passing (28 tests across 3 test files)
…lication

- Replace manual AutocompleteInput conversion in GhostProvider with contextToAutocompleteInput helper
- Update GhostRecentOperations test to use the helper function
- Reduces ~30 lines of duplicated conversion logic
- All 208 ghost service tests pass
@markijbema markijbema force-pushed the mark/autotrigger-api branch from 53547b4 to e1a89c2 Compare October 21, 2025 11:35
@markijbema markijbema enabled auto-merge October 21, 2025 11:38
@markijbema markijbema merged commit 8843f1d into main Oct 21, 2025
14 checks passed
@markijbema markijbema deleted the mark/autotrigger-api branch October 21, 2025 11:40
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.

3 participants