|
1 | 1 | ------------------------------------------------------------------------------
|
2 | 2 | -- Language Server Protocol --
|
3 | 3 | -- --
|
4 |
| --- Copyright (C) 2023, AdaCore -- |
| 4 | +-- Copyright (C) 2023-2024, AdaCore -- |
5 | 5 | -- --
|
6 | 6 | -- This is free software; you can redistribute it and/or modify it under --
|
7 | 7 | -- terms of the GNU General Public License as published by the Free Soft- --
|
@@ -133,22 +133,24 @@ package body LSP.Ada_Handlers.Refactor.Sort_Dependencies is
|
133 | 133 |
|
134 | 134 | Message_Handler : LSP.Ada_Handlers.Message_Handler renames
|
135 | 135 | LSP.Ada_Handlers.Message_Handler (Handler.all);
|
| 136 | + Document : constant LSP.Ada_Documents.Document_Access := |
| 137 | + Message_Handler.Get_Open_Document (URI => Self.Where.uri); |
136 | 138 | Context : LSP.Ada_Contexts.Context renames
|
137 | 139 | Message_Handler.Contexts.Get (Self.Context).all;
|
138 | 140 | File : constant GNATCOLL.VFS.Virtual_File :=
|
139 | 141 | Message_Handler.To_File (Self.Where.uri);
|
140 | 142 | Analysis_Unit : constant Libadalang.Analysis.Analysis_Unit :=
|
141 | 143 | Context.Get_AU (File);
|
142 |
| - Sloc : constant Source_Location := |
143 |
| - (Langkit_Support.Slocs.Line_Number |
144 |
| - (Self.Where.a_range.start.line) + 1, |
145 |
| - Langkit_Support.Slocs.Column_Number |
146 |
| - (Self.Where.a_range.start.character) + 1); |
| 144 | + Where : constant Source_Location_Range := |
| 145 | + Document.To_Source_Location_Range (Self.Where.a_range); |
147 | 146 | Compilation_Unit : constant Libadalang.Analysis.Compilation_Unit :=
|
148 |
| - Analysis_Unit.Root.Lookup (Sloc).P_Enclosing_Compilation_Unit; |
| 147 | + Analysis_Unit |
| 148 | + .Root |
| 149 | + .Lookup (Where.Start_Sloc) |
| 150 | + .P_Enclosing_Compilation_Unit; |
| 151 | + Sorter : constant Dependencies_Sorter := |
| 152 | + Create_Dependencies_Sorter (Compilation_Unit, Where); |
149 | 153 |
|
150 |
| - Sorter : constant Dependencies_Sorter := |
151 |
| - Create_Dependencies_Sorter (Compilation_Unit); |
152 | 154 | begin
|
153 | 155 | Edits := Sorter.Refactor (null);
|
154 | 156 | end Refactor;
|
|
0 commit comments