diff --git a/source/gpr/lsp-gpr_completions.adb b/source/gpr/lsp-gpr_completions.adb index 828bfe4c3..58f43d3f3 100644 --- a/source/gpr/lsp-gpr_completions.adb +++ b/source/gpr/lsp-gpr_completions.adb @@ -16,21 +16,20 @@ ------------------------------------------------------------------------------ with Ada.Characters.Conversions; -with Ada.Characters.Handling; - with GPR2.Project.Registry.Attribute; with GPR2.Project.Registry.Attribute.Description; with GPR2.Project.Registry.Pack; with GPR2.Project.Registry.Pack.Description; with Gpr_Parser.Common; -with Gpr_Parser_Support.Text; +with LSP.GPR_Files.References; with LSP.Structures.LSPAny_Vectors; with LSP.Text_Documents.Langkit_Documents; with VSS.String_Vectors; with VSS.Strings.Conversions; +with VSS.Transformers.Casing; package body LSP.GPR_Completions is @@ -43,34 +42,145 @@ package body LSP.GPR_Completions is package PRPD renames GPR2.Project.Registry.Pack.Description; package LKD renames LSP.Text_Documents.Langkit_Documents; + procedure Fill_Completion_Response + (File : LSP.GPR_Files.File_Access; + Doc : Boolean; + Response : in out LSP.Structures.Completion_Result; + Reference : LSP.GPR_Files.References.Reference; + Prefix : VSS.Strings.Virtual_String); + -- Handle completion for specified kind starting from File/Pack + procedure Fill_Attribute_Completion_Response - (File : LSP.GPR_Files.File; - Position : LSP.Structures.Position; - Doc : Boolean; - Filter : String; - Response : in out LSP.Structures.Completion_Result); - -- Handle completion when cursor after for keyword + (File : LSP.GPR_Files.File_Access; + Current_Package : Package_Id; + Doc : Boolean; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result); + -- Handle completion when cursor after "for" or "'" keyword procedure Fill_Package_Completion_Response - (File : LSP.GPR_Files.File; - Doc : Boolean; - Filter : String; + (File : LSP.GPR_Files.File_Access; + Doc : Boolean; + Prefix : VSS.Strings.Virtual_String; + Unexisting_Only : Boolean; + Response : in out LSP.Structures.Completion_Result); + -- Handle completion when cursor after "package" keyword or after a project + -- reference. + + procedure Fill_Type_Completion_Response + (File : LSP.GPR_Files.File_Access; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result); + -- Handle completion when cursor after ':' character + + procedure Fill_Variable_Completion_Response + (File : LSP.GPR_Files.File_Access; + Current_Package : Package_Id; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result); + -- Handle completion when cursor after a project/package reference. + + procedure Fill_Left_Part_Completion_Response + (File : LSP.GPR_Files.File_Access; + Current_Package : Package_Id; + Token_Kind : GPC.Token_Kind; + Doc : Boolean; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result); + -- Handle completion when cursor after "use", "renames", "extends", ":=", + -- '(', ',', '&' tokens. + + procedure Add_Item + (Name : VSS.Strings.Virtual_String; + Prefix : VSS.Strings.Virtual_String; Response : in out LSP.Structures.Completion_Result); - -- Handle completion when cursor after package keyword + -- Append 'Name' if it starts with 'Prefix' to 'Response' + + procedure Add_Items + (Items : VSS.String_Vectors.Virtual_String_Vector; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result); + -- Append 'Items' if element starts with 'Prefix' to 'Response' + + function To_Lower + (S : VSS.Strings.Virtual_String) return VSS.Strings.Virtual_String is + (S.Transform (VSS.Transformers.Casing.To_Lowercase)); + + -------------- + -- Add_Item -- + -------------- + + procedure Add_Item + (Name : VSS.Strings.Virtual_String; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result) is + Item : LSP.Structures.CompletionItem; + begin + if VSS.Strings.Starts_With (To_Lower (Name), Prefix) then + Item.label := Name; + Response.Variant_2.items.Append (Item); + end if; + end Add_Item; + + --------------- + -- Add_Items -- + --------------- + + procedure Add_Items + (Items : VSS.String_Vectors.Virtual_String_Vector; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result) is + begin + for Item of Items loop + Add_Item (Item, Prefix, Response); + end loop; + end Add_Items; + + ------------------------------ + -- Fill_Completion_Response -- + ------------------------------ + + procedure Fill_Completion_Response + (File : LSP.GPR_Files.File_Access; + Doc : Boolean; + Response : in out LSP.Structures.Completion_Result; + Reference : LSP.GPR_Files.References.Reference; + Prefix : VSS.Strings.Virtual_String) is + use LSP.GPR_Files.References; + + Referenced_File : constant LSP.GPR_Files.File_Access := + LSP.GPR_Files.References.Referenced_File + (File, Reference); + begin + if Is_Project_Reference (Reference) then + if In_Type_Reference (Reference) then + Fill_Type_Completion_Response (Referenced_File, Prefix, Response); + else + Fill_Variable_Completion_Response + (Referenced_File, GPR2.Project_Level_Scope, Prefix, Response); + Fill_Package_Completion_Response + (File => File, + Doc => Doc, + Prefix => Prefix, + Unexisting_Only => False, + Response => Response); + end if; + elsif Is_Package_Reference (Reference) then + Fill_Variable_Completion_Response + (Referenced_File, Referenced_Package (Reference), Prefix, Response); + end if; + end Fill_Completion_Response; ---------------------------------------- -- Fill_Attribute_Completion_Response -- ---------------------------------------- procedure Fill_Attribute_Completion_Response - (File : LSP.GPR_Files.File; - Position : LSP.Structures.Position; - Doc : Boolean; - Filter : String; - Response : in out LSP.Structures.Completion_Result) is - Starts : constant String := Ada.Characters.Handling.To_Lower (Filter); - Current_Package : constant Package_Id := - File.Get_Package (Position); + (File : LSP.GPR_Files.File_Access; + Current_Package : Package_Id; + Doc : Boolean; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result) is begin if Current_Package = Project_Level_Scope or else PRP.Is_Allowed_In (Current_Package, File.Kind) @@ -78,16 +188,13 @@ package body LSP.GPR_Completions is for Id of PRA.All_Attributes (Current_Package) loop declare Item : LSP.Structures.CompletionItem; - Attr : constant String := - Ada.Characters.Handling.To_Lower - (String (Name (Id.Attr))); begin if PRA.Get (Id).Is_Allowed_In (File.Kind) - and then - (Starts'Length = 0 - or else (Starts'Length <= Attr'Length - and then Filter = Attr - (Attr'First .. Attr'First + Starts'Length - 1))) + and then VSS.Strings.Starts_With + (To_Lower (VSS.Strings.To_Virtual_String + (Ada.Characters.Conversions.To_Wide_Wide_String + (String (Name (Id.Attr))))), + Prefix) then Item.label := VSS.Strings.Conversions.To_Virtual_String (Image (Id.Attr)); @@ -125,26 +232,24 @@ package body LSP.GPR_Completions is -------------------------------------- procedure Fill_Package_Completion_Response - (File : LSP.GPR_Files.File; - Doc : Boolean; - Filter : String; - Response : in out LSP.Structures.Completion_Result) is - Starts : constant String := Ada.Characters.Handling.To_Lower (Filter); + (File : LSP.GPR_Files.File_Access; + Doc : Boolean; + Prefix : VSS.Strings.Virtual_String; + Unexisting_Only : Boolean; + Response : in out LSP.Structures.Completion_Result) is Kind : constant Project_Kind := File.Kind; begin for Id of PRP.All_Packages loop declare Item : LSP.Structures.CompletionItem; - Pack : constant String := - Ada.Characters.Handling.To_Lower (String (Name (Id))); begin - if not File.In_Packages (Id) + if (not File.In_Packages (Id) or else not Unexisting_Only) and then PRP.Is_Allowed_In (Id, Kind) - and then - (Starts'Length = 0 - or else (Starts'Length <= Pack'Length - and then Filter = Pack - (Pack'First .. Pack'First + Starts'Length - 1))) + and then VSS.Strings.Starts_With + (To_Lower (VSS.Strings.To_Virtual_String + (Ada.Characters.Conversions.To_Wide_Wide_String + (String (Name (Id))))), + Prefix) then Item.label := VSS.Strings.Conversions.To_Virtual_String (Image (Id)); @@ -174,6 +279,97 @@ package body LSP.GPR_Completions is end loop; end Fill_Package_Completion_Response; + ----------------------------------- + -- Fill_Type_Completion_Response -- + ----------------------------------- + + procedure Fill_Type_Completion_Response + (File : LSP.GPR_Files.File_Access; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result) is + begin + Add_Items (File.Types, Prefix, Response); + Add_Items (File.Projects, Prefix, Response); + end Fill_Type_Completion_Response; + + --------------------------------------- + -- Fill_Variable_Completion_Response -- + --------------------------------------- + + procedure Fill_Variable_Completion_Response + (File : LSP.GPR_Files.File_Access; + Current_Package : Package_Id; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result) is + begin + Add_Items (File.Variables (Current_Package), Prefix, Response); + end Fill_Variable_Completion_Response; + + ---------------------------------------- + -- Fill_Left_Part_Completion_Response -- + ---------------------------------------- + + procedure Fill_Left_Part_Completion_Response + (File : LSP.GPR_Files.File_Access; + Current_Package : Package_Id; + Token_Kind : GPC.Token_Kind; + Doc : Boolean; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result) is + + procedure Fill_Project_Completion_Response + (File : LSP.GPR_Files.File_Access; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result); + -- Add project identifiers to Response. + + -------------------------------------- + -- Fill_Project_Completion_Response -- + -------------------------------------- + + procedure Fill_Project_Completion_Response + (File : LSP.GPR_Files.File_Access; + Prefix : VSS.Strings.Virtual_String; + Response : in out LSP.Structures.Completion_Result) is + begin + Add_Item ("project", Prefix, Response); + Add_Item (File.Name, Prefix, Response); + Add_Items (File.Projects, Prefix, Response); + end Fill_Project_Completion_Response; + + begin + if not (Token_Kind in GPC.Gpr_Renames | GPC.Gpr_Extends) then + -- Add current_package's variables + + Fill_Variable_Completion_Response + (File, Current_Package, Prefix, Response); + + -- Add project level's variable if not yet done + + if Current_Package /= GPR2.Project_Level_Scope then + Fill_Variable_Completion_Response + (File, GPR2.Project_Level_Scope, Prefix, Response); + end if; + + -- Add packages + + Fill_Package_Completion_Response + (File => File, + Doc => Doc, + Prefix => Prefix, + Unexisting_Only => False, + Response => Response); + end if; + + -- Add projects + + Fill_Project_Completion_Response + (File => File, + Prefix => Prefix, + Response => Response); + + end Fill_Left_Part_Completion_Response; + ------------------------------ -- Fill_Completion_Response -- ------------------------------ @@ -202,81 +398,157 @@ package body LSP.GPR_Completions is In_Comment : constant Boolean := LSP.GPR_Files.Position_Is_In_Comment (Current, Location); - Previous : constant GPC.Token_Reference := Current.Previous (True); - - function To_String - (Text : Gpr_Parser_Support.Text.Text_Type) return String is - (Ada.Characters.Handling.To_Lower - (Ada.Characters.Conversions.To_String (Text))); + Previous : GPC.Token_Reference := Current.Previous (True); use type GPC.Token_Reference, GPC.Token_Kind; + procedure Fill_Tick_Completion + (Tick_Token : GPC.Token_Reference; + Prefix : VSS.Strings.Virtual_String); + + procedure Fill_Dot_Completion + (Dot_Token : GPC.Token_Reference; + Prefix : VSS.Strings.Virtual_String); + + ------------------------- + -- Fill_Dot_Completion -- + ------------------------- + + procedure Fill_Dot_Completion + (Dot_Token : GPC.Token_Reference; + Prefix : VSS.Strings.Virtual_String) + is + Reference : constant LSP.GPR_Files.References.Reference + := LSP.GPR_Files.References.Identifier_Reference + (File => File, + Current_Package => File.Get_Package + (Value.position), + Token => Dot_Token.Previous (True)); + + use type GPR_Files.References.Reference; + begin + + if Reference /= GPR_Files.References.No_Reference then + Fill_Completion_Response + (File => File, + Doc => Compute_Doc_And_Details, + Prefix => Prefix, + Reference => Reference, + Response => Response); + end if; + end Fill_Dot_Completion; + + -------------------------- + -- Fill_Tick_Completion -- + -------------------------- + + procedure Fill_Tick_Completion + (Tick_Token : GPC.Token_Reference; + Prefix : VSS.Strings.Virtual_String) + is + Last_Identifier : constant GPC.Token_Reference := + Tick_Token.Previous (True); + Reference : constant LSP.GPR_Files.References.Reference + := LSP.GPR_Files.References.Identifier_Reference + (File => File, + Current_Package => File.Get_Package + (Value.position), + Token => Last_Identifier); + + use type GPR_Files.References.Reference; + begin + + if Reference /= GPR_Files.References.No_Reference then + Fill_Attribute_Completion_Response + (File => File, + Current_Package => + GPR_Files.References.Referenced_Package + (Reference), + Doc => Compute_Doc_And_Details, + Prefix => Prefix, + Response => Response); + end if; + end Fill_Tick_Completion; + begin - if not In_Comment then - if Current.Data.Kind in - GPC.Gpr_Whitespace | GPC.Gpr_Comment | GPC.Gpr_Termination - and then Previous /= GPC.No_Token - then - if Previous.Data.Kind in GPC.Gpr_For | GPC.Gpr_Package then - if not LSP.GPR_Files.At_End (Previous.Data.Sloc_Range, Location) - then - case Previous.Data.Kind is - - when GPC.Gpr_For => - Fill_Attribute_Completion_Response - (File => File.all, - Position => Value.position, - Doc => Compute_Doc_And_Details, - Filter => "", - Response => Response); - - when GPC.Gpr_Package => - Fill_Package_Completion_Response - (File => File.all, - Doc => Compute_Doc_And_Details, - Filter => "", - Response => Response); - - when others => - null; - - end case; - end if; + if not In_Comment + and then Previous /= GPC.No_Token + and then Current.Data.Kind /= GPC.Gpr_Identifier + then + declare + Identifier_Prefix : constant VSS.Strings.Virtual_String := + (if Previous.Data.Kind = GPC.Gpr_Identifier + and then LSP.GPR_Files.At_End + (Previous.Data.Sloc_Range, Location) + then To_Lower + (VSS.Strings.To_Virtual_String + (Previous.Text)) + else ""); + begin + if not VSS.Strings.Is_Empty (Identifier_Prefix) then + Previous := Previous.Previous (True); + end if; - elsif Previous.Data.Kind = GPC.Gpr_Identifier + if Previous.Data.Kind in + GPC.Gpr_For | GPC.Gpr_Package | GPC.Gpr_Extends + | GPC.Gpr_Renames | GPC.Gpr_Use and then LSP.GPR_Files.At_End (Previous.Data.Sloc_Range, Location) then - declare - Before_Identifier : constant GPC.Token_Reference := - Previous.Previous (True); - begin - if Before_Identifier /= GPC.No_Token then - case Before_Identifier.Data.Kind is - - when GPC.Gpr_For => - Fill_Attribute_Completion_Response - (File => File.all, - Position => Value.position, - Doc => Compute_Doc_And_Details, - Filter => To_String (Previous.Text), - Response => Response); - - when GPC.Gpr_Package => - Fill_Package_Completion_Response - (File => File.all, - Doc => Compute_Doc_And_Details, - Filter => To_String (Previous.Text), - Response => Response); - - when others => - null; - - end case; - end if; - end; + -- missing space after 'package', 'renames', 'extends', 'for', + -- 'use' keyword to allow completion + return; end if; - end if; + case Previous.Data.Kind is + + when GPC.Gpr_For => + Fill_Attribute_Completion_Response + (File => File, + Current_Package => File.Get_Package (Value.position), + Doc => Compute_Doc_And_Details, + Prefix => Identifier_Prefix, + Response => Response); + + when GPC.Gpr_Package => + Fill_Package_Completion_Response + (File => File, + Doc => Compute_Doc_And_Details, + Prefix => Identifier_Prefix, + Unexisting_Only => True, + Response => Response); + + when GPC.Gpr_Colon => + Fill_Type_Completion_Response + (File => File, + Prefix => Identifier_Prefix, + Response => Response); + + when GPC.Gpr_Dot => + Fill_Dot_Completion (Previous, Identifier_Prefix); + + when GPC.Gpr_Tick => + Fill_Tick_Completion (Previous, Identifier_Prefix); + + when GPC.Gpr_Assign + | GPC.Gpr_Par_Open + | GPC.Gpr_Comma + | GPC.Gpr_Amp + | GPC.Gpr_Use + | GPC.Gpr_Renames + | GPC.Gpr_Extends => + Fill_Left_Part_Completion_Response + (File => File, + Current_Package => File.Get_Package (Value.position), + Token_Kind => Previous.Data.Kind, + Doc => Compute_Doc_And_Details, + Prefix => Identifier_Prefix, + Response => Response); + + when others => + null; + + end case; + end; end if; end Fill_Completion_Response; diff --git a/source/gpr/lsp-gpr_files-references.adb b/source/gpr/lsp-gpr_files-references.adb index b6a459f48..e456179e0 100644 --- a/source/gpr/lsp-gpr_files-references.adb +++ b/source/gpr/lsp-gpr_files-references.adb @@ -23,7 +23,6 @@ with LSP.Text_Documents.Langkit_Documents; package body LSP.GPR_Files.References is - package GPC renames Gpr_Parser.Common; use type GPC.Token_Kind; package Identifier_Vectors is new @@ -31,42 +30,6 @@ package body LSP.GPR_Files.References is (Index_Type => Natural, Element_Type => GPC.Token_Reference); - type Ref_Kind is - (No_Ref, Project_Ref, Type_Ref, Variable_Ref, Attribute_Ref, Package_Ref); - - type Reference (Kind : Ref_Kind := No_Ref) is record - Token : Gpr_Parser.Common.Token_Reference := GPC.No_Token; - case Kind is - when No_Ref => - null; - when others => - Project : Project_Id := No_Project; - case Kind is - when Project_Ref => - null; - when Type_Ref => - Typ : Type_Id := No_Type; - when others => - Pack : GPR2.Package_Id := GPR2.Project_Level_Scope; - case Kind is - when Variable_Ref => - Variable : Variable_Id := No_Variable; - when Attribute_Ref => - Attribute : GPR2.Optional_Attribute_Id := - GPR2.No_Attribute; - Index : Index_Type := No_Index; - when Package_Ref => - null; - when others => - null; - end case; - end case; - end case; - end record; - - No_Reference : constant Reference := (Kind => No_Ref, Token => GPC.No_Token); - -- No reference found - Project_Identifier_Id : constant Project_Id := +"project"; -- Identifier used to reference attributes, types, variables & packages -- of the project itself. @@ -85,14 +48,6 @@ package body LSP.GPR_Files.References is (Ref : Reference) return Gpr_Parser.Common.Token_Reference; -- Token_Reference adapter. - function Identifier_Reference - (File : LSP.GPR_Files.File_Access; - Current_Package : GPR2.Package_Id; - Location : Gpr_Parser.Slocs.Source_Location) - return Reference; - -- return the Project, Type, Variable, Attribute, Package reference - -- found at 'Location'. 'Current_Package' useful for package's variable. - -------------------- -- Previous_Token -- -------------------- @@ -152,7 +107,7 @@ package body LSP.GPR_Files.References is function Identifier_Reference (File : LSP.GPR_Files.File_Access; Current_Package : GPR2.Package_Id; - Location : Gpr_Parser.Slocs.Source_Location) + Token : Gpr_Parser.Common.Token_Reference) return Reference is Project_Provided : Boolean := False; @@ -173,13 +128,16 @@ package body LSP.GPR_Files.References is Tick_Found : Boolean := False; -- True if "'" is at the left of position + In_Type_Reference : Boolean := False; + -- True if ":" is at the left of reference + Previous_Token_Kind : GPC.Token_Kind; -- token kind just before 'Location' Next_Token_Kind : GPC.Token_Kind; -- token kind just after 'Location' - procedure Initialize; + procedure Initialize (Last_Token : GPC.Token_Reference); -- Initialize 'Identifiers' & 'Tick_Found' procedure Remove_Project; @@ -193,9 +151,8 @@ package body LSP.GPR_Files.References is -- Initialize -- ---------------- - procedure Initialize is - Token : GPC.Token_Reference := - LSP.GPR_Files.Token (File.all, Location); + procedure Initialize (Last_Token : GPC.Token_Reference) is + Token : GPC.Token_Reference := Last_Token; First : Boolean := True; begin Previous_Token_Kind := @@ -220,11 +177,18 @@ package body LSP.GPR_Files.References is -- An identifier followed by an identifier is not allowed. Identifiers.Clear; + return; + elsif Token.Data.Kind = GPC.Gpr_Colon then + -- Let 'Initialize' return a type reference + + In_Type_Reference := True; + return; elsif Token.Data.Kind /= GPC.Gpr_Dot then -- Let 'Initialize' return a possible reference. return; + end if; -- Loop on previous token @@ -262,6 +226,13 @@ package body LSP.GPR_Files.References is (File.File_Provider, File.Name_To_File_Map.Element (Project)); return; + elsif File.Extended = Project then + Identifiers.Delete_First; + Project_Provided := True; + Referenced_Project := LSP.GPR_Files.Parse + (File.File_Provider, + File.Extended_Path); + return; end if; Referenced_Project := File; end Remove_Project; @@ -286,7 +257,13 @@ package body LSP.GPR_Files.References is use type Ada.Containers.Count_Type; begin - Initialize; + if Token = GPC.No_Token + or else Token.Data.Kind /= GPC.Gpr_Identifier + then + return No_Reference; + end if; + + Initialize (Token); if Identifiers.Length > 0 then Remove_Project; @@ -294,9 +271,10 @@ package body LSP.GPR_Files.References is if Identifiers.Length = 0 then if Project_Provided then - return (Kind => Project_Ref, - Token => Referenced_Project.Name_Token, - Project => Referenced_Project.Name); + return (Kind => Project_Ref, + Token => Referenced_Project.Name_Token, + Project => Referenced_Project.Name, + In_Type_Reference => In_Type_Reference); end if; return No_Reference; end if; @@ -315,10 +293,11 @@ package body LSP.GPR_Files.References is begin if LSP.GPR_Files.Package_Maps.Has_Element (P) then D := LSP.GPR_Files.Package_Maps.Element (P); - return (Kind => Package_Ref, - Token => D.First, + return (Kind => Package_Ref, + Token => D.First, Project => Referenced_Project.Name, - Pack => Referenced_Package); + In_Type_Reference => False, + Pack => Referenced_Package); end if; end; end if; @@ -350,13 +329,15 @@ package body LSP.GPR_Files.References is C := M.First; if LSP.GPR_Files.Attribute_Index_Maps.Has_Element (C) then - return (Kind => Attribute_Ref, - Token => LSP.GPR_Files. + return (Kind => Attribute_Ref, + Token => LSP.GPR_Files. Attribute_Index_Maps.Element (C).Token, - Project => Referenced_Project.Name, - Pack => Referenced_Package, - Attribute => Attribute, - Index => No_Index); + Project => + Referenced_Project.Name, + Pack => Referenced_Package, + Attribute => Attribute, + Index => No_Index, + In_Type_Reference => False); end if; end if; end if; @@ -373,12 +354,14 @@ package body LSP.GPR_Files.References is M := LSP.GPR_Files.Attribute_Maps.Element (A); C := M.First; if C.Has_Element then - return (Kind => Attribute_Ref, - Token => C.Element.Token, - Project => Referenced_Project.Name, - Pack => Referenced_Package, - Attribute => Attribute, - Index => No_Index); + return (Kind => Attribute_Ref, + Token => C.Element.Token, + Project => + Referenced_Project.Name, + Pack => Referenced_Package, + Attribute => Attribute, + Index => No_Index, + In_Type_Reference => False); end if; end if; end; @@ -398,11 +381,13 @@ package body LSP.GPR_Files.References is Referenced_Project.Types.Find (Typ); begin if LSP.GPR_Files.Type_Maps.Has_Element (C) then - return (Kind => Type_Ref, - Token => + return (Kind => Type_Ref, + Token => LSP.GPR_Files.Type_Maps.Element (C).Token, - Project => Referenced_Project.Name, - Typ => Typ); + Project => + Referenced_Project.Name, + In_Type_Reference => In_Type_Reference, + Typ => Typ); end if; end; end if; @@ -426,13 +411,15 @@ package body LSP.GPR_Files.References is if LSP.GPR_Files.Variable_Maps. Has_Element (V) then - return (Kind => Variable_Ref, - Token => + return (Kind => Variable_Ref, + Token => LSP.GPR_Files.Variable_Maps. Element (V).Token, - Project => Referenced_Project.Name, - Pack => Current_Package, - Variable => Variable); + Project => + Referenced_Project.Name, + Pack => Current_Package, + Variable => Variable, + In_Type_Reference => False); end if; end if; end; @@ -443,13 +430,16 @@ package body LSP.GPR_Files.References is Variables.Find (Variable); begin if LSP.GPR_Files.Variable_Maps.Has_Element (V) then - return (Kind => Variable_Ref, - Token => + return (Kind => Variable_Ref, + Token => LSP.GPR_Files.Variable_Maps. Element (V).Token, - Project => Referenced_Project.Name, - Pack => GPR2.Project_Level_Scope, - Variable => Variable); + Project => + Referenced_Project.Name, + Pack => + GPR2.Project_Level_Scope, + Variable => Variable, + In_Type_Reference => False); end if; end; elsif Referenced_Package /= GPR2.Project_Level_Scope then @@ -466,13 +456,15 @@ package body LSP.GPR_Files.References is if LSP.GPR_Files.Variable_Maps. Has_Element (V) then - return (Kind => Variable_Ref, - Token => + return (Kind => Variable_Ref, + Token => LSP.GPR_Files.Variable_Maps. Element (V).Token, - Project => Referenced_Project.Name, - Pack => Referenced_Package, - Variable => Variable); + Project => + Referenced_Project.Name, + Pack => Referenced_Package, + Variable => Variable, + In_Type_Reference => False); end if; end if; end; @@ -483,13 +475,16 @@ package body LSP.GPR_Files.References is Variables.Find (Variable); begin if LSP.GPR_Files.Variable_Maps.Has_Element (V) then - return (Kind => Variable_Ref, - Token => + return (Kind => Variable_Ref, + Token => LSP.GPR_Files.Variable_Maps. Element (V).Token, - Project => Referenced_Project.Name, - Pack => GPR2.Project_Level_Scope, - Variable => Variable); + Project => + Referenced_Project.Name, + Pack => + GPR2.Project_Level_Scope, + Variable => Variable, + In_Type_Reference => False); end if; end; end if; @@ -636,7 +631,7 @@ package body LSP.GPR_Files.References is when GPC.Gpr_Identifier => return Token_Reference (Identifier_Reference - (File, File.Get_Package (Position), Location)); + (File, File.Get_Package (Position), Token)); when GPC.Gpr_String => return String_Reference; when others => @@ -646,4 +641,76 @@ package body LSP.GPR_Files.References is return GPC.No_Token; end Token_Reference; + ---------- + -- Kind -- + ---------- + + function Kind (Ref : Reference) return Ref_Kind is + begin + return Ref.Kind; + end Kind; + + --------------------- + -- Referenced_File -- + --------------------- + + function Referenced_File + (File : LSP.GPR_Files.File_Access; + Reference : LSP.GPR_Files.References.Reference) + return LSP.GPR_Files.File_Access is + begin + if Reference.Kind /= No_Ref then + declare + Cursor : constant Name_To_File_Maps.Cursor := + File.Name_To_File_Map.Find (Reference.Project); + Path : GPR2.Path_Name.Object; + begin + if Cursor.Has_Element then + Path := Cursor.Element; + if Path.Exists then + return File.File_Provider.Get_Parsed_File (Path); + end if; + end if; + end; + end if; + return File; + end Referenced_File; + + ------------------------ + -- Referenced_Package -- + ------------------------ + + function Referenced_Package + (Reference : LSP.GPR_Files.References.Reference) + return GPR2.Package_Id is + begin + if Has_Package (Reference) then + return Reference.Pack; + else + return GPR2.Project_Level_Scope; + end if; + end Referenced_Package; + + function Get_Referenced_File + (File : LSP.GPR_Files.File_Access; + Reference : LSP.GPR_Files.References.Reference) + return LSP.GPR_Files.File_Access is + begin + if Reference /= No_Reference then + declare + Cursor : constant LSP.GPR_Files.Name_To_File_Maps.Cursor + := File.Name_To_File_Map.Find (Reference.Project); + Path : constant GPR2.Path_Name.Object := + (if Cursor.Has_Element + then Cursor.Element + else GPR2.Path_Name.Undefined); + begin + if Path.Is_Defined and then Path.Exists then + return File.File_Provider.Get_Parsed_File (Path); + end if; + end; + end if; + return File; + end Get_Referenced_File; + end LSP.GPR_Files.References; diff --git a/source/gpr/lsp-gpr_files-references.ads b/source/gpr/lsp-gpr_files-references.ads index 3c78e2a8f..80bfc95d5 100644 --- a/source/gpr/lsp-gpr_files-references.ads +++ b/source/gpr/lsp-gpr_files-references.ads @@ -17,11 +17,139 @@ -- -- This package provides GPR references API. +with Gpr_Parser.Common; + package LSP.GPR_Files.References is + type Reference is private; + + type Ref_Kind is + (No_Ref, Project_Ref, Type_Ref, Variable_Ref, Attribute_Ref, Package_Ref); + + function Kind (Ref : Reference) return Ref_Kind; + function Token_Reference (File : LSP.GPR_Files.File_Access; Position : LSP.Structures.Position) return Gpr_Parser.Common.Token_Reference; + function Identifier_Reference + (File : LSP.GPR_Files.File_Access; + Current_Package : GPR2.Package_Id; + Token : Gpr_Parser.Common.Token_Reference) + return Reference; + -- return the Project, Type, Variable, Attribute, Package reference + -- found at 'Location'. 'Current_Package' useful for package's variable. + + function Referenced_File + (File : LSP.GPR_Files.File_Access; + Reference : LSP.GPR_Files.References.Reference) + return LSP.GPR_Files.File_Access; + + function Referenced_Package + (Reference : LSP.GPR_Files.References.Reference) + return GPR2.Package_Id; + + function Has_Project + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + function Is_Project_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + function Has_Package + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + function Is_Package_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + function Is_Type_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + function Is_Variable_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + function Is_Attribute_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + function In_Type_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean; + + No_Reference : constant Reference; + -- No reference found + + function Get_Referenced_File + (File : LSP.GPR_Files.File_Access; + Reference : LSP.GPR_Files.References.Reference) + return LSP.GPR_Files.File_Access; + +private + + package GPC renames Gpr_Parser.Common; + + type Reference (Kind : Ref_Kind := No_Ref) is record + Token : Gpr_Parser.Common.Token_Reference := GPC.No_Token; + case Kind is + when No_Ref => + null; + when others => + Project : Project_Id := No_Project; + In_Type_Reference : Boolean := False; + case Kind is + when Project_Ref => + null; + when Type_Ref => + Typ : Type_Id := No_Type; + when others => + Pack : GPR2.Package_Id := GPR2.Project_Level_Scope; + case Kind is + when Variable_Ref => + Variable : Variable_Id := No_Variable; + when Attribute_Ref => + Attribute : GPR2.Optional_Attribute_Id := + GPR2.No_Attribute; + Index : Index_Type := No_Index; + when others => + null; + end case; + end case; + end case; + end record; + + No_Reference : constant Reference := (Kind => No_Ref, Token => GPC.No_Token); + -- No reference found + + function Has_Project + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (Reference.Kind /= No_Ref); + + function Is_Project_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (Reference.Kind = Project_Ref); + + function Has_Package + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (Reference.Kind not in No_Ref | Project_Ref | Type_Ref); + + function Is_Package_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (Reference.Kind = Package_Ref); + + function Is_Type_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (Reference.Kind = Type_Ref); + + function Is_Variable_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (Reference.Kind = Variable_Ref); + + function Is_Attribute_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (Reference.Kind = Attribute_Ref); + + function In_Type_Reference + (Reference : LSP.GPR_Files.References.Reference) return Boolean is + (if Reference.Kind in Project_Ref | Type_Ref | Package_Ref + then Reference.In_Type_Reference + else False); + end LSP.GPR_Files.References; diff --git a/source/gpr/lsp-gpr_files.adb b/source/gpr/lsp-gpr_files.adb index ce730febb..d7b88a5b2 100644 --- a/source/gpr/lsp-gpr_files.adb +++ b/source/gpr/lsp-gpr_files.adb @@ -1290,6 +1290,10 @@ package body LSP.GPR_Files is begin File.Token_To_File_Map.Insert (Extended_Index, Extended_Path); Extended := Parse (File.File_Provider, Extended_Path); + if not File.Name_To_File_Map.Contains (Extended.Name) + then + File.Name_To_File_Map.Insert (Extended.Name, Extended_Path); + end if; File.Extended := Extended.Name; File.Extended_All := Extends_All; File.Extended_Path := Extended_Path; @@ -1495,4 +1499,99 @@ package body LSP.GPR_Files is return Path_Name.Undefined; end Get_Referenced_GPR; + ----------- + -- Types -- + ----------- + + function Types + (Self : LSP.GPR_Files.File) + return VSS.String_Vectors.Virtual_String_Vector + is + Types : VSS.String_Vectors.Virtual_String_Vector; + + procedure Handle_Element (Position : Type_Maps.Cursor); + + -------------------- + -- Handle_Element -- + -------------------- + + procedure Handle_Element (Position : Type_Maps.Cursor) is + begin + Types.Append (Image (Type_Maps.Key (Position))); + end Handle_Element; + + begin + Self.Types.Iterate (Handle_Element'Access); + return Types; + end Types; + + --------------- + -- Variables -- + --------------- + + function Variables + (Self : LSP.GPR_Files.File; + Pack : GPR2.Package_Id) + return VSS.String_Vectors.Virtual_String_Vector is + Vars : VSS.String_Vectors.Virtual_String_Vector; + + procedure Handle_Element (Position : Variable_Maps.Cursor); + + -------------------- + -- Handle_Element -- + -------------------- + + procedure Handle_Element (Position : Variable_Maps.Cursor) is + begin + Vars.Append (Image (Variable_Maps.Key (Position))); + end Handle_Element; + + begin + + if Pack = GPR2.Project_Level_Scope then + Self.Project_Level_Scope_Defs.Variables.Iterate + (Handle_Element'Access); + else + declare + Cursor : constant LSP.GPR_Files.Package_Maps.Cursor := + Self.Packages.Find (Pack); + begin + if LSP.GPR_Files.Package_Maps.Has_Element (Cursor) then + LSP.GPR_Files.Package_Maps.Element (Cursor).Variables.Iterate + (Handle_Element'Access); + end if; + end; + end if; + return Vars; + end Variables; + + ------------- + -- Projects-- + ------------- + + function Projects + (Self : LSP.GPR_Files.File) + return VSS.String_Vectors.Virtual_String_Vector + is + Projects : VSS.String_Vectors.Virtual_String_Vector; + + procedure Handle_Element (Position : Project_Id_List.Cursor); + + -------------------- + -- Handle_Element -- + -------------------- + + procedure Handle_Element (Position : Project_Id_List.Cursor) is + begin + Projects.Append (Image (Project_Id_List.Element (Position))); + end Handle_Element; + + begin + Self.Imported.Iterate (Handle_Element'Access); + if Self.Extended /= No_Project then + Projects.Append (Image (Self.Extended)); + end if; + return Projects; + end Projects; + end LSP.GPR_Files; diff --git a/source/gpr/lsp-gpr_files.ads b/source/gpr/lsp-gpr_files.ads index 8c061a219..d1c343078 100644 --- a/source/gpr/lsp-gpr_files.ads +++ b/source/gpr/lsp-gpr_files.ads @@ -225,6 +225,27 @@ package LSP.GPR_Files is Token : Gpr_Parser.Common.Token_Reference) return Path_Name.Object; -- find file pointed by gpr token useful for imported & extended files + function Name + (Self : LSP.GPR_Files.File) + return VSS.Strings.Virtual_String; + -- Self file' name + + function Types + (Self : LSP.GPR_Files.File) + return VSS.String_Vectors.Virtual_String_Vector; + -- Self file's types. + + function Variables + (Self : LSP.GPR_Files.File; + Pack : GPR2.Package_Id) + return VSS.String_Vectors.Virtual_String_Vector; + -- Self file's package types. + + function Projects + (Self : LSP.GPR_Files.File) + return VSS.String_Vectors.Virtual_String_Vector; + -- Self file's non limited imported projects & extended projects. + private type Source_Position is record @@ -675,4 +696,8 @@ private return Gpr_Parser.Common.Token_Reference is (Self.Unit.Lookup_Token (Location)); + function Name + (Self : LSP.GPR_Files.File) + return VSS.Strings.Virtual_String is (Image (Self.Name)); + end LSP.GPR_Files; diff --git a/testsuite/gpr_lsp/completion_references/extended.gpr b/testsuite/gpr_lsp/completion_references/extended.gpr new file mode 100644 index 000000000..5a51b7ec9 --- /dev/null +++ b/testsuite/gpr_lsp/completion_references/extended.gpr @@ -0,0 +1,9 @@ +project Extended is + type Extended_Type is ("a"); + Extended_Variable := ""; + for Warning_Message use "warning message"; + package Emulator is + Extended_Emulator_Variable := ""; + for Board use ""; + end Emulator; +end Extended; diff --git a/testsuite/gpr_lsp/completion_references/imported.gpr b/testsuite/gpr_lsp/completion_references/imported.gpr new file mode 100644 index 000000000..8f9e9b7c7 --- /dev/null +++ b/testsuite/gpr_lsp/completion_references/imported.gpr @@ -0,0 +1,9 @@ +project Imported is + type Imported_Type is ("a"); + Imported_Variable := ""; + for Warning_Message use "warning message"; + package Compiler is + Imported_Compiler_Variable := ""; + for Local_Configuration_Pragmas use ""; + end Compiler; +end Imported; \ No newline at end of file diff --git a/testsuite/gpr_lsp/completion_references/imported_limited.gpr b/testsuite/gpr_lsp/completion_references/imported_limited.gpr new file mode 100644 index 000000000..5bdef41b7 --- /dev/null +++ b/testsuite/gpr_lsp/completion_references/imported_limited.gpr @@ -0,0 +1,9 @@ +project Imported_Limited is + type Imported_Limited_Type is ("a"); + Imported_Limited_Variable := ""; + for Warning_Message use "warning message"; + package Compiler is + Imported_Limited_Compiler_Variable := ""; + for Local_Configuration_Pragmas use ""; + end Compiler; +end Imported_Limited; \ No newline at end of file diff --git a/testsuite/gpr_lsp/completion_references/prj.gpr b/testsuite/gpr_lsp/completion_references/prj.gpr new file mode 100644 index 000000000..4f55fd327 --- /dev/null +++ b/testsuite/gpr_lsp/completion_references/prj.gpr @@ -0,0 +1,68 @@ +with "imported"; +limited with "imported_limited"; +project Prj extends "extended" is + + type T1 is ("a"); + + package Compiler is + V1 := ""; + for Local_Configuration_Pragmas use ""; + end Compiler; + + V2 := + Imported. + Compiler. + Imported_Compiler_Variable; + + V3 := project' + Name; + + V4 := Extended.Emulator' + Board; + + for Object_Dir use + Prj.Compiler' + Local_Configuration_Pragmas; + + for Source_Dirs use ( + "."); + + for Source_Dirs use ("." & + "."); + + for Source_Dirs use (".", + ".."); + + V5 : + Imported. + Imported_Type := "a"; + + V5 : + Extended. + Extended_Type := "a"; + + V5 : +E ; + + V5 := +I; + + for Object_Dir use +P ; + + V5 := ( +E ); + + V5 := V5 & +I ; + + V5 := ("", +P ); + + V5 := project' +N ; + + V5 := Extended. +E ; + +end Prj; \ No newline at end of file diff --git a/testsuite/gpr_lsp/completion_references/test.json b/testsuite/gpr_lsp/completion_references/test.json new file mode 100644 index 000000000..435211a0a --- /dev/null +++ b/testsuite/gpr_lsp/completion_references/test.json @@ -0,0 +1,2720 @@ +[ + { + "comment": [ + "references completion" + ] + }, + { + "start": { + "cmd": [ + "${ALS}", + "--language-gpr" + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 0, + "method": "initialize", + "params": { + "processId": 2243210, + "clientInfo": { + "name": "Visual Studio Code", + "version": "1.63.2" + }, + "rootUri": "$URI{.}", + "capabilities": { + "workspace": { + "applyEdit": true, + "workspaceEdit": { + "documentChanges": true, + "resourceOperations": [ + "create", + "rename", + "delete" + ], + "normalizesLineEndings": true + }, + "didChangeConfiguration": {}, + "didChangeWatchedFiles": {}, + "symbol": {}, + "executeCommand": {}, + "configuration": true, + "workspaceFolders": true, + "fileOperations": { + "dynamicRegistration": true, + "didCreate": true, + "didRename": true, + "didDelete": true, + "willCreate": true, + "willRename": true, + "willDelete": true + } + }, + "textDocument": { + "publishDiagnostics": {}, + "synchronization": {}, + "completion": { + "contextSupport": true, + "completionItem": { + "snippetSupport": true, + "commitCharactersSupport": true, + "documentationFormat": [ + "markdown", + "plaintext" + ], + "deprecatedSupport": true, + "preselectSupport": true, + "tagSupport": { + "valueSet": [ + 1 + ] + }, + "insertReplaceSupport": true, + "resolveSupport": { + "properties": [ + "documentation", + "detail", + "additionalTextEdits" + ] + }, + "insertTextModeSupport": { + "valueSet": [ + 1, + 2 + ] + } + }, + "completionItemKind": { + "valueSet": [ + 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 + ] + } + }, + "documentSymbol": {}, + "codeAction": {} + }, + "window": { + "workDoneProgress": true + } + } + } + }, + "wait": [ + { + "id": 0, + "result": { + "capabilities": { + "textDocumentSync": { + "openClose": true, + "change": 1 + }, + "completionProvider": { + "triggerCharacters": [ + " " + ], + "resolveProvider": true + }, + "hoverProvider": true, + "documentSymbolProvider": {} + } + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "method": "initialized", + "params": {} + }, + "wait": [] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "method": "workspace/didChangeConfiguration", + "params": { + "settings": { + "ada": { + "scenarioVariables": {}, + "enableDiagnostics": false, + "defaultCharset": "ISO-8859-1" + } + } + } + }, + "wait": [] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 12, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 12, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 12, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "V2" + }, + { + "label": "V3" + }, + { + "label": "V4" + }, + { + "label": "V5" + }, + { + "label": "Binder", + "data": [ + "Binder" + ] + }, + { + "label": "Builder", + "data": [ + "Builder" + ] + }, + { + "label": "Clean", + "data": [ + "Clean" + ] + }, + { + "label": "Compiler", + "data": [ + "Compiler" + ] + }, + { + "label": "Gnatls", + "data": [ + "Gnatls" + ] + }, + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Linker", + "data": [ + "Linker" + ] + }, + { + "label": "Naming", + "data": [ + "Naming" + ] + }, + { + "label": "Remote", + "data": [ + "Remote" + ] + }, + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Ant", + "data": [ + "Ant" + ] + }, + { + "label": "Make", + "data": [ + "Make" + ] + }, + { + "label": "Analyzer", + "data": [ + "Analyzer" + ] + }, + { + "label": "Check", + "data": [ + "Check" + ] + }, + { + "label": "Codepeer", + "data": [ + "Codepeer" + ] + }, + { + "label": "Coverage", + "data": [ + "Coverage" + ] + }, + { + "label": "Dsa", + "data": [ + "Dsa" + ] + }, + { + "label": "Documentation", + "data": [ + "Documentation" + ] + }, + { + "label": "Emulator", + "data": [ + "Emulator" + ] + }, + { + "label": "Gnattest", + "data": [ + "Gnattest" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "Qgen", + "data": [ + "Qgen" + ] + }, + { + "label": "Stack", + "data": [ + "Stack" + ] + }, + { + "label": "Stub", + "data": [ + "Stub" + ] + }, + { + "label": "project" + }, + { + "label": "Prj" + }, + { + "label": "Imported" + }, + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 13, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 13, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 13, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Imported_Variable" + }, + { + "label": "Binder", + "data": [ + "Binder" + ] + }, + { + "label": "Builder", + "data": [ + "Builder" + ] + }, + { + "label": "Clean", + "data": [ + "Clean" + ] + }, + { + "label": "Compiler", + "data": [ + "Compiler" + ] + }, + { + "label": "Gnatls", + "data": [ + "Gnatls" + ] + }, + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Linker", + "data": [ + "Linker" + ] + }, + { + "label": "Naming", + "data": [ + "Naming" + ] + }, + { + "label": "Remote", + "data": [ + "Remote" + ] + }, + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Ant", + "data": [ + "Ant" + ] + }, + { + "label": "Make", + "data": [ + "Make" + ] + }, + { + "label": "Analyzer", + "data": [ + "Analyzer" + ] + }, + { + "label": "Check", + "data": [ + "Check" + ] + }, + { + "label": "Codepeer", + "data": [ + "Codepeer" + ] + }, + { + "label": "Coverage", + "data": [ + "Coverage" + ] + }, + { + "label": "Dsa", + "data": [ + "Dsa" + ] + }, + { + "label": "Documentation", + "data": [ + "Documentation" + ] + }, + { + "label": "Emulator", + "data": [ + "Emulator" + ] + }, + { + "label": "Gnattest", + "data": [ + "Gnattest" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "Qgen", + "data": [ + "Qgen" + ] + }, + { + "label": "Stack", + "data": [ + "Stack" + ] + }, + { + "label": "Stub", + "data": [ + "Stub" + ] + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 14, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 14, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 14, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Imported_Compiler_Variable" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 17, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 17, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 17, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Archive_Builder", + "data": [ + "", + "Archive_Builder" + ] + }, + { + "label": "Archive_Builder_Append_Option", + "data": [ + "", + "Archive_Builder_Append_Option" + ] + }, + { + "label": "Archive_Indexer", + "data": [ + "", + "Archive_Indexer" + ] + }, + { + "label": "Archive_Suffix", + "data": [ + "", + "Archive_Suffix" + ] + }, + { + "label": "Canonical_Target", + "data": [ + "", + "Canonical_Target" + ] + }, + { + "label": "Create_Missing_Dirs", + "data": [ + "", + "Create_Missing_Dirs" + ] + }, + { + "label": "Config_Prj_File", + "data": [ + "", + "Config_Prj_File" + ] + }, + { + "label": "Default_Language", + "data": [ + "", + "Default_Language" + ] + }, + { + "label": "Excluded_Source_Files", + "data": [ + "", + "Excluded_Source_Files" + ] + }, + { + "label": "Excluded_Source_Dirs", + "data": [ + "", + "Excluded_Source_Dirs" + ] + }, + { + "label": "Excluded_Source_List_File", + "data": [ + "", + "Excluded_Source_List_File" + ] + }, + { + "label": "Exec_Dir", + "data": [ + "", + "Exec_Dir" + ] + }, + { + "label": "Externally_Built", + "data": [ + "", + "Externally_Built" + ] + }, + { + "label": "Ignore_Source_Sub_Dirs", + "data": [ + "", + "Ignore_Source_Sub_Dirs" + ] + }, + { + "label": "Include_Switches_Via_Spec", + "data": [ + "", + "Include_Switches_Via_Spec" + ] + }, + { + "label": "Inherit_Source_Path", + "data": [ + "", + "Inherit_Source_Path" + ] + }, + { + "label": "Interfaces", + "data": [ + "", + "Interfaces" + ] + }, + { + "label": "Languages", + "data": [ + "", + "Languages" + ] + }, + { + "label": "Leading_Library_Options", + "data": [ + "", + "Leading_Library_Options" + ] + }, + { + "label": "Library_Auto_Init_Supported", + "data": [ + "", + "Library_Auto_Init_Supported" + ] + }, + { + "label": "Library_Builder", + "data": [ + "", + "Library_Builder" + ] + }, + { + "label": "Library_Encapsulated_Options", + "data": [ + "", + "Library_Encapsulated_Options" + ] + }, + { + "label": "Library_Gcc", + "data": [ + "", + "Library_Gcc" + ] + }, + { + "label": "Library_Install_Name_Option", + "data": [ + "", + "Library_Install_Name_Option" + ] + }, + { + "label": "Library_Major_Minor_Id_Supported", + "data": [ + "", + "Library_Major_Minor_Id_Supported" + ] + }, + { + "label": "Library_Partial_Linker", + "data": [ + "", + "Library_Partial_Linker" + ] + }, + { + "label": "Library_Reference_Symbol_File", + "data": [ + "", + "Library_Reference_Symbol_File" + ] + }, + { + "label": "Library_Rpath_Options", + "data": [ + "", + "Library_Rpath_Options" + ] + }, + { + "label": "Library_Support", + "data": [ + "", + "Library_Support" + ] + }, + { + "label": "Library_Version_Switches", + "data": [ + "", + "Library_Version_Switches" + ] + }, + { + "label": "Locally_Removed_Files", + "data": [ + "", + "Locally_Removed_Files" + ] + }, + { + "label": "Main", + "data": [ + "", + "Main" + ] + }, + { + "label": "Name", + "data": [ + "", + "Name" + ] + }, + { + "label": "Object_Dir", + "data": [ + "", + "Object_Dir" + ] + }, + { + "label": "Object_Generated", + "data": [ + "", + "Object_Generated" + ] + }, + { + "label": "Objects_Linked", + "data": [ + "", + "Objects_Linked" + ] + }, + { + "label": "Object_Lister", + "data": [ + "", + "Object_Lister" + ] + }, + { + "label": "Object_Lister_Matcher", + "data": [ + "", + "Object_Lister_Matcher" + ] + }, + { + "label": "Origin_Project", + "data": [ + "", + "Origin_Project" + ] + }, + { + "label": "Only_Dirs_With_Sources", + "data": [ + "", + "Only_Dirs_With_Sources" + ] + }, + { + "label": "Project_Dir", + "data": [ + "", + "Project_Dir" + ] + }, + { + "label": "Required_Toolchain_Version", + "data": [ + "", + "Required_Toolchain_Version" + ] + }, + { + "label": "Roots", + "data": [ + "", + "Roots" + ] + }, + { + "label": "Run_Path_Option", + "data": [ + "", + "Run_Path_Option" + ] + }, + { + "label": "Run_Path_Origin", + "data": [ + "", + "Run_Path_Origin" + ] + }, + { + "label": "Runtime", + "data": [ + "", + "Runtime" + ] + }, + { + "label": "Runtime_Dir", + "data": [ + "", + "Runtime_Dir" + ] + }, + { + "label": "Runtime_Library_Dir", + "data": [ + "", + "Runtime_Library_Dir" + ] + }, + { + "label": "Runtime_Source_Dir", + "data": [ + "", + "Runtime_Source_Dir" + ] + }, + { + "label": "Runtime_Source_Dirs", + "data": [ + "", + "Runtime_Source_Dirs" + ] + }, + { + "label": "Separate_Run_Path_Options", + "data": [ + "", + "Separate_Run_Path_Options" + ] + }, + { + "label": "Shared_Library_Minimum_Switches", + "data": [ + "", + "Shared_Library_Minimum_Switches" + ] + }, + { + "label": "Shared_Library_Prefix", + "data": [ + "", + "Shared_Library_Prefix" + ] + }, + { + "label": "Shared_Library_Suffix", + "data": [ + "", + "Shared_Library_Suffix" + ] + }, + { + "label": "Source_Dirs", + "data": [ + "", + "Source_Dirs" + ] + }, + { + "label": "Source_Files", + "data": [ + "", + "Source_Files" + ] + }, + { + "label": "Source_List_File", + "data": [ + "", + "Source_List_File" + ] + }, + { + "label": "Symbolic_Link_Supported", + "data": [ + "", + "Symbolic_Link_Supported" + ] + }, + { + "label": "Target", + "data": [ + "", + "Target" + ] + }, + { + "label": "Toolchain_Version", + "data": [ + "", + "Toolchain_Version" + ] + }, + { + "label": "Toolchain_Name", + "data": [ + "", + "Toolchain_Name" + ] + }, + { + "label": "Toolchain_Description", + "data": [ + "", + "Toolchain_Description" + ] + }, + { + "label": "Toolchain_Path", + "data": [ + "", + "Toolchain_Path" + ] + }, + { + "label": "Warning_Message", + "data": [ + "", + "Warning_Message" + ] + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 20, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 20, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 20, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Switches", + "data": [ + "Emulator", + "Switches" + ] + }, + { + "label": "Debug_Port", + "data": [ + "Emulator", + "Debug_Port" + ] + }, + { + "label": "Board", + "data": [ + "Emulator", + "Board" + ] + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 23, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 23, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 23, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "V2" + }, + { + "label": "V3" + }, + { + "label": "V4" + }, + { + "label": "V5" + }, + { + "label": "Binder", + "data": [ + "Binder" + ] + }, + { + "label": "Builder", + "data": [ + "Builder" + ] + }, + { + "label": "Clean", + "data": [ + "Clean" + ] + }, + { + "label": "Compiler", + "data": [ + "Compiler" + ] + }, + { + "label": "Gnatls", + "data": [ + "Gnatls" + ] + }, + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Linker", + "data": [ + "Linker" + ] + }, + { + "label": "Naming", + "data": [ + "Naming" + ] + }, + { + "label": "Remote", + "data": [ + "Remote" + ] + }, + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Ant", + "data": [ + "Ant" + ] + }, + { + "label": "Make", + "data": [ + "Make" + ] + }, + { + "label": "Analyzer", + "data": [ + "Analyzer" + ] + }, + { + "label": "Check", + "data": [ + "Check" + ] + }, + { + "label": "Codepeer", + "data": [ + "Codepeer" + ] + }, + { + "label": "Coverage", + "data": [ + "Coverage" + ] + }, + { + "label": "Dsa", + "data": [ + "Dsa" + ] + }, + { + "label": "Documentation", + "data": [ + "Documentation" + ] + }, + { + "label": "Emulator", + "data": [ + "Emulator" + ] + }, + { + "label": "Gnattest", + "data": [ + "Gnattest" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "Qgen", + "data": [ + "Qgen" + ] + }, + { + "label": "Stack", + "data": [ + "Stack" + ] + }, + { + "label": "Stub", + "data": [ + "Stub" + ] + }, + { + "label": "project" + }, + { + "label": "Prj" + }, + { + "label": "Imported" + }, + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 24, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 24, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 24, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Default_Switches", + "data": [ + "Compiler", + "Default_Switches" + ] + }, + { + "label": "Driver", + "data": [ + "Compiler", + "Driver" + ] + }, + { + "label": "Required_Switches", + "data": [ + "Compiler", + "Required_Switches" + ] + }, + { + "label": "Switches", + "data": [ + "Compiler", + "Switches" + ] + }, + { + "label": "Config_Body_File_Name", + "data": [ + "Compiler", + "Config_Body_File_Name" + ] + }, + { + "label": "Config_Body_File_Name_Index", + "data": [ + "Compiler", + "Config_Body_File_Name_Index" + ] + }, + { + "label": "Config_Body_File_Name_Pattern", + "data": [ + "Compiler", + "Config_Body_File_Name_Pattern" + ] + }, + { + "label": "Config_File_Switches", + "data": [ + "Compiler", + "Config_File_Switches" + ] + }, + { + "label": "Config_File_Unique", + "data": [ + "Compiler", + "Config_File_Unique" + ] + }, + { + "label": "Config_Spec_File_Name", + "data": [ + "Compiler", + "Config_Spec_File_Name" + ] + }, + { + "label": "Config_Spec_File_Name_Index", + "data": [ + "Compiler", + "Config_Spec_File_Name_Index" + ] + }, + { + "label": "Config_Spec_File_Name_Pattern", + "data": [ + "Compiler", + "Config_Spec_File_Name_Pattern" + ] + }, + { + "label": "Dependency_Driver", + "data": [ + "Compiler", + "Dependency_Driver" + ] + }, + { + "label": "Dependency_Kind", + "data": [ + "Compiler", + "Dependency_Kind" + ] + }, + { + "label": "Dependency_Switches", + "data": [ + "Compiler", + "Dependency_Switches" + ] + }, + { + "label": "Include_Path", + "data": [ + "Compiler", + "Include_Path" + ] + }, + { + "label": "Include_Path_File", + "data": [ + "Compiler", + "Include_Path_File" + ] + }, + { + "label": "Include_Switches", + "data": [ + "Compiler", + "Include_Switches" + ] + }, + { + "label": "Language_Kind", + "data": [ + "Compiler", + "Language_Kind" + ] + }, + { + "label": "Leading_Required_Switches", + "data": [ + "Compiler", + "Leading_Required_Switches" + ] + }, + { + "label": "Local_Config_File", + "data": [ + "Compiler", + "Local_Config_File" + ] + }, + { + "label": "Local_Configuration_Pragmas", + "data": [ + "Compiler", + "Local_Configuration_Pragmas" + ] + }, + { + "label": "Mapping_Body_Suffix", + "data": [ + "Compiler", + "Mapping_Body_Suffix" + ] + }, + { + "label": "Mapping_File_Switches", + "data": [ + "Compiler", + "Mapping_File_Switches" + ] + }, + { + "label": "Mapping_Spec_Suffix", + "data": [ + "Compiler", + "Mapping_Spec_Suffix" + ] + }, + { + "label": "Max_Command_Line_Length", + "data": [ + "Compiler", + "Max_Command_Line_Length" + ] + }, + { + "label": "Multi_Unit_Object_Separator", + "data": [ + "Compiler", + "Multi_Unit_Object_Separator" + ] + }, + { + "label": "Multi_Unit_Switches", + "data": [ + "Compiler", + "Multi_Unit_Switches" + ] + }, + { + "label": "Object_File_Suffix", + "data": [ + "Compiler", + "Object_File_Suffix" + ] + }, + { + "label": "Object_File_Switches", + "data": [ + "Compiler", + "Object_File_Switches" + ] + }, + { + "label": "Object_Path_Switches", + "data": [ + "Compiler", + "Object_Path_Switches" + ] + }, + { + "label": "Path_Syntax", + "data": [ + "Compiler", + "Path_Syntax" + ] + }, + { + "label": "Pic_Option", + "data": [ + "Compiler", + "Pic_Option" + ] + }, + { + "label": "Response_File_Format", + "data": [ + "Compiler", + "Response_File_Format" + ] + }, + { + "label": "Response_File_Switches", + "data": [ + "Compiler", + "Response_File_Switches" + ] + }, + { + "label": "Source_File_Switches", + "data": [ + "Compiler", + "Source_File_Switches" + ] + }, + { + "label": "Trailing_Required_Switches", + "data": [ + "Compiler", + "Trailing_Required_Switches" + ] + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 27, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 27, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 27, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "V2" + }, + { + "label": "V3" + }, + { + "label": "V4" + }, + { + "label": "V5" + }, + { + "label": "Binder", + "data": [ + "Binder" + ] + }, + { + "label": "Builder", + "data": [ + "Builder" + ] + }, + { + "label": "Clean", + "data": [ + "Clean" + ] + }, + { + "label": "Compiler", + "data": [ + "Compiler" + ] + }, + { + "label": "Gnatls", + "data": [ + "Gnatls" + ] + }, + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Linker", + "data": [ + "Linker" + ] + }, + { + "label": "Naming", + "data": [ + "Naming" + ] + }, + { + "label": "Remote", + "data": [ + "Remote" + ] + }, + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Ant", + "data": [ + "Ant" + ] + }, + { + "label": "Make", + "data": [ + "Make" + ] + }, + { + "label": "Analyzer", + "data": [ + "Analyzer" + ] + }, + { + "label": "Check", + "data": [ + "Check" + ] + }, + { + "label": "Codepeer", + "data": [ + "Codepeer" + ] + }, + { + "label": "Coverage", + "data": [ + "Coverage" + ] + }, + { + "label": "Dsa", + "data": [ + "Dsa" + ] + }, + { + "label": "Documentation", + "data": [ + "Documentation" + ] + }, + { + "label": "Emulator", + "data": [ + "Emulator" + ] + }, + { + "label": "Gnattest", + "data": [ + "Gnattest" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "Qgen", + "data": [ + "Qgen" + ] + }, + { + "label": "Stack", + "data": [ + "Stack" + ] + }, + { + "label": "Stub", + "data": [ + "Stub" + ] + }, + { + "label": "project" + }, + { + "label": "Prj" + }, + { + "label": "Imported" + }, + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 30, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 30, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 30, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "V2" + }, + { + "label": "V3" + }, + { + "label": "V4" + }, + { + "label": "V5" + }, + { + "label": "Binder", + "data": [ + "Binder" + ] + }, + { + "label": "Builder", + "data": [ + "Builder" + ] + }, + { + "label": "Clean", + "data": [ + "Clean" + ] + }, + { + "label": "Compiler", + "data": [ + "Compiler" + ] + }, + { + "label": "Gnatls", + "data": [ + "Gnatls" + ] + }, + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Linker", + "data": [ + "Linker" + ] + }, + { + "label": "Naming", + "data": [ + "Naming" + ] + }, + { + "label": "Remote", + "data": [ + "Remote" + ] + }, + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Ant", + "data": [ + "Ant" + ] + }, + { + "label": "Make", + "data": [ + "Make" + ] + }, + { + "label": "Analyzer", + "data": [ + "Analyzer" + ] + }, + { + "label": "Check", + "data": [ + "Check" + ] + }, + { + "label": "Codepeer", + "data": [ + "Codepeer" + ] + }, + { + "label": "Coverage", + "data": [ + "Coverage" + ] + }, + { + "label": "Dsa", + "data": [ + "Dsa" + ] + }, + { + "label": "Documentation", + "data": [ + "Documentation" + ] + }, + { + "label": "Emulator", + "data": [ + "Emulator" + ] + }, + { + "label": "Gnattest", + "data": [ + "Gnattest" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "Qgen", + "data": [ + "Qgen" + ] + }, + { + "label": "Stack", + "data": [ + "Stack" + ] + }, + { + "label": "Stub", + "data": [ + "Stub" + ] + }, + { + "label": "project" + }, + { + "label": "Prj" + }, + { + "label": "Imported" + }, + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 33, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 33, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 33, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "V2" + }, + { + "label": "V3" + }, + { + "label": "V4" + }, + { + "label": "V5" + }, + { + "label": "Binder", + "data": [ + "Binder" + ] + }, + { + "label": "Builder", + "data": [ + "Builder" + ] + }, + { + "label": "Clean", + "data": [ + "Clean" + ] + }, + { + "label": "Compiler", + "data": [ + "Compiler" + ] + }, + { + "label": "Gnatls", + "data": [ + "Gnatls" + ] + }, + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Linker", + "data": [ + "Linker" + ] + }, + { + "label": "Naming", + "data": [ + "Naming" + ] + }, + { + "label": "Remote", + "data": [ + "Remote" + ] + }, + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Ant", + "data": [ + "Ant" + ] + }, + { + "label": "Make", + "data": [ + "Make" + ] + }, + { + "label": "Analyzer", + "data": [ + "Analyzer" + ] + }, + { + "label": "Check", + "data": [ + "Check" + ] + }, + { + "label": "Codepeer", + "data": [ + "Codepeer" + ] + }, + { + "label": "Coverage", + "data": [ + "Coverage" + ] + }, + { + "label": "Dsa", + "data": [ + "Dsa" + ] + }, + { + "label": "Documentation", + "data": [ + "Documentation" + ] + }, + { + "label": "Emulator", + "data": [ + "Emulator" + ] + }, + { + "label": "Gnattest", + "data": [ + "Gnattest" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "Qgen", + "data": [ + "Qgen" + ] + }, + { + "label": "Stack", + "data": [ + "Stack" + ] + }, + { + "label": "Stub", + "data": [ + "Stub" + ] + }, + { + "label": "project" + }, + { + "label": "Prj" + }, + { + "label": "Imported" + }, + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 36, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 36, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 36, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "T1" + }, + { + "label": "Imported" + }, + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 37, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 37, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 37, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Imported_Type" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 41, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 41, + "character": 0 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 41, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Extended_Type" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 44, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 44, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 44, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 47, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 47, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 47, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Imported" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 50, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 50, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 50, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "project" + }, + { + "label": "Prj" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 53, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 53, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 53, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Emulator", + "data": [ + "Emulator" + ] + }, + { + "label": "Extended" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 56, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 56, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 56, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Install", + "data": [ + "Install" + ] + }, + { + "label": "Ide", + "data": [ + "Ide" + ] + }, + { + "label": "Imported" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 59, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 59, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 59, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Pretty_Printer", + "data": [ + "Pretty_Printer" + ] + }, + { + "label": "Prove", + "data": [ + "Prove" + ] + }, + { + "label": "project" + }, + { + "label": "Prj" + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 62, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 62, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 62, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Name", + "data": [ + "", + "Name" + ] + } + ] + } + } + ] + } + }, + { + "send": { + "request": { + "jsonrpc": "2.0", + "id": 65, + "method": "textDocument/completion", + "params": { + "textDocument": { + "uri": "$URI{prj.gpr}" + }, + "position": { + "line": 65, + "character": 1 + }, + "context": { + "triggerKind": 1 + } + } + }, + "wait": [ + { + "jsonrpc": "2.0", + "id": 65, + "result": { + "isIncomplete": false, + "items": [ + { + "label": "Extended_Variable" + }, + { + "label": "Emulator", + "data": [ + "Emulator" + ] + } + ] + } + } + ] + } + }, + { + "stop": { + "exit_code": 0 + } + } +] \ No newline at end of file diff --git a/testsuite/gpr_lsp/completion_references/test.yaml b/testsuite/gpr_lsp/completion_references/test.yaml new file mode 100644 index 000000000..d3732ccec --- /dev/null +++ b/testsuite/gpr_lsp/completion_references/test.yaml @@ -0,0 +1 @@ +title: 'package completion/resolve test'