Skip to content

Commit 8391eb2

Browse files
Take into account selection for 'sort dependencies'
1 parent 9107517 commit 8391eb2

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

source/ada/lsp-ada_handlers-refactor-sort_dependencies.adb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,24 @@ package body LSP.Ada_Handlers.Refactor.Sort_Dependencies is
133133

134134
Message_Handler : LSP.Ada_Handlers.Message_Handler renames
135135
LSP.Ada_Handlers.Message_Handler (Handler.all);
136+
Document : constant LSP.Ada_Documents.Document_Access :=
137+
Message_Handler.Get_Open_Document
138+
(URI => Self.Where.uri);
136139
Context : LSP.Ada_Contexts.Context renames
137140
Message_Handler.Contexts.Get (Self.Context).all;
138141
File : constant GNATCOLL.VFS.Virtual_File :=
139142
Message_Handler.To_File (Self.Where.uri);
140143
Analysis_Unit : constant Libadalang.Analysis.Analysis_Unit :=
141144
Context.Get_AU (File);
142145
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);
146+
Document.To_Source_Location (Self.Where.a_range.start);
147147
Compilation_Unit : constant Libadalang.Analysis.Compilation_Unit :=
148148
Analysis_Unit.Root.Lookup (Sloc).P_Enclosing_Compilation_Unit;
149-
150149
Sorter : constant Dependencies_Sorter :=
151-
Create_Dependencies_Sorter (Compilation_Unit);
150+
Create_Dependencies_Sorter
151+
(Compilation_Unit,
152+
Where => Document.To_Source_Location_Range
153+
(A_Range => Self.Where.a_range));
152154
begin
153155
Edits := Sorter.Refactor (null);
154156
end Refactor;

0 commit comments

Comments
 (0)