continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
18.99k stars 1.62k forks source link

Windows WSL, File hyperlinks in search results not opening files #2253

Open ankutjaat opened 1 month ago

ankutjaat commented 1 month ago

Before submitting your bug report

Relevant environment info

- OS: Windows NT x64 10.0.19045 WSL2 
- Continue: v0.8.51
- IDE: VSCode 1.93.1
- Model: deepseek-chat
- config.json:

Description

The Continue extension in VS Code is failing to open files when clicking on hyperlinks in chat results. After generating chat results, attempting to open a file through the provided hyperlink does not work as expected.

To reproduce

  1. Open VS Code with the Continue extension installed
  2. Wait for Indexing Done.
  3. Use "@location" and any keyword to elicit a file reference
  4. Wait for the chat results to be generated
  5. Click on a file hyperlink in the chat results image image

Log output

console.ts:137 [Extension Host] stack trace: CodeExpectedError: cannot open file:///home/username/projects/cursor_play/test.py. Detail: Unable to read file '\home\username\projects\cursor_play\test.py' (Error: Unable to resolve nonexistent file '\home\username\projects\cursor_play\test.py')
    at o.$tryOpenDocument (vscode-file://vscode-app/c:/Users/username/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2460:132808)
C @ console.ts:137
$logExtensionHostMessage @ mainThreadConsole.ts:39
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1242
fire @ event.ts:1273
fire @ ipc.net.ts:652
K.onmessage @ localProcessExtensionHost.ts:378
log.ts:439   ERR cannot open file:///home/username/projects/cursor_play/test.py. Detail: Unable to read file '\home\username\projects\cursor_play\test.py' (Error: Unable to resolve nonexistent file '\home\username\projects\cursor_play\test.py'): CodeExpectedError: cannot open file:///home/username/projects/cursor_play/test.py. Detail: Unable to read file '\home\username\projects\cursor_play\test.py' (Error: Unable to resolve nonexistent file '\home\username\projects\cursor_play\test.py')
    at o.$tryOpenDocument (vscode-file://vscode-app/c:/Users/username/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/workbench.desktop.main.js:2460:132808)
ankutjaat commented 1 month ago

I've found a solution to this issue. The problem occurs because the Continue extension isn't properly switching to the WSL version and remains stuck on the Windows version.

The quick fix is to add the following configuration to your VS Code settings and then reload:

"remote.extensionKind": {
    "Continue.continue": [
        "workspace"
    ]
}

This setting forces the Continue extension to run in the WSL environment rather than on the Windows host.

Steps to implement the fix:

  1. Open VS Code Settings (File > Preferences > Settings)
  2. Click on the "Open Settings (JSON)" icon in the top right corner
  3. Add the above configuration to your settings.json file
  4. Restart VS Code

After applying this fix, the file hyperlinks in search results should work correctly in the WSL environment.

This might be an area for improvement in the extension, ensuring it automatically detects and adapts to WSL environments without requiring manual configuration.