Skip to content

fix intellij extension create file failed #6000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

G81192
Copy link

@G81192 G81192 commented Jun 5, 2025

Description

[ What changed? Feel free to be brief. ]

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. Screen recordings are particularly helpful, and appreciated! ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]

fix intellij extension create file failed for this issue #5999

@G81192 G81192 requested a review from a team as a code owner June 5, 2025 07:27
@G81192 G81192 requested review from RomneyDa and removed request for a team June 5, 2025 07:27
Copy link

cubic-dev-ai bot commented Jun 5, 2025

Your cubic subscription is currently inactive. Please reactivate your subscription to receive AI reviews and use cubic.

Copy link

netlify bot commented Jun 5, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 0444e47
🔍 Latest deploy log https://app.netlify.com/projects/continuedev/deploys/684146ca0ab3240008607e66

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 5, 2025
Copy link

github-actions bot commented Jun 5, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@G81192
Copy link
Author

G81192 commented Jun 5, 2025

I have read the CLA Document and I hereby sign the CLA

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

@G81192 can you provide more information about this approach? I'm thinking maybe it shouldn't be called "getOrOpen" if the create functionality is added. Maybe we could call it getOrCreate or something, or make the flow more clear. I want to make sure we're not creating files when we shouldn't

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Jun 7, 2025
@G81192
Copy link
Author

G81192 commented Jun 7, 2025

@G81192 can you provide more information about this approach? I'm thinking maybe it shouldn't be called "getOrOpen" if the create functionality is added. Maybe we could call it getOrCreate or something, or make the flow more clear. I want to make sure we're not creating files when we shouldn't

@RomneyDa Thank you for the reply.

The issue I'm encountering is that, with the current unmodified code, when I try to create a new file generated by the LLM by clicking create file, nothing happens. Instead, the file currently open in the IDEA window gets modified.

After looking into the code, I found that the getOrOpenEditor method returns the currently selected file as the editor when the target file does not exist. However, in my case, I need to create a new file — and since it doesn’t exist yet, this results in an error.
Example:

  1. I want to create the file:
    image

  2. When I click create file, the currently open file in the IDEA window gets modified instead, which leads to an error:
    image

  3. This is the expected behavior I want to achieve:
    image

This PR is intended to fix this issue. If anything is unclear, I’m happy to provide more details.

@G81192 G81192 requested a review from RomneyDa June 7, 2025 07:59
@G81192
Copy link
Author

G81192 commented Jun 12, 2025

@Patrick-Erichsen @RomneyDa

Hey! Just wondering if there's anything holding up the merge — happy to make changes if needed!

@Patrick-Erichsen
Copy link
Collaborator

I would +1 Dallin's feedback, I think the existing method should be left as is and instead we create the file in https://github.com/continuedev/continue/blob/main/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/ApplyToFileHandler.kt#L172 when we realize it doesnt exist. I don't think we always want the side effect of creating a new file in getOrOpenEditor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants