File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
src/PowerShellEditorServices Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,16 @@ public sealed class EditorWorkspace
3939 #region Public Methods
4040 // TODO: Consider returning bool instead of void to indicate success?
4141
42+ /// <summary>
43+ /// Creates a new file in the editor.
44+ /// </summary>
45+ public void NewFile ( ) => editorOperations . NewFileAsync ( string . Empty ) . Wait ( ) ;
46+
4247 /// <summary>
4348 /// Creates a new file in the editor.
4449 /// </summary>
4550 /// <param name="content">The content to place in the new file.</param>
46- public void NewFile ( string content = "" ) => editorOperations . NewFileAsync ( content ) . Wait ( ) ;
51+ public void NewFile ( string content ) => editorOperations . NewFileAsync ( content ) . Wait ( ) ;
4752
4853 /// <summary>
4954 /// Opens a file in the workspace. If the file is already open
Original file line number Diff line number Diff line change @@ -38,12 +38,18 @@ internal interface IEditorOperations
3838 /// <returns>The resolved file path.</returns>
3939 string GetWorkspaceRelativePath ( ScriptFile scriptFile ) ;
4040
41+ /// <summary>
42+ /// Causes a new untitled file to be created in the editor.
43+ /// </summary>
44+ /// <returns>A task that can be awaited for completion.</returns>
45+ Task NewFileAsync ( ) ;
46+
4147 /// <summary>
4248 /// Causes a new untitled file to be created in the editor.
4349 /// </summary>
4450 /// <param name="content">The content to insert into the new file.</param>
4551 /// <returns>A task that can be awaited for completion.</returns>
46- Task NewFileAsync ( string content = "" ) ;
52+ Task NewFileAsync ( string content ) ;
4753
4854 /// <summary>
4955 /// Causes a file to be opened in the editor. If the file is
Original file line number Diff line number Diff line change @@ -121,7 +121,12 @@ public EditorContext ConvertClientEditorContext(
121121 clientContext . CurrentFileLanguage ) ;
122122 }
123123
124- public async Task NewFileAsync ( string content = "" )
124+ public async Task NewFileAsync ( )
125+ {
126+ return NewFileAsync ( "" ) ;
127+ }
128+
129+ public async Task NewFileAsync ( string content )
125130 {
126131 if ( ! TestHasLanguageServer ( ) )
127132 {
You can’t perform that action at this time.
0 commit comments