Skip to content

Commit 85fd5be

Browse files
Use separate overload instead of optional argument
So as to now add a binary breaking change. Co-authored-by: Patrick Meinecke <[email protected]>
1 parent 4be31b5 commit 85fd5be

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/PowerShellEditorServices/Extensions/EditorWorkspace.cs

+6-1
Original file line numberDiff line numberDiff 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

src/PowerShellEditorServices/Extensions/IEditorOperations.cs

+7-1
Original file line numberDiff line numberDiff 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

src/PowerShellEditorServices/Services/Extension/EditorOperationsService.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ public EditorContext ConvertClientEditorContext(
121121
clientContext.CurrentFileLanguage);
122122
}
123123

124-
public async Task NewFileAsync(string content = "")
124+
public async Task NewFileAsync() => await NewFileAsync(string.Empty).ConfigureAwait(false);
125+
126+
public async Task NewFileAsync(string content)
125127
{
126128
if (!TestHasLanguageServer())
127129
{

0 commit comments

Comments
 (0)