diff --git a/CHANGELOG.md b/CHANGELOG.md index 0795f2536..ec806af61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ ## master +#### :rocket: New Feature + +- If interface file exists, ask if it should be overwritten. https://github.com/rescript-lang/rescript-vscode/pull/865 + #### :bug: Bug Fix - Treat `result` type as a proper built in type. https://github.com/rescript-lang/rescript-vscode/pull/860 diff --git a/client/src/commands/create_interface.ts b/client/src/commands/create_interface.ts index 49ff5b773..cfef3f85c 100644 --- a/client/src/commands/create_interface.ts +++ b/client/src/commands/create_interface.ts @@ -21,7 +21,19 @@ export const createInterface = (client: LanguageClient) => { } if (fs.existsSync(editor.document.uri.fsPath + "i")) { - return window.showInformationMessage("Interface file already exists"); + return window + .showInformationMessage( + "Interface file already exists. Do you want to overwrite it?", + "Yes", + "No" + ) + .then((answer) => { + if (answer === "Yes") { + client.sendRequest(createInterfaceRequest, { + uri: editor.document.uri.toString(), + }); + } + }); } client.sendRequest(createInterfaceRequest, {