Skip to content

Conversation

@SalerSimo
Copy link
Contributor

Fix #214879
I refactored the virtual model creation logic. I noticed that the logic used for tokenization.getLineTokens and for getLineContent is largely the same, so I introduced a createVirtualModel method that reuses this shared logic. I also added an optional argument to handle cases where the logic for tokenization.getLineTokens and getLineContent differs.

Copilot AI review requested due to automatic review settings December 22, 2025 21:25
@SalerSimo SalerSimo changed the title refactor virtual model creation logic in MoveLinesCommand Refactor virtual model creation logic in MoveLinesCommand Dec 22, 2025
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 refactors the virtual model creation logic in MoveLinesCommand to eliminate code duplication. The refactoring introduces a reusable createVirtualModel method that consolidates the shared logic previously duplicated in three separate locations, with an optional contentOverride parameter to handle cases where line content needs customization.

Key Changes

  • Introduced createVirtualModel helper method that encapsulates virtual model creation with configurable line number mapping
  • Replaced three inline virtual model definitions with calls to the new helper method
  • Added contentOverride parameter to allow custom content for specific lines while maintaining the same tokenization logic

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.

Refactor the virtual model creation logic inside of the moveLinesCommand file

2 participants