Skip to content

Commit 2f07d90

Browse files
dfinkedaviwil
authored andcommitted
Moved to EditorWindow class
1 parent 9f6316b commit 2f07d90

File tree

5 files changed

+77
-45
lines changed

5 files changed

+77
-45
lines changed

src/PowerShellEditorServices.Protocol/LanguageServer/EditorCommands.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public static readonly
107107
RequestType<string, EditorCommandResponse> Type =
108108
RequestType<string, EditorCommandResponse>.Create("editor/openFile");
109109
}
110+
110111
public class ShowInformationMessageRequest
111112
{
112113
public static readonly

src/PowerShellEditorServices/Extensions/EditorContext.cs

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -109,50 +109,6 @@ public void SetSelection(BufferRange selectionRange)
109109
.Wait();
110110
}
111111

112-
/// <summary>
113-
///
114-
/// </summary>
115-
/// <param name="message"></param>
116-
public void ShowInformationMessage(string message)
117-
{
118-
this.editorOperations
119-
.ShowInformationMessage(message)
120-
.Wait();
121-
}
122-
123-
/// <summary>
124-
///
125-
/// </summary>
126-
/// <param name="message"></param>
127-
public void ShowErrorMessage(string message)
128-
{
129-
this.editorOperations
130-
.ShowErrorMessage(message)
131-
.Wait();
132-
}
133-
134-
/// <summary>
135-
///
136-
/// </summary>
137-
/// <param name="message"></param>
138-
public void ShowWarningMessage(string message)
139-
{
140-
this.editorOperations
141-
.ShowWarningMessage(message)
142-
.Wait();
143-
}
144-
145-
/// <summary>
146-
///
147-
/// </summary>
148-
/// <param name="message"></param>
149-
public void SetStatusBarMessage(string message)
150-
{
151-
this.editorOperations
152-
.SetStatusBarMessage(message)
153-
.Wait();
154-
}
155-
156112
#endregion
157113
}
158114
}

src/PowerShellEditorServices/Extensions/EditorObject.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ public Version EditorServicesVersion
3737
/// </summary>
3838
public EditorWorkspace Workspace { get; private set; }
3939

40+
/// <summary>
41+
/// Gets the window interface for the editor API.
42+
/// </summary>
43+
public EditorWindow Window { get; private set; }
44+
4045
#endregion
4146

4247
/// <summary>
@@ -53,6 +58,7 @@ public EditorObject(
5358

5459
// Create API area objects
5560
this.Workspace = new EditorWorkspace(this.editorOperations);
61+
this.Window = new EditorWindow(this.editorOperations);
5662
}
5763

5864
/// <summary>
@@ -82,7 +88,7 @@ public void UnregisterCommand(string commandName)
8288
public EditorContext GetEditorContext()
8389
{
8490
return this.editorOperations.GetEditorContext().Result;
85-
}
91+
}
8692
}
8793
}
8894

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
//
5+
6+
namespace Microsoft.PowerShell.EditorServices.Extensions
7+
{
8+
/// <summary>
9+
/// Provides a PowerShell-facing API which allows scripts to
10+
/// interact with the editor's window.
11+
/// </summary>
12+
public class EditorWindow
13+
{
14+
#region Private Fields
15+
16+
private IEditorOperations editorOperations;
17+
18+
#endregion
19+
20+
#region Constructors
21+
22+
internal EditorWindow(IEditorOperations editorOperations)
23+
{
24+
this.editorOperations = editorOperations;
25+
}
26+
27+
#endregion
28+
29+
#region Public Methods
30+
/// <summary>
31+
///
32+
/// </summary>
33+
/// <param name="message"></param>
34+
public void ShowInformationMessage(string message)
35+
{
36+
this.editorOperations.ShowInformationMessage(message).Wait();
37+
}
38+
39+
/// <summary>
40+
///
41+
/// </summary>
42+
/// <param name="message"></param>
43+
public void ShowErrorMessage(string message)
44+
{
45+
this.editorOperations.ShowErrorMessage(message).Wait();
46+
}
47+
48+
/// <summary>
49+
///
50+
/// </summary>
51+
/// <param name="message"></param>
52+
public void ShowWarningMessage(string message)
53+
{
54+
this.editorOperations.ShowWarningMessage(message).Wait();
55+
}
56+
57+
/// <summary>
58+
///
59+
/// </summary>
60+
/// <param name="message"></param>
61+
public void SetStatusBarMessage(string message)
62+
{
63+
this.editorOperations.SetStatusBarMessage(message).Wait();
64+
}
65+
66+
#endregion
67+
}
68+
}

src/PowerShellEditorServices/PowerShellEditorServices.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
<Compile Include="Debugging\VariableContainerDetails.cs" />
8080
<Compile Include="Extensions\EditorContext.cs" />
8181
<Compile Include="Extensions\EditorObject.cs" />
82+
<Compile Include="Extensions\EditorWindow.cs" />
8283
<Compile Include="Extensions\EditorWorkspace.cs" />
8384
<Compile Include="Extensions\EditorCommand.cs" />
8485
<Compile Include="Extensions\ExtensionService.cs" />

0 commit comments

Comments
 (0)