forked from PowerShell/PowerShellEditorServices
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEditorCommands.cs
185 lines (143 loc) · 6.03 KB
/
EditorCommands.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
public class ExtensionCommandAddedNotification
{
public static readonly
NotificationType<ExtensionCommandAddedNotification, object> Type =
NotificationType<ExtensionCommandAddedNotification, object>.Create("powerShell/extensionCommandAdded");
public string Name { get; set; }
public string DisplayName { get; set; }
}
public class ExtensionCommandUpdatedNotification
{
public static readonly
NotificationType<ExtensionCommandUpdatedNotification, object> Type =
NotificationType<ExtensionCommandUpdatedNotification, object>.Create("powerShell/extensionCommandUpdated");
public string Name { get; set; }
}
public class ExtensionCommandRemovedNotification
{
public static readonly
NotificationType<ExtensionCommandRemovedNotification, object> Type =
NotificationType<ExtensionCommandRemovedNotification, object>.Create("powerShell/extensionCommandRemoved");
public string Name { get; set; }
}
public class ClientEditorContext
{
public string CurrentFileContent { get; set; }
public string CurrentFileLanguage { get; set; }
public string CurrentFilePath { get; set; }
public Position CursorPosition { get; set; }
public Range SelectionRange { get; set; }
}
public class InvokeExtensionCommandRequest
{
public static readonly
RequestType<InvokeExtensionCommandRequest, string, object, object> Type =
RequestType<InvokeExtensionCommandRequest, string, object, object>.Create("powerShell/invokeExtensionCommand");
public string Name { get; set; }
public ClientEditorContext Context { get; set; }
}
public class GetEditorContextRequest
{
public static readonly
RequestType<GetEditorContextRequest, ClientEditorContext, object, object> Type =
RequestType<GetEditorContextRequest, ClientEditorContext, object, object>.Create("editor/getEditorContext");
}
public enum EditorCommandResponse
{
Unsupported,
OK
}
public class InsertTextRequest
{
public static readonly
RequestType<InsertTextRequest, EditorCommandResponse, object, object> Type =
RequestType<InsertTextRequest, EditorCommandResponse, object, object>.Create("editor/insertText");
public string FilePath { get; set; }
public string InsertText { get; set; }
public Range InsertRange { get; set; }
}
public class SetSelectionRequest
{
public static readonly
RequestType<SetSelectionRequest, EditorCommandResponse, object, object> Type =
RequestType<SetSelectionRequest, EditorCommandResponse, object, object>.Create("editor/setSelection");
public Range SelectionRange { get; set; }
}
public class SetCursorPositionRequest
{
public static readonly
RequestType<SetCursorPositionRequest, EditorCommandResponse, object, object> Type =
RequestType<SetCursorPositionRequest, EditorCommandResponse, object, object>.Create("editor/setCursorPosition");
public Position CursorPosition { get; set; }
}
public class NewFileRequest
{
public static readonly
RequestType<string, EditorCommandResponse, object, object> Type =
RequestType<string, EditorCommandResponse, object, object>.Create("editor/newFile");
}
public class OpenFileRequest
{
public static readonly
RequestType<OpenFileDetails, EditorCommandResponse, object, object> Type =
RequestType<OpenFileDetails, EditorCommandResponse, object, object>.Create("editor/openFile");
}
public class OpenFileDetails
{
public string FilePath { get; set; }
public bool Preview { get; set; }
}
public class CloseFileRequest
{
public static readonly
RequestType<string, EditorCommandResponse, object, object> Type =
RequestType<string, EditorCommandResponse, object, object>.Create("editor/closeFile");
}
public class SaveFileRequest
{
public static readonly
RequestType<SaveFileDetails, EditorCommandResponse, object, object> Type =
RequestType<SaveFileDetails, EditorCommandResponse, object, object>.Create("editor/saveFile");
}
public class SaveFileDetails
{
public string FilePath { get; set; }
public string NewPath { get; set; }
}
public class ShowInformationMessageRequest
{
public static readonly
RequestType<string, EditorCommandResponse, object, object> Type =
RequestType<string, EditorCommandResponse, object, object>.Create("editor/showInformationMessage");
}
public class ShowWarningMessageRequest
{
public static readonly
RequestType<string, EditorCommandResponse, object, object> Type =
RequestType<string, EditorCommandResponse, object, object>.Create("editor/showWarningMessage");
}
public class ShowErrorMessageRequest
{
public static readonly
RequestType<string, EditorCommandResponse, object, object> Type =
RequestType<string, EditorCommandResponse, object, object>.Create("editor/showErrorMessage");
}
public class SetStatusBarMessageRequest
{
public static readonly
RequestType<StatusBarMessageDetails, EditorCommandResponse, object, object> Type =
RequestType<StatusBarMessageDetails, EditorCommandResponse, object, object>.Create("editor/setStatusBarMessage");
}
public class StatusBarMessageDetails
{
public string Message { get; set; }
public int? Timeout { get; set; }
}
}