forked from genericptr/pascal-language-server
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwindow.pas
131 lines (100 loc) · 3.57 KB
/
window.pas
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
// Pascal Language Server
// Copyright 2020 Ryan Joseph
// This file is part of Pascal Language Server.
// Pascal Language Server is free software: you can redistribute it
// and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation, either version 3 of
// the License, or (at your option) any later version.
// Pascal Language Server is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Pascal Language Server. If not, see
// <https://www.gnu.org/licenses/>.
unit window;
{$mode objfpc}{$H+}
interface
uses
Classes,
CodeToolManager, CodeCache,
lsp, basic;
// https://microsoft.github.io/language-server-protocol/specifications/specification-3-15/#window_showMessage
type
{ TMessageType }
TMessageType = (
// An error message.
Error = 1,
// A warning message.
Warning = 2,
// An information message.
Info = 3,
// A log message.
Log = 4
);
{ TShowMessageParams }
TShowMessageParams = class(TPersistent)
private
fType: TMessageType;
fMessage: string;
fHasFile: Boolean;
published
// The message type.
property &type: TMessageType read fType write fType;
// The actual message.
property message: string read fMessage write fMessage;
// The Unit File
property hasFile: Boolean read fHasFile write fHasFile;
end;
{ TShowMessageNotification }
{ The show message notification is sent from a server to a client to ask
the client to display a particular message in the user interface. }
TShowMessageNotification = class(TNotificationMessage)
public
constructor Create(_type: TMessageType; Message: String;_hasfile:Boolean=False);
destructor Destroy; override;
end;
TMessageActionItem = class(TCollectionItem)
private
fTitle: string;
published
// A short title like 'Retry', 'Open Log' etc.
property title: string read fTitle write fTitle;
end;
TMessageActionItems = specialize TGenericCollection<TMessageActionItem>;
{ TShowMessageRequstParams }
TShowMessageRequstParams = class(TShowMessageParams)
private
fActions: TMessageActionItems;
published
// The message action items to present.
property actions: TMessageActionItems read fActions write fActions;
end;
{ The show message request is sent from a server to a client to ask the
client to display a particular message in the user interface. In addition
to the show message notification the request allows to pass actions
and to wait for an answer from the client. }
//TShowMessageRequest = class(specialize TLSPRequest<TShowMessageRequstParams, TMessageActionItem>)
// function Process(var Params: TShowMessageRequstParams): TMessageActionItem; override;
//end;
implementation
{ TShowMessageNotification }
constructor TShowMessageNotification.Create(_type: TMessageType; Message: String;_hasfile:Boolean);
begin
params := TShowMessageParams.Create;
TShowMessageParams(params).&type := _type;
TShowMessageParams(params).message := Message;
TShowMessageParams(params).hasFile := _hasfile;
method := 'window/showMessage';
end;
destructor TShowMessageNotification.Destroy;
begin
params.Free;
inherited;
end;
{ TShowMessageRequest }
//function TShowMessageRequest.Process(var Params: TShowMessageRequstParams): TMessageActionItem;
//begin
// result := nil
//end;
end.