Skip to content

Commit 11a384b

Browse files
author
Philippe Gil
committed
Merge branch 'topic/1297-handle-file-name-error' into 'master'
Support invalid imported/extended/aggregated filename Closes #1297 See merge request eng/ide/ada_language_server!1503
2 parents 7bc3ae3 + 7da2c1b commit 11a384b

File tree

15 files changed

+1435
-0
lines changed

15 files changed

+1435
-0
lines changed

source/gpr/lsp-gpr_files.adb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,10 @@ package body LSP.GPR_Files is
14891489
else
14901490
return Path_Name.Undefined;
14911491
end if;
1492+
exception
1493+
when E : others =>
1494+
File.Tracer.Trace_Exception (E);
1495+
return Path_Name.Undefined;
14921496
end Get_Referenced_GPR;
14931497

14941498
end LSP.GPR_Files;

source/gpr/lsp-gpr_files.ads

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ package LSP.GPR_Files is
112112
return LSP.Structures.DocumentUri is abstract;
113113
-- Turn GPR2 path object into URI.
114114

115+
function Tracer
116+
(Self : access File_Provider)
117+
return LSP.Tracers.Tracer_Access is abstract;
118+
115119
procedure Initialize
116120
(Self : in out File;
117121
Path : GPR2.Path_Name.Object;

source/gpr/lsp-gpr_handlers.ads

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,9 @@ private
242242
Document : not null LSP.GPR_Documents.Document_Access);
243243
-- Publish diagnostic messages for given document if needed
244244

245+
overriding function Tracer
246+
(Self : access Message_Handler)
247+
return LSP.Tracers.Tracer_Access is
248+
(Self.Tracer);
249+
245250
end LSP.GPR_Handlers;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
with " ";
2+
project Prj is
3+
end Prj;
Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
[
2+
{
3+
"comment": [
4+
"check with \" \"; support"
5+
]
6+
},
7+
{
8+
"start": {
9+
"cmd": [
10+
"${ALS}",
11+
"--language-gpr"
12+
]
13+
}
14+
},
15+
{
16+
"send": {
17+
"request": {
18+
"jsonrpc": "2.0",
19+
"id": "init",
20+
"method": "initialize",
21+
"params": {
22+
"processId": 441587,
23+
"rootUri": "$URI{.}",
24+
"capabilities": {
25+
"workspace": {
26+
"applyEdit": true,
27+
"workspaceEdit": {},
28+
"didChangeConfiguration": {},
29+
"didChangeWatchedFiles": {},
30+
"executeCommand": {}
31+
},
32+
"textDocument": {
33+
"synchronization": {},
34+
"completion": {
35+
"dynamicRegistration": true,
36+
"completionItem": {
37+
"snippetSupport": true,
38+
"documentationFormat": [
39+
"plaintext",
40+
"markdown"
41+
]
42+
}
43+
},
44+
"hover": {},
45+
"definition": {},
46+
"documentSymbol": {
47+
"hierarchicalDocumentSymbolSupport": true
48+
}
49+
}
50+
}
51+
}
52+
},
53+
"wait": [
54+
{
55+
"jsonrpc": "2.0",
56+
"id": "init",
57+
"result": {
58+
"capabilities": {
59+
"textDocumentSync": {
60+
"openClose": true,
61+
"change": 1
62+
},
63+
"completionProvider": {
64+
"triggerCharacters": [
65+
" "
66+
],
67+
"resolveProvider": true
68+
},
69+
"hoverProvider": true,
70+
"definitionProvider": true,
71+
"documentSymbolProvider": {}
72+
}
73+
}
74+
}
75+
]
76+
}
77+
},
78+
{
79+
"send": {
80+
"request": {
81+
"jsonrpc": "2.0",
82+
"method": "initialized"
83+
},
84+
"wait": []
85+
}
86+
},
87+
{
88+
"send": {
89+
"request": {
90+
"jsonrpc": "2.0",
91+
"method": "textDocument/didOpen",
92+
"params": {
93+
"textDocument": {
94+
"uri": "$URI{prj.gpr}",
95+
"languageId": "gpr",
96+
"version": 1,
97+
"text": "with \" \";\nproject Prj is\nend Prj;"
98+
}
99+
}
100+
},
101+
"wait": [
102+
{
103+
"jsonrpc": "2.0",
104+
"method": "textDocument/publishDiagnostics",
105+
"params": {
106+
"uri": "$URI{prj.gpr}",
107+
"diagnostics": [
108+
{
109+
"range": {
110+
"start": {
111+
"line": 0,
112+
"character": 5
113+
},
114+
"end": {
115+
"line": 0,
116+
"character": 5
117+
}
118+
},
119+
"severity": 1,
120+
"message": "imported project file \" .gpr\" not found"
121+
}
122+
]
123+
}
124+
}
125+
]
126+
}
127+
},
128+
{
129+
"send": {
130+
"request": {
131+
"jsonrpc": "2.0",
132+
"id": "textDocument/documentSymbol_prj_1",
133+
"method": "textDocument/documentSymbol",
134+
"params": {
135+
"textDocument": {
136+
"uri": "$URI{prj.gpr}"
137+
}
138+
}
139+
},
140+
"wait": [
141+
{
142+
"jsonrpc": "2.0",
143+
"id": "textDocument/documentSymbol_prj_1",
144+
"result": [
145+
{
146+
"name": "with clauses",
147+
"kind": 3,
148+
"range": {
149+
"start": {
150+
"line": 0,
151+
"character": 0
152+
},
153+
"end": {
154+
"line": 0,
155+
"character": 0
156+
}
157+
},
158+
"selectionRange": {
159+
"start": {
160+
"line": 0,
161+
"character": 0
162+
},
163+
"end": {
164+
"line": 0,
165+
"character": 0
166+
}
167+
},
168+
"children": [
169+
{
170+
"name": " ",
171+
"kind": 3,
172+
"range": {
173+
"start": {
174+
"line": 0,
175+
"character": 5
176+
},
177+
"end": {
178+
"line": 0,
179+
"character": 8
180+
}
181+
},
182+
"selectionRange": {
183+
"start": {
184+
"line": 0,
185+
"character": 5
186+
},
187+
"end": {
188+
"line": 0,
189+
"character": 8
190+
}
191+
}
192+
}
193+
]
194+
},
195+
{
196+
"name": "Prj",
197+
"kind": 2,
198+
"range": {
199+
"start": {
200+
"line": 1,
201+
"character": 0
202+
},
203+
"end": {
204+
"line": 1,
205+
"character": 7
206+
}
207+
},
208+
"selectionRange": {
209+
"start": {
210+
"line": 1,
211+
"character": 0
212+
},
213+
"end": {
214+
"line": 1,
215+
"character": 7
216+
}
217+
}
218+
}
219+
]
220+
}
221+
]
222+
}
223+
},
224+
{
225+
"send": {
226+
"request": {
227+
"jsonrpc": "2.0",
228+
"id": "shutdown",
229+
"method": "shutdown",
230+
"params": null
231+
},
232+
"wait": [
233+
{
234+
"id": "shutdown",
235+
"result": null
236+
}
237+
]
238+
}
239+
},
240+
{
241+
"send": {
242+
"request": {
243+
"jsonrpc": "2.0",
244+
"method": "exit"
245+
},
246+
"wait": []
247+
}
248+
},
249+
{
250+
"stop": {
251+
"exit_code": 0
252+
}
253+
}
254+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
title: 'check with " "; support'
2+
skip:
3+
- ['SKIP', 'env.build.os.name in ("windows")']
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
with " ";
2+
project Prj is
3+
end Prj;

0 commit comments

Comments
 (0)