Skip to content

If interface exists, ask if it should be overwritten #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
14 changes: 13 additions & 1 deletion client/src/commands/create_interface.ts
Original file line number Diff line number Diff line change
@@ -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, {