Skip to content

Conversation

@yanmofeixi
Copy link

@yanmofeixi yanmofeixi commented Nov 25, 2025

The showRange field in InlineCompletionItem (part of the inlineCompletionsAdditions proposed API) stopped working after the InlineCompletionsSource refactoring in commit b0abf06. While the field is still defined in the API and accepted from extensions, the implementation that checks cursor position against this range was removed.

See more detail: #279266

This commit restores the showRange functionality by:

  1. Adding showRange field to InlineSuggestData constructor
  2. Passing showRange from InlineCompletion to InlineSuggestData in toInlineSuggestData
  3. Adding showRange getter to InlineSuggestionItemBase
  4. Implementing showRange check in InlineCompletionItem.isVisible() method
  5. Adding cursor position check against showRange in inlineCompletionsModel state computation

The fix ensures that inline completions are only shown when the cursor is within the specified showRange (if provided), matching the original behavior from PR #237532.

Fixes regression from commit b0abf06 (Refactors InlineCompletionsSource) Restores functionality from commit a016c0b (Support show range for inline edits)

@yanmofeixi
Copy link
Author

@microsoft-github-policy-service agree

@yanmofeixi
Copy link
Author

@microsoft-github-policy-service agree company="Meta"

Copilot finished reviewing on behalf of yanmofeixi November 25, 2025 03:14
@yanmofeixi yanmofeixi force-pushed the fix/restore-showrange-functionality branch from 1d84234 to e4d827f Compare November 25, 2025 03:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR restores the showRange functionality for inline completions that was accidentally removed during the InlineCompletionsSource refactoring. The showRange field allows extensions to specify a range within which inline completions should be visible, hiding them when the cursor moves outside this range.

Key changes:

  • Added showRange parameter to InlineSuggestData constructor and passed it through the data flow
  • Implemented showRange visibility check in InlineCompletionItem.isVisible()
  • Added cursor position validation against showRange in the inline edit state computation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.ts Added showRange field to InlineSuggestData constructor and passed it from InlineCompletion to InlineSuggestData in toInlineSuggestData()
src/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.ts Added showRange getter to InlineSuggestionItemBase and implemented visibility check in InlineCompletionItem.isVisible()
src/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.ts Added cursor position check against showRange for inline edits in the state computation

@yanmofeixi yanmofeixi force-pushed the fix/restore-showrange-functionality branch from e4d827f to 9df68fb Compare November 25, 2025 03:23
The showRange field in InlineCompletionItem (part of the inlineCompletionsAdditions
proposed API) stopped working after the InlineCompletionsSource refactoring in commit
b0abf06. While the field is still defined in the API and accepted from extensions,
the implementation that checks cursor position against this range was removed.

This commit restores the showRange functionality by:

1. Adding showRange field to InlineSuggestData constructor
2. Passing showRange from InlineCompletion to InlineSuggestData in toInlineSuggestData
3. Adding showRange getter to InlineSuggestionItemBase
4. Implementing showRange check in InlineCompletionItem.isVisible() method
5. Adding cursor position check against showRange in inlineCompletionsModel state computation

The fix ensures that inline completions are only shown when the cursor is within
the specified showRange (if provided), matching the original behavior from PR microsoft#237532.

Fixes regression from commit b0abf06 (Refactors InlineCompletionsSource)
Restores functionality from commit a016c0b (Support show range for inline edits)
@yanmofeixi yanmofeixi force-pushed the fix/restore-showrange-functionality branch from 60d5648 to 181088e Compare November 25, 2025 07:22
@benibenj benibenj assigned hediet and unassigned benibenj Nov 25, 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.

3 participants