@@ -35,15 +35,6 @@ package body LSP.Ada_Handlers is
35
35
return LSP.Types.LSP_String renames
36
36
LSP.Types.To_LSP_String;
37
37
38
- -- ---------------------
39
- -- Exit_Notification --
40
- -- ---------------------
41
-
42
- overriding procedure Exit_Notification (Self : access Message_Handler) is
43
- begin
44
- Self.Server.Stop;
45
- end Exit_Notification ;
46
-
47
38
-- ----------------------
48
39
-- Initialize_Request --
49
40
-- ----------------------
@@ -55,12 +46,12 @@ package body LSP.Ada_Handlers is
55
46
is
56
47
Root : LSP.Types.LSP_String;
57
48
begin
49
+ Response.result.capabilities.textDocumentSync :=
50
+ (Is_Set => True, Is_Number => True, Value => LSP.Messages.Full);
58
51
Response.result.capabilities.referencesProvider :=
59
52
LSP.Types.Optional_True;
60
53
Response.result.capabilities.documentSymbolProvider :=
61
54
LSP.Types.Optional_True;
62
- Response.result.capabilities.textDocumentSync :=
63
- (Is_Set => True, Is_Number => True, Value => LSP.Messages.Full);
64
55
65
56
if not LSP.Types.Is_Empty (Value.rootUri) then
66
57
Root := Delete (Value.rootUri, 1 , 7 );
@@ -71,38 +62,6 @@ package body LSP.Ada_Handlers is
71
62
Self.Context.Initialize (Root);
72
63
end Initialize_Request ;
73
64
74
- -- ----------------------------
75
- -- Text_Document_Did_Change --
76
- -- ----------------------------
77
-
78
- overriding procedure Text_Document_Did_Change
79
- (Self : access Message_Handler;
80
- Value : LSP.Messages.DidChangeTextDocumentParams)
81
- is
82
- Document : constant LSP.Ada_Documents.Document_Access :=
83
- Self.Context.Get_Document (Value.textDocument.uri);
84
- Note : LSP.Messages.PublishDiagnostics_Notification;
85
- begin
86
- Document.Apply_Changes (Value.contentChanges);
87
- Document.Get_Errors (Note.params.diagnostics);
88
-
89
- Note.method := +" textDocument/publishDiagnostics" ;
90
- Note.params.uri := Value.textDocument.uri;
91
- Self.Server.Send_Notification (Note);
92
- end Text_Document_Did_Change ;
93
-
94
- -- --------------------------
95
- -- Text_Document_Did_Open --
96
- -- --------------------------
97
-
98
- overriding procedure Text_Document_Did_Open
99
- (Self : access Message_Handler;
100
- Value : LSP.Messages.DidOpenTextDocumentParams)
101
- is
102
- begin
103
- Self.Context.Load_Document (Value.textDocument);
104
- end Text_Document_Did_Open ;
105
-
106
65
-- ------------------------------------
107
66
-- Text_Document_References_Request --
108
67
-- ------------------------------------
@@ -186,4 +145,57 @@ package body LSP.Ada_Handlers is
186
145
Document.Get_Symbols (Response.result);
187
146
end Text_Document_Symbol_Request ;
188
147
148
+ -- --------------------------
149
+ -- Text_Document_Did_Open --
150
+ -- --------------------------
151
+
152
+ overriding procedure Text_Document_Did_Open
153
+ (Self : access Message_Handler;
154
+ Value : LSP.Messages.DidOpenTextDocumentParams)
155
+ is
156
+ begin
157
+ Self.Context.Load_Document (Value.textDocument);
158
+ end Text_Document_Did_Open ;
159
+
160
+ -- ----------------------------
161
+ -- Text_Document_Did_Change --
162
+ -- ----------------------------
163
+
164
+ overriding procedure Text_Document_Did_Change
165
+ (Self : access Message_Handler;
166
+ Value : LSP.Messages.DidChangeTextDocumentParams)
167
+ is
168
+ Document : constant LSP.Ada_Documents.Document_Access :=
169
+ Self.Context.Get_Document (Value.textDocument.uri);
170
+ Note : LSP.Messages.PublishDiagnostics_Notification;
171
+ begin
172
+ Document.Apply_Changes (Value.contentChanges);
173
+ Document.Get_Errors (Note.params.diagnostics);
174
+
175
+ Note.method := +" textDocument/publishDiagnostics" ;
176
+ Note.params.uri := Value.textDocument.uri;
177
+ Self.Server.Send_Notification (Note);
178
+ end Text_Document_Did_Change ;
179
+
180
+ -- ---------------------------
181
+ -- Text_Document_Did_Close --
182
+ -- ---------------------------
183
+
184
+ overriding procedure Text_Document_Did_Close
185
+ (Self : access Message_Handler;
186
+ Value : LSP.Messages.DidCloseTextDocumentParams)
187
+ is
188
+ begin
189
+ Self.Context.Unload_Document (Value.textDocument);
190
+ end Text_Document_Did_Close ;
191
+
192
+ -- ---------------------
193
+ -- Exit_Notification --
194
+ -- ---------------------
195
+
196
+ overriding procedure Exit_Notification (Self : access Message_Handler) is
197
+ begin
198
+ Self.Server.Stop;
199
+ end Exit_Notification ;
200
+
189
201
end LSP.Ada_Handlers ;
0 commit comments