Skip to content

Commit

Permalink
Have workspace.save and workspace.saveAs methods that return the …
Browse files Browse the repository at this point in the history
…URI (fix #178713)
  • Loading branch information
bpasero committed Dec 7, 2023
1 parent bdef7fd commit ebc98aa
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 39 deletions.
1 change: 0 additions & 1 deletion extensions/vscode-api-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"readonlyMessage",
"languageStatusText",
"resolvers",
"saveEditor",
"scmActionButton",
"scmSelectedProvider",
"scmTextDocument",
Expand Down
2 changes: 0 additions & 2 deletions src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -933,11 +933,9 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
return extHostWorkspace.findTextInFiles(query, options || {}, callback, extension.identifier, token);
},
save: (uri) => {
checkProposedApiEnabled(extension, 'saveEditor');
return extHostWorkspace.save(uri);
},
saveAs: (uri) => {
checkProposedApiEnabled(extension, 'saveEditor');
return extHostWorkspace.saveAs(uri);
},
saveAll: (includeUntitled?) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ export const allApiProposals = Object.freeze({
quickPickSortByLabel: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts',
readonlyMessage: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.readonlyMessage.d.ts',
resolvers: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.resolvers.d.ts',
saveEditor: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.saveEditor.d.ts',
scmActionButton: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmActionButton.d.ts',
scmHistoryProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts',
scmSelectedProvider: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.scmSelectedProvider.d.ts',
Expand Down
23 changes: 23 additions & 0 deletions src/vscode-dts/vscode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13648,6 +13648,29 @@ declare module 'vscode' {
* Event that fires when the current workspace has been trusted.
*/
export const onDidGrantWorkspaceTrust: Event<void>;

/**
* Saves the editor identified by the given resource and returns the resulting resource or `undefined`
* if save was not successful or no editor with the given resource was found.
*
* **Note** that an editor with the provided resource must be opened in order to be saved.
*
* @param uri the associated uri for the opened editor to save.
* @returns A thenable that resolves when the save operation has finished.
*/
export function save(uri: Uri): Thenable<Uri | undefined>;

/**
* Saves the editor identified by the given resource to a new file name as provided by the user and
* returns the resulting resource or `undefined` if save was not successful or cancelled or no editor
* with the given resource was found.
*
* **Note** that an editor with the provided resource must be opened in order to be saved as.
*
* @param uri the associated uri for the opened editor to save as.
* @returns A thenable that resolves when the save-as operation has finished.
*/
export function saveAs(uri: Uri): Thenable<Uri | undefined>;
}

/**
Expand Down
35 changes: 0 additions & 35 deletions src/vscode-dts/vscode.proposed.saveEditor.d.ts

This file was deleted.

0 comments on commit ebc98aa

Please sign in to comment.