Skip to content

fix: guard file type override for virtual files#6

Merged
jingu merged 6 commits into
developfrom
fix-copy-paste-file-issue
Oct 2, 2025
Merged

fix: guard file type override for virtual files#6
jingu merged 6 commits into
developfrom
fix-copy-paste-file-issue

Conversation

@jingu

@jingu jingu commented Oct 2, 2025

Copy link
Copy Markdown
Owner

This pull request improves the robustness of the QiqFileTypeOverrider logic and adds comprehensive unit tests to ensure correct file type overriding behavior. The main changes include stricter checks for file validity and type, and the introduction of tests covering both supported and unsupported file scenarios.

File type override logic improvements

  • Added checks in QiqFileTypeOverrider.getOverriddenFileType to ensure the file is a VirtualFileWithId, is not a directory, is valid, and is in the local file system before attempting to override its file type. This prevents unnecessary processing and potential errors for unsupported file types.
  • Imported VirtualFileWithId to support the new type check in the overrider logic.

Testing enhancements

  • Added a new test class QiqFileTypeOverriderTest that verifies the overrider does not override LightVirtualFile instances and correctly overrides local virtual files, including setting marker flags to prevent repeated re-evaluation.

Copilot AI review requested due to automatic review settings October 2, 2025 13:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves the robustness of the QiqFileTypeOverrider by adding guard clauses to validate file types before processing and introduces comprehensive unit tests to verify the overrider's behavior.

Key changes:

  • Added type and validity checks in getOverriddenFileType to ensure only supported local virtual files are processed
  • Moved directory check earlier in the method for better performance
  • Added comprehensive unit tests covering both supported and unsupported file scenarios

Reviewed Changes

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

File Description
QiqFileTypeOverrider.kt Added guard clauses for file type validation and moved directory check for optimization
QiqFileTypeOverriderTest.kt Added new test class with comprehensive coverage for file type override scenarios

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/main/kotlin/io/github/jingu/idea_qiq_plugin/lang/QiqFileTypeOverrider.kt Outdated
@jingu jingu requested a review from Copilot October 2, 2025 13:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/test/kotlin/io/github/jingu/idea_qiq_plugin/lang/QiqFileTypeOverriderTest.kt Outdated
@jingu jingu requested a review from Copilot October 2, 2025 13:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/test/kotlin/io/github/jingu/idea_qiq_plugin/lang/QiqFileTypeOverriderTest.kt Outdated
jingu and others added 3 commits October 2, 2025 22:56
…peOverriderTest.kt

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e-issue

# Conflicts:
#	src/main/kotlin/io/github/jingu/idea_qiq_plugin/lang/QiqFileTypeOverrider.kt
@jingu jingu merged commit 7647504 into develop Oct 2, 2025
1 check passed
@jingu jingu deleted the fix-copy-paste-file-issue branch October 2, 2025 14:23
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