smallcloudai / refact-vscode

Refact AI: Open-source AI Code assistant with autocompletion, chat, refactoring and more for VS Code
https://refact.ai
BSD 3-Clause "New" or "Revised" License
59 stars 18 forks source link

[VS Code] Unable to write into user settings because the file has unsaved changes #91

Open hazratisulton opened 4 months ago

hazratisulton commented 4 months ago

Make changes to the VS Code settings json file. Try to make and apply changes to Refact settings via the interface. A possible case is the inability to save settings in the plugin initial setup wizard.

Expected result: The settings changes have been applied. (If the settings cannot be applied, a message about the reason is received)

Actual result: Settings changes are not applied. There are no error messages in the interface. IDE logs: [Extension Host] RECEIVED JS2TS: {"type":"save_selfhosted","endpoint":"http://127.0.0.1:8008/"} console.ts:137 [Extension Host] rejected promise not handled within 1 second: CodeExpectedError: Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again. console.ts:137 [Extension Host] stack trace: CodeExpectedError: Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again. at d.y (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:34686) at d.E (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:37832) at d.n (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:31799) at Object.factory (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:31699) at P.j (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:17408) at vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:17319 at new Promise (<anonymous>) at P.queue (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:17259) at d.writeConfiguration (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:31668) at B.Hb (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:56560) at async Promise.all (index 0) at async Object._ [as settled] (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:23616) at async B.updateValue (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:44639) log.ts:437 ERR Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again.: CodeExpectedError: Unable to write into user settings because the file has unsaved changes. Please save the user settings file first and then try again. at d.y (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:34686) at d.E (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:37832) at d.n (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:31799) at Object.factory (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:31699) at P.j (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:17408) at vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:17319 at new Promise (<anonymous>) at P.queue (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:17259) at d.writeConfiguration (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:31668) at B.Hb (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:56560) at async Promise.all (index 0) at async Object._ [as settled] (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:149:23616) at async B.updateValue (vscode-file://vscode-app/snap/code/151/usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.js:2076:44639) 

Version: v2.0.124

olegklimov commented 4 months ago

If you have settings open as a text file and modified, there can be problems saving changes automatically, sure. What the issue exactly is?

hazratisulton commented 4 months ago

If you have settings open as a text file and modified, there can be problems saving changes automatically, sure. What the issue exactly is?

The problem is that a new user may encounter this problem when first launching and configuring the plugin. He will not understand why the settings are not saved in the plugin initial setup wizard. We could be user friendly and show a message about the problem and how to solve it.

olegklimov commented 4 months ago

Solutuon => show a popup that caches the exception