Skip to content

Commit 091c9fe

Browse files
If interface exists, ask if it should be overwritten (#865)
* If interface exists, ask if it should be overwritten * Changelog
1 parent fde49b6 commit 091c9fe

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
1313
## master
1414

15+
#### :rocket: New Feature
16+
17+
- If interface file exists, ask if it should be overwritten. https://github.com/rescript-lang/rescript-vscode/pull/865
18+
1519
#### :bug: Bug Fix
1620

1721
- Treat `result` type as a proper built in type. https://github.com/rescript-lang/rescript-vscode/pull/860

client/src/commands/create_interface.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@ export const createInterface = (client: LanguageClient) => {
2121
}
2222

2323
if (fs.existsSync(editor.document.uri.fsPath + "i")) {
24-
return window.showInformationMessage("Interface file already exists");
24+
return window
25+
.showInformationMessage(
26+
"Interface file already exists. Do you want to overwrite it?",
27+
"Yes",
28+
"No"
29+
)
30+
.then((answer) => {
31+
if (answer === "Yes") {
32+
client.sendRequest(createInterfaceRequest, {
33+
uri: editor.document.uri.toString(),
34+
});
35+
}
36+
});
2537
}
2638

2739
client.sendRequest(createInterfaceRequest, {

0 commit comments

Comments
 (0)