File tree Expand file tree Collapse file tree 6 files changed +132
-15
lines changed
PowerShellEditorServices.Protocol
test/PowerShellEditorServices.Test/Extensions Expand file tree Collapse file tree 6 files changed +132
-15
lines changed Original file line number Diff line number Diff line change @@ -107,5 +107,25 @@ public static readonly
107
107
RequestType < string , EditorCommandResponse > Type =
108
108
RequestType < string , EditorCommandResponse > . Create ( "editor/openFile" ) ;
109
109
}
110
+ public class ShowInformationMessageRequest
111
+ {
112
+ public static readonly
113
+ RequestType < string , EditorCommandResponse > Type =
114
+ RequestType < string , EditorCommandResponse > . Create ( "editor/showInformationMessage" ) ;
115
+ }
116
+
117
+ public class ShowWarningMessageRequest
118
+ {
119
+ public static readonly
120
+ RequestType < string , EditorCommandResponse > Type =
121
+ RequestType < string , EditorCommandResponse > . Create ( "editor/showWarningMessage" ) ;
122
+ }
123
+
124
+ public class ShowErrorMessageRequest
125
+ {
126
+ public static readonly
127
+ RequestType < string , EditorCommandResponse > Type =
128
+ RequestType < string , EditorCommandResponse > . Create ( "editor/showErrorMessage" ) ;
129
+ }
110
130
}
111
131
Original file line number Diff line number Diff line change @@ -109,5 +109,33 @@ public Task OpenFile(string filePath)
109
109
filePath ,
110
110
true ) ;
111
111
}
112
+
113
+ public Task ShowInformationMessage ( string message )
114
+ {
115
+ return
116
+ this . messageSender . SendRequest (
117
+ ShowInformationMessageRequest . Type ,
118
+ message ,
119
+ true ) ;
120
+ }
121
+
122
+ public Task ShowErrorMessage ( string message )
123
+ {
124
+ return
125
+ this . messageSender . SendRequest (
126
+ ShowErrorMessageRequest . Type ,
127
+ message ,
128
+ true ) ;
129
+ }
130
+
131
+ public Task ShowWarningMessage ( string message )
132
+ {
133
+ return
134
+ this . messageSender . SendRequest (
135
+ ShowWarningMessageRequest . Type ,
136
+ message ,
137
+ true ) ;
138
+
139
+ }
112
140
}
113
141
}
Original file line number Diff line number Diff line change @@ -109,6 +109,39 @@ public void SetSelection(BufferRange selectionRange)
109
109
. Wait ( ) ;
110
110
}
111
111
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
+
112
145
#endregion
113
146
}
114
147
}
Original file line number Diff line number Diff line change @@ -43,6 +43,27 @@ public interface IEditorOperations
43
43
/// <param name="selectionRange">The range over which the selection will be made.</param>
44
44
/// <returns>A Task that can be tracked for completion.</returns>
45
45
Task SetSelection ( BufferRange selectionRange ) ;
46
+
47
+ /// <summary>
48
+ ///
49
+ /// </summary>
50
+ /// <param name="message"></param>
51
+ /// <returns></returns>
52
+ Task ShowInformationMessage ( string message ) ;
53
+
54
+ /// <summary>
55
+ ///
56
+ /// </summary>
57
+ /// <param name="message"></param>
58
+ /// <returns></returns>
59
+ Task ShowErrorMessage ( string message ) ;
60
+
61
+ /// <summary>
62
+ ///
63
+ /// </summary>
64
+ /// <param name="message"></param>
65
+ /// <returns></returns>
66
+ Task ShowWarningMessage ( string message ) ;
46
67
}
47
68
}
48
69
Original file line number Diff line number Diff line change @@ -499,26 +499,26 @@ private void ParseFileContents()
499
499
{
500
500
#if PowerShellv5r2
501
501
// This overload appeared with Windows 10 Update 1
502
- if ( this . powerShellVersion . Major >= 5 &&
503
- this . powerShellVersion . Build >= 10586 )
504
- {
505
- // Include the file path so that module relative
506
- // paths are evaluated correctly
507
- this . ScriptAst =
508
- Parser . ParseInput (
509
- this . Contents ,
510
- this . FilePath ,
511
- out this . scriptTokens ,
512
- out parseErrors ) ;
513
- }
514
- else
515
- {
502
+ // if (this.powerShellVersion.Major >= 5 &&
503
+ // this.powerShellVersion.Build >= 10586)
504
+ // {
505
+ // // Include the file path so that module relative
506
+ // // paths are evaluated correctly
507
+ // this.ScriptAst =
508
+ // Parser.ParseInput(
509
+ // this.Contents,
510
+ // this.FilePath,
511
+ // out this.scriptTokens,
512
+ // out parseErrors);
513
+ // }
514
+ // else
515
+ // {
516
516
this . ScriptAst =
517
517
Parser . ParseInput (
518
518
this . Contents ,
519
519
out this . scriptTokens ,
520
520
out parseErrors ) ;
521
- }
521
+ // }
522
522
#else
523
523
this . ScriptAst =
524
524
Parser . ParseInput (
Original file line number Diff line number Diff line change @@ -187,6 +187,21 @@ public Task<EditorContext> GetEditorContext()
187
187
{
188
188
throw new NotImplementedException ( ) ;
189
189
}
190
+
191
+ public Task ShowInformationMessage ( string message )
192
+ {
193
+ throw new NotImplementedException ( ) ;
194
+ }
195
+
196
+ public Task ShowErrorMessage ( string message )
197
+ {
198
+ throw new NotImplementedException ( ) ;
199
+ }
200
+
201
+ public Task ShowWarningMessage ( string message )
202
+ {
203
+ throw new NotImplementedException ( ) ;
204
+ }
190
205
}
191
206
}
192
207
You can’t perform that action at this time.
0 commit comments