File tree 4 files changed +11
-11
lines changed
test/terminals/codeExecution
4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -852,15 +852,15 @@ export interface IWorkspaceService {
852
852
*/
853
853
openTextDocument ( options ?: { language ?: string ; content ?: string } ) : Thenable < TextDocument > ;
854
854
/**
855
- * Saves the editor identified by the given resource to a new file name as provided by the user and
856
- * returns the resulting resource or `undefined` if save was not successful or cancelled .
855
+ * Saves the editor identified by the given resource and returns the resulting resource or `undefined`
856
+ * if save was not successful.
857
857
*
858
- * **Note** that an editor with the provided resource must be opened in order to be saved as .
858
+ * **Note** that an editor with the provided resource must be opened in order to be saved.
859
859
*
860
- * @param uri the associated uri for the opened editor to save as .
861
- * @return A thenable that resolves when the save-as operation has finished.
860
+ * @param uri the associated uri for the opened editor to save.
861
+ * @return A thenable that resolves when the save operation has finished.
862
862
*/
863
- saveAs ( uri : Uri ) : Thenable < Uri | undefined > ;
863
+ save ( uri : Uri ) : Thenable < Uri | undefined > ;
864
864
}
865
865
866
866
export const ITerminalManager = Symbol ( 'ITerminalManager' ) ;
Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ export class WorkspaceService implements IWorkspaceService {
113
113
return `{${ enabledSearchExcludes . join ( ',' ) } }` ;
114
114
}
115
115
116
- public async saveAs ( uri : Uri ) : Promise < Uri | undefined > {
116
+ public async save ( uri : Uri ) : Promise < Uri | undefined > {
117
117
try {
118
118
// This is a proposed API hence putting it inside try...catch.
119
- const result = await workspace . saveAs ( uri ) ;
119
+ const result = await workspace . save ( uri ) ;
120
120
return result ;
121
121
} catch ( ex ) {
122
122
return undefined ;
Original file line number Diff line number Diff line change @@ -122,9 +122,9 @@ export class CodeExecutionHelper implements ICodeExecutionHelper {
122
122
123
123
public async saveFileIfDirty ( file : Uri ) : Promise < Resource > {
124
124
const docs = this . documentManager . textDocuments . filter ( ( d ) => d . uri . path === file . path ) ;
125
- if ( docs . length === 1 && docs [ 0 ] . isDirty ) {
125
+ if ( docs . length === 1 && ( docs [ 0 ] . isDirty || docs [ 0 ] . isUntitled ) ) {
126
126
const workspaceService = this . serviceContainer . get < IWorkspaceService > ( IWorkspaceService ) ;
127
- return workspaceService . saveAs ( docs [ 0 ] . uri ) ;
127
+ return workspaceService . save ( docs [ 0 ] . uri ) ;
128
128
}
129
129
return undefined ;
130
130
}
Original file line number Diff line number Diff line change @@ -383,7 +383,7 @@ suite('Terminal - Code Execution Helper', () => {
383
383
const untitledUri = Uri . file ( 'Untitled-1' ) ;
384
384
document . setup ( ( doc ) => doc . uri ) . returns ( ( ) => untitledUri ) ;
385
385
const expectedSavedUri = Uri . file ( 'one.py' ) ;
386
- workspaceService . setup ( ( w ) => w . saveAs ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => Promise . resolve ( expectedSavedUri ) ) ;
386
+ workspaceService . setup ( ( w ) => w . save ( TypeMoq . It . isAny ( ) ) ) . returns ( ( ) => Promise . resolve ( expectedSavedUri ) ) ;
387
387
388
388
const savedUri = await helper . saveFileIfDirty ( untitledUri ) ;
389
389
You can’t perform that action at this time.
0 commit comments