Skip to content

Commit 47fd3fb

Browse files
Merge branch 'topic/gs.305.context_id_not_unique_enough' into 'master'
Project loading failing when projects were sharing the same name See merge request eng/ide/ada_language_server!1650
2 parents 9663cec + 9c03479 commit 47fd3fb

File tree

37 files changed

+99
-94
lines changed

37 files changed

+99
-94
lines changed

source/ada/lsp-ada_contexts.adb

+4-1
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,11 @@ package body LSP.Ada_Contexts is
729729
end Pretty_Printer_Setup;
730730

731731
begin
732+
-- Use the full path for the ID to avoid conflict when project are
733+
-- sharing the same name. For example for GNATTest stubs.
732734
Self.Id := VSS.Strings.Conversions.To_Virtual_String
733-
(String (Root.Name));
735+
(URIs.Conversions.From_File
736+
(String (Root.Path_Name.Value)));
734737
Self.Tree := Tree.Reference;
735738
Self.Charset := Ada.Strings.Unbounded.To_Unbounded_String (Charset);
736739

source/ada/lsp-ada_handlers-project_loading.adb

+2
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ package body LSP.Ada_Handlers.Project_Loading is
299299
Root => View,
300300
Charset => VSS.Strings.Conversions.To_UTF_8_String (Charset));
301301

302+
Self.Tracer.Trace ("Prepend Context Id: "
303+
& VSS.Strings.Conversions.To_UTF_8_String (C.Id));
302304
Self.Contexts.Prepend (C);
303305
end Create_Context_For_Non_Aggregate;
304306

