|
15 | 15 | -- of the license. -- |
16 | 16 | ------------------------------------------------------------------------------ |
17 | 17 |
|
| 18 | +with GNATCOLL.Traces; use GNATCOLL.Traces; |
18 | 19 | with GNATCOLL.VFS; |
19 | 20 |
|
| 21 | +with Libadalang; |
| 22 | +with Libadalang.Analysis; |
20 | 23 | with LSP.Ada_Documents; |
21 | 24 | with LSP.Client_Message_Receivers; |
22 | 25 | with LSP.Structures; |
23 | 26 | with LSP.Server_Notifications.DidChange; |
24 | 27 |
|
25 | 28 | package body LSP.Ada_Did_Change_Document is |
26 | 29 |
|
| 30 | + Did_Change_Indexing : constant Trace_Handle := |
| 31 | + Create ("ALS.DID_CHANGE.INDEXING", On); |
| 32 | + -- Should be disabled when running the testsuite |
| 33 | + |
27 | 34 | type Did_Change_Job |
28 | 35 | (Parent : not null access constant Ada_Did_Change_Handler) |
29 | 36 | is limited new LSP.Server_Jobs.Server_Job with record |
@@ -101,9 +108,22 @@ package body LSP.Ada_Did_Change_Document is |
101 | 108 | (Message.Params.textDocument.version, Changes); |
102 | 109 | end if; |
103 | 110 |
|
| 111 | + -- Clear the cacha of symbols now |
| 112 | + LSP.Ada_Documents.Reset_Symbol_Cache (Self.Document.all); |
| 113 | + -- Manually reparse the file in all context now so the AU is up-to-date |
| 114 | + -- for the following requests. |
104 | 115 | for Context of Self.Parent.Context.Contexts_For_File (File) loop |
105 | | - Context.Index_Document (Self.Document.all); |
| 116 | + declare |
| 117 | + Dummy : Libadalang.Analysis.Analysis_Unit; |
| 118 | + begin |
| 119 | + Dummy := Context.Get_AU (File, Reparse => True); |
| 120 | + end; |
106 | 121 | end loop; |
| 122 | + -- The indexing here will do PLE and fill the database of Defining_Name |
| 123 | + -- in a separate job at the lowest priority |
| 124 | + if Did_Change_Indexing.Is_Active then |
| 125 | + Self.Parent.Context.Enqueue_Indexing (File); |
| 126 | + end if; |
107 | 127 |
|
108 | 128 | -- Emit diagnostics |
109 | 129 | Self.Parent.Context.Publish_Diagnostics (Self.Document); |
|
0 commit comments