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
19.6k stars 1.71k forks source link

VsCodeExtension when listening to config changes is using an inconsistent system file path on windows. #2379

Open al3x-lm opened 2 months ago

al3x-lm commented 2 months ago

Before submitting your bug report

Relevant environment info

- OS:Win
- Continue:0.8.50
- IDE:VSCODE
- Model:1.92.1
- config.json:

Description

The VsCodeExtension file is listening for config changes but it is not getting triggered on windows due to an inconsistency on the system path, one method returns a lower case drive letter on windows and the other returns an upper case drive letter.

filepath === getConfigJsonPath()
c:\Users\snappy\.continue\config.json === C:\Users\snappy\.continue\config.json

I temporarly used filepath.toLowerCase() === getConfigJsonPath().toLowerCase(). Is there a better way to handle the system filepath?

To reproduce

` vscode.workspace.onDidSaveTextDocument(async (event) => { // Listen for file changes in the workspace const filepath = event.uri.fsPath;

  console.log("some file saved");
  console.log("filepath");
  console.log(filepath);
  console.log("getConfigJsonPath()");
  console.log(getConfigJsonPath());

  if (filepath === getConfigJsonPath()) {
    console.log("config saved");`

this returns

`[Extension Host] some file saved
console.ts:137 [Extension Host] filepath
console.ts:137 [Extension Host] c:\Users\snappy\.continue\config.json
console.ts:137 [Extension Host] getConfigJsonPath()
console.ts:137 [Extension Host] C:\Users\snappy\.continue\config.json`

Log output

No response

sestinj commented 2 months ago

@al3x-lm Thanks for being thorough, this made it much easier to come to a good solution : )

In this commit we make sure that the check is case insensitive on windows: https://github.com/continuedev/continue/commit/a3fa8653b92e0f54b1ede875ab07b5ffeeea9aa9

I'll leave the issue open until we've had the chance to release in pre-release and validate the fix