testsuite/ada_lsp/S314-015.refactor_change_parameter_mode_0/test.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
"title": "",
294294
"command": "als-refactor-change-parameter-mode",
295295
"arguments": [{
296-
"context": "Default",
296+
"context": "$URI{default.gpr}",
297297
"where": {
298298
"textDocument": {
299299
"uri": "$URI{main.adb}"
@@ -316,7 +316,7 @@
316316
"title": "",
317317
"command": "als-refactor-change-parameter-mode",
318318
"arguments": [{
319-
"context": "Default",
319+
"context": "$URI{default.gpr}",
320320
"where": {
321321
"textDocument": {
322322
"uri": "$URI{main.adb}"
@@ -339,7 +339,7 @@
339339
"title": "",
340340
"command": "als-refactor-change-parameter-mode",
341341
"arguments": [{
342-
"context": "Default",
342+
"context": "$URI{default.gpr}",
343343
"where": {
344344
"textDocument": {
345345
"uri": "$URI{main.adb}"
@@ -369,7 +369,7 @@
369369
"params": {
370370
"command": "als-refactor-change-parameter-mode",
371371
"arguments": [{
372-
"context": "Default",
372+
"context": "$URI{default.gpr}",
373373
"where": {
374374
"textDocument": {
375375
"uri": "$URI{main.adb}"

testsuite/ada_lsp/S314-015.refactor_move_parameter_0/test.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
"title": "",
295295
"command": "als-refactor-move-parameter",
296296
"arguments": [{
297-
"context": "Default",
297+
"context": "$URI{default.gpr}",
298298
"where": {
299299
"textDocument": {
300300
"uri": "$URI{main.adb}"
@@ -323,7 +323,7 @@
323323
"params": {
324324
"command": "als-refactor-move-parameter",
325325
"arguments": [{
326-
"context": "Default",
326+
"context": "$URI{default.gpr}",
327327
"where": {
328328
"textDocument": {
329329
"uri": "$URI{main.adb}"
@@ -576,7 +576,7 @@
576576
"title": "",
577577
"command": "als-refactor-move-parameter",
578578
"arguments": [{
579-
"context": "Default",
579+
"context": "$URI{default.gpr}",
580580
"where": {
581581
"textDocument": {
582582
"uri": "$URI{main.adb}"
@@ -598,7 +598,7 @@
598598
"title": "",
599599
"command": "als-refactor-move-parameter",
600600
"arguments": [{
601-
"context": "Default",
601+
"context": "$URI{default.gpr}",
602602
"where": {
603603
"textDocument": {
604604
"uri": "$URI{main.adb}"
@@ -627,7 +627,7 @@
627627
"params": {
628628
"command": "als-refactor-move-parameter",
629629
"arguments": [{
630-
"context": "Default",
630+
"context": "$URI{default.gpr}",
631631
"where": {
632632
"textDocument": {
633633
"uri": "$URI{main.adb}"

testsuite/ada_lsp/S314-015.refactor_remove_parameter_0/test.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
"title": "",
291291
"command": "als-refactor-remove-parameters",
292292
"arguments": [{
293-
"context": "Default",
293+
"context": "$URI{default.gpr}",
294294
"where": {
295295
"textDocument": {
296296
"uri": "$URI{main.adb}"
@@ -320,7 +320,7 @@
320320
"command": "als-refactor-remove-parameters",
321321
"arguments": [
322322
{
323-
"context": "Default",
323+
"context": "$URI{default.gpr}",
324324
"where": {
325325
"textDocument": {
326326
"uri": "$URI{main.adb}"
@@ -508,7 +508,7 @@
508508
"title": "",
509509
"command": "als-refactor-remove-parameters",
510510
"arguments": [{
511-
"context": "Default",
511+
"context": "$URI{default.gpr}",
512512
"where": {
513513
"textDocument": {
514514
"uri": "$URI{main.adb}"
@@ -538,7 +538,7 @@
538538
"command": "als-refactor-remove-parameters",
539539
"arguments": [
540540
{
541-
"context": "Default",
541+
"context": "$URI{default.gpr}",
542542
"where": {
543543
"textDocument": {
544544
"uri": "$URI{main.adb}"
@@ -845,7 +845,7 @@
845845
"command": "als-refactor-remove-parameters",
846846
"arguments": [
847847
{
848-
"context": "Default",
848+
"context": "$URI{default.gpr}",
849849
"where": {
850850
"textDocument": {
851851
"uri": "$URI{main.adb}"
@@ -875,7 +875,7 @@
875875
"command": "als-refactor-remove-parameters",
876876
"arguments": [
877877
{
878-
"context": "Default",
878+
"context": "$URI{default.gpr}",
879879
"where": {
880880
"textDocument": {
881881
"uri": "$URI{main.adb}"

testsuite/ada_lsp/SC28-001.named.parameters.0/SC28-001.named.parameters.0.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
"command": "als-named-parameters",
195195
"arguments": [
196196
{
197-
"context": "Default",
197+
"context": "$URI{default.gpr}",
198198
"where": {
199199
"textDocument": {
200200
"uri": "$URI{main.adb}"
@@ -222,7 +222,7 @@
222222
"params": {
223223
"arguments": [
224224
{
225-
"context": "Default",
225+
"context": "$URI{default.gpr}",
226226
"where": {
227227
"textDocument": {
228228
"uri": "$URI{main.adb}"
@@ -282,7 +282,7 @@
282282
"params": {
283283
"arguments": [
284284
{
285-
"context": "Default",
285+
"context": "$URI{default.gpr}",
286286
"where": {
287287
"textDocument": {
288288
"uri": "$URI{main.adb}"
@@ -342,7 +342,7 @@
342342
"params": {
343343
"arguments": [
344344
{
345-
"context": "Default",
345+
"context": "$URI{default.gpr}",
346346
"where": {
347347
"textDocument": {
348348
"uri": "$URI{main.adb}"
@@ -402,7 +402,7 @@
402402
"params": {
403403
"arguments": [
404404
{
405-
"context": "Default",
405+
"context": "$URI{default.gpr}",
406406
"where": {
407407
"textDocument": {
408408
"uri": "$URI{main.adb}"
@@ -462,7 +462,7 @@
462462
"params": {
463463
"arguments": [
464464
{
465-
"context": "Default",
465+
"context": "$URI{default.gpr}",
466466
"where": {
467467
"textDocument": {
468468
"uri": "$URI{main.adb}"
@@ -522,7 +522,7 @@
522522
"params": {
523523
"arguments": [
524524
{
525-
"context": "Default",
525+
"context": "$URI{default.gpr}",
526526
"where": {
527527
"textDocument": {
528528
"uri": "$URI{main.adb}"
@@ -582,7 +582,7 @@
582582
"params": {
583583
"arguments": [
584584
{
585-
"context": "Default",
585+
"context": "$URI{default.gpr}",
586586
"where": {
587587
"textDocument": {
588588
"uri": "$URI{main.adb}"
@@ -642,7 +642,7 @@
642642
"params": {
643643
"arguments": [
644644
{
645-
"context": "Default",
645+
"context": "$URI{default.gpr}",
646646
"where": {
647647
"textDocument": {
648648
"uri": "$URI{main.adb}"

testsuite/ada_lsp/T318-086.suppress.separates.0/test.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
"command": "als-suppress-separate",
205205
"arguments": [
206206
{
207-
"context": "Default",
207+
"context": "$URI{default.gpr}",
208208
"where": {
209209
"textDocument": {
210210
"uri": "$URI{test.adb}"
@@ -233,7 +233,7 @@
233233
"command": "als-suppress-separate",
234234
"arguments": [
235235
{
236-
"context": "Default",
236+
"context": "$URI{default.gpr}",
237237
"where": {
238238
"textDocument": {
239239
"uri": "$URI{test.adb}"

testsuite/ada_lsp/TB12-017.named.parameters.0/TB12-017.named.parameters.0.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
"params": {
187187
"command": "als-named-parameters",
188188
"arguments": [{
189-
"context": "Default",
189+
"context": "$URI{default.gpr}",
190190
"where": {
191191
"textDocument": {
192192
"uri": "$URI{src/main.adb}"

testsuite/ada_lsp/TB12-017.named.parameters.1/TB12-017.named.parameters.1.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
"params": {
164164
"command": "als-named-parameters",
165165
"arguments": [{
166-
"context": "Default",
166+
"context": "$URI{default.gpr}",
167167
"where": {
168168
"textDocument": {
169169
"uri": "$URI{src/foo.ads}"

testsuite/ada_lsp/U416-030.refactor_change_parameter_mode_0/test.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
"command": "als-refactor-change-parameter-mode",
293293
"arguments": [
294294
{
295-
"context": "Default",
295+
"context": "$URI{default.gpr}",
296296
"where": {
297297
"textDocument": {
298298
"uri": "$URI{main.adb}"
@@ -316,7 +316,7 @@
316316
"command": "als-refactor-change-parameter-mode",
317317
"arguments": [
318318
{
319-
"context": "Default",
319+
"context": "$URI{default.gpr}",
320320
"where": {
321321
"textDocument": {
322322
"uri": "$URI{main.adb}"
@@ -340,7 +340,7 @@
340340
"command": "als-refactor-change-parameter-mode",
341341
"arguments": [
342342
{
343-
"context": "Default",
343+
"context": "$URI{default.gpr}",
344344
"where": {
345345
"textDocument": {
346346
"uri": "$URI{main.adb}"
@@ -371,7 +371,7 @@
371371
"command": "als-refactor-remove-parameters",
372372
"arguments": [
373373
{
374-
"context": "Default",
374+
"context": "$URI{default.gpr}",
375375
"where": {
376376
"textDocument": {
377377
"uri": "$URI{main.adb}"

testsuite/ada_lsp/U416-030.refactor_remove_parameter_0/test.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@
292292
"command": "als-refactor-remove-parameters",
293293
"arguments": [
294294
{
295-
"context": "Default",
295+
"context": "$URI{default.gpr}",
296296
"where": {
297297
"textDocument": {
298298
"uri": "$URI{main.adb}"
@@ -323,7 +323,7 @@
323323
"command": "als-refactor-change-parameter-mode",
324324
"arguments": [
325325
{
326-
"context": "Default",
326+
"context": "$URI{default.gpr}",
327327
"where": {
328328
"textDocument": {
329329
"uri": "$URI{main.adb}"

testsuite/ada_lsp/completion.invisible.insert_with_clause.child_package/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"command": "als-auto-import",
147147
"arguments": [
148148
{
149-
"context": "Default",
149+
"context": "$URI{default.gpr}",
150150
"where": {
151151
"textDocument": {
152152
"uri": "$URI{main.adb}"

testsuite/ada_lsp/completion.invisible.insert_with_clause.dotted_names/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"command": "als-auto-import",
149149
"arguments": [
150150
{
151-
"context": "Default",
151+
"context": "$URI{default.gpr}",
152152
"where": {
153153
"textDocument": {
154154
"uri": "$URI{main.adb}"

testsuite/ada_lsp/completion.invisible.insert_with_clause.invisible_unit/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"command": "als-auto-import",
147147
"arguments": [
148148
{
149-
"context": "Default",
149+
"context": "$URI{default.gpr}",
150150
"where": {
151151
"textDocument": {
152152
"uri": "$URI{main.adb}"

testsuite/ada_lsp/completion.invisible.insert_with_clause.renamed_units/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"command": {
137137
"arguments": [
138138
{
139-
"context": "Default",
139+
"context": "$URI{default.gpr}",
140140
"import": "Foo",
141141
"qualifier": "",
142142
"where": {

testsuite/ada_lsp/completion.invisible.insert_with_clause/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
"command": "als-auto-import",
147147
"arguments": [
148148
{
149-
"context": "Default",
149+
"context": "$URI{default.gpr}",
150150
"where": {
151151
"textDocument": {
152152
"uri": "$URI{main.adb}"

testsuite/ada_lsp/completion.invisible.runtime/test.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
"command": {
165165
"arguments": [
166166
{
167-
"context": "Default",
167+
"context": "$URI{default.gpr}",
168168
"import": "Ada.Text_IO",
169169
"qualifier": "",
170170
"where": {

testsuite/ada_lsp/completion.invisible.unit_filtering.dotted_parent/test.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"command": {
140140
"arguments": [
141141
{
142-
"context": "Default",
142+
"context": "$URI{default.gpr}",
143143
"import": "Foo",
144144
"qualifier": "",
145145
"where": {
@@ -168,7 +168,7 @@
168168
"command": {
169169
"arguments": [
170170
{
171-
"context": "Default",
171+
"context": "$URI{default.gpr}",
172172
"import": "Foo.Child",
173173
"qualifier": "",
174174
"where": {

0 commit comments

Comments
 (0)