Skip to content

fix loading configs from project .continue folder in JetBrains IDEs on Windows (bug #5474) #5618

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

Merged
merged 2 commits into from
May 14, 2025

Conversation

muravvv
Copy link
Contributor

@muravvv muravvv commented May 11, 2025

Description

This pull reqest fixes bug in loading configs from project's .continue folder in JetBrains IDEs with messages in core.log Failed to unroll block [object Object]: ENOENT: no such file or directory, open '/D:/Projects/test/.continue/models/new-model.yaml' (bug #5474). Also it should fix other issues with access to local files by urls on Windows.

The problem arises from incorrect handling file:// URLs in RegistryClient.getContent on Windows: function getContentFromFilePath simply removes file:// prefix, while on Windows it is needed to remove third / as well. So for URL file:///C:/path/to/file it will try to read file /C:/path/to/file while right file path is C:/path/to/file (UNIX-syle slashes is acceptable for node.js).

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

Testing instructions

#5474 is reproduced in any JetBrains IDE (I have tested in CLion and IntelliJ Community) on Windows: before this fix no yaml files worked from project's .continue folder.


Summary by mrge

Fixed loading configs from the .continue folder in JetBrains IDEs on Windows by correcting file:// URL handling.

  • Bug Fixes
    • Fixed reading local config files with file:// URLs on Windows, resolving errors when opening YAML files in the .continue folder.

this firstly fixes bug in loading configs from project's .continue folder on JetBrains IDEs with messages in core.log like "Failed to unroll block [object Object]: ENOENT: no such file or directory, open '/D:/Projects/test/.continue/models/new-model.yaml'"
@muravvv muravvv requested a review from a team as a code owner May 11, 2025 16:55
@muravvv muravvv requested review from sestinj and removed request for a team May 11, 2025 16:55
Copy link

netlify bot commented May 11, 2025

Deploy Preview for continuedev canceled.

Name Link
🔨 Latest commit 828604c
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/68210d318a197a0008b67f9c

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 11, 2025
@sestinj
Copy link
Contributor

sestinj commented May 11, 2025

@muravvv thanks for the fix, this is great to see!

[] The relevant tests, if any, have been updated or created

I think there are some quick unit tests that would be extremely beneficial. Can you take moment to add a few cases for the different operating systems to registryClient.test.ts? They should help us make sure we don't regress here or in the future

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels May 11, 2025
url generation code duplicates localPathToUri (which mostly used to create file urls in the rest code), except URI.normalize to avoid adding uri-js package to test environment (and because in general getContent should work with any valid file url)
@muravvv
Copy link
Contributor Author

muravvv commented May 11, 2025

@sestinj ok, I've added test for local file urls. If it is running on Windows it now detects this bug (if fix commit is reverted).

Copy link
Contributor

@sestinj sestinj left a comment

Choose a reason for hiding this comment

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

It seems that this test is just a repeat of the previous test with different file contents, rather than actually testing the URL. Is this purposeful? I'd like to make sure that there's a representative test that you are able to run on your windows machine

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs May 12, 2025
@muravvv
Copy link
Contributor Author

muravvv commented May 13, 2025

Actually this test checks exactly access by file url: primary difference from absolute path test is pathToFileURL call. It converts usual file path (urlFilePath) to file:// URL and then this string (fileUrl) is used in primary part of test.

And as pathToFileURL is used in the rest of the extension to create file URLs from usual paths, this test covers all cases of local file URLs usage in the extension (of course, except URLs entered by users).

File content is changed just in case to protect against confusing variables with absolute path test. It does not affect on test logic itself.

And of course, I have checked, that this test really works: I have reverted my first commit and the test became failed.

@muravvv muravvv requested a review from sestinj May 13, 2025 23:47
Copy link
Contributor

@sestinj sestinj left a comment

Choose a reason for hiding this comment

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

got it, thanks for clarifying

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 14, 2025
@sestinj sestinj merged commit 5a2c5a7 into continuedev:main May 14, 2025
32 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs May 14, 2025
@sestinj
Copy link
Contributor

sestinj commented May 15, 2025

Hi @muravvv, yesterday we shared some updates with our contributors about how we're aiming to improve the contribution process. Part of this included the addition of a Contributor License Agreement (CLA) to protect both contributors and the project. We're reaching out to ask that previous contributors sign it.

Could you please take a moment to sign, or if you have any questions send me a message? (either here or nate@continue.dev would work)

To do so, you just need to post a comment below with the following text:

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

❤️ Thank you for the work you've done on Continue, and let me know if you have any suggestions on how we can make the project even better!

Copy link

github-actions bot commented May 15, 2025

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

@muravvv
Copy link
Contributor Author

muravvv commented May 16, 2025

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

github-actions bot added a commit that referenced this pull request May 16, 2025
@muravvv muravvv deleted the fix_file_urls branch May 25, 2025 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants