File tree
Expand file treeCollapse file tree3 files changed
+16
-3
lines changed src/PowerShellEditorServices
Expand file treeCollapse file tree3 files changed
+16
-3
lines changed Original file line number | Diff line number | Diff line change |
---|
@@ -39,11 +39,16 @@ public sealed class EditorWorkspace
|
39 | 39 | #region Public Methods
|
40 | 40 | // TODO: Consider returning bool instead of void to indicate success?
|
41 | 41 |
|
| 42 | +/// <summary> |
| 43 | +/// Creates a new file in the editor. |
| 44 | +/// </summary> |
| 45 | +public void NewFile() => editorOperations.NewFileAsync(string.Empty).Wait(); |
| 46 | + |
42 | 47 | /// <summary>
|
43 | 48 | /// Creates a new file in the editor.
|
44 | 49 | /// </summary>
|
45 | 50 | /// <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(); |
47 | 52 |
|
48 | 53 | /// <summary>
|
49 | 54 | /// 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
|
38 | 38 | /// <returns>The resolved file path.</returns>
|
39 | 39 | string GetWorkspaceRelativePath(ScriptFile scriptFile);
|
40 | 40 |
|
| 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 | + |
41 | 47 | /// <summary>
|
42 | 48 | /// Causes a new untitled file to be created in the editor.
|
43 | 49 | /// </summary>
|
44 | 50 | /// <param name="content">The content to insert into the new file.</param>
|
45 | 51 | /// <returns>A task that can be awaited for completion.</returns>
|
46 |
| -Task NewFileAsync(string content = ""); |
| 52 | +Task NewFileAsync(string content); |
47 | 53 |
|
48 | 54 | /// <summary>
|
49 | 55 | /// 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,9 @@ public EditorContext ConvertClientEditorContext(
|
121 | 121 | clientContext.CurrentFileLanguage);
|
122 | 122 | }
|
123 | 123 |
|
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) |
125 | 127 | {
|
126 | 128 | if (!TestHasLanguageServer())
|
127 | 129 | {
|
|
You can’t perform that action at this time.
0 commit comments