Skip to content

Commit b5c9c24

Browse files
Display progress bar when renaming
To warn the user that somethings is going. Useful when renaming is long due to collision checking. Closes eng/ide/gnatstudio#28
1 parent da0ec2f commit b5c9c24

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

lsp_client/src/gps-lsp_client-refactoring-rename.adb

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -309,26 +309,29 @@ package body GPS.LSP_Client.Refactoring.Rename is
309309
Auto_Save => Get_Active (Dialog.Auto_Save),
310310
Allow_File_Renaming =>
311311
Get_Active (Dialog.Allow_File_Renaming));
312-
end;
313312

314-
if Dialog.In_Comments /= null then
315-
Set_Rename_In_Comments_Option
316-
(Lang, Get_Active (Dialog.In_Comments));
317-
end if;
318-
319-
if not GPS.LSP_Client.Requests.Execute
320-
(Lang, GPS.LSP_Client.Requests.Request_Access (Request))
321-
then
322-
-- Call old implementation
323-
Standard.Refactoring.Rename.Rename
324-
(Kernel, Context,
325-
Old_Name => To_Unbounded_String (Entity),
326-
New_Name => To_Unbounded_String
327-
(Get_Text (Dialog.New_Name)),
328-
Auto_Save => Get_Active (Dialog.Auto_Save),
329-
Overridden => True,
330-
Make_Writable => Get_Active (Dialog.Make_Writable));
331-
end if;
313+
if Dialog.In_Comments /= null then
314+
Set_Rename_In_Comments_Option
315+
(Lang, Get_Active (Dialog.In_Comments));
316+
end if;
317+
318+
if not GPS.LSP_Client.Requests.Execute
319+
(Lang, GPS.LSP_Client.Requests.Request_Access (Request))
320+
then
321+
-- Call old implementation
322+
Standard.Refactoring.Rename.Rename
323+
(Kernel, Context,
324+
Old_Name => To_Unbounded_String (Entity),
325+
New_Name => To_Unbounded_String
326+
(Get_Text (Dialog.New_Name)),
327+
Auto_Save => Get_Active (Dialog.Auto_Save),
328+
Overridden => True,
329+
Make_Writable => Get_Active (Dialog.Make_Writable));
330+
else
331+
Holder.Editor.Current_View.Set_Activity_Progress_Bar_Visibility
332+
(True);
333+
end if;
334+
end;
332335

333336
Destroy (Dialog);
334337
else
@@ -355,8 +358,12 @@ package body GPS.LSP_Client.Refactoring.Rename is
355358
use type VSS.Strings.Virtual_String;
356359

357360
On_Error : Boolean;
358-
361+
Holder : constant Controlled_Editor_Buffer_Holder :=
362+
Self.Kernel.Get_Buffer_Factory.Get_Holder
363+
(Self.File);
359364
begin
365+
Holder.Editor.Current_View.Set_Activity_Progress_Bar_Visibility
366+
(False);
360367
GPS.LSP_Client.Edit_Workspace.Edit
361368
(Kernel => Self.Kernel,
362369
Workspace_Edit => Result,
@@ -392,8 +399,12 @@ package body GPS.LSP_Client.Refactoring.Rename is
392399
Message : String;
393400
Data : GNATCOLL.JSON.JSON_Value)
394401
is
395-
pragma Unreferenced (Self);
402+
Holder : constant Controlled_Editor_Buffer_Holder :=
403+
Self.Kernel.Get_Buffer_Factory.Get_Holder
404+
(Self.File);
396405
begin
406+
Holder.Editor.Current_View.Set_Activity_Progress_Bar_Visibility
407+
(False);
397408
Trace (Me, "Error when renaming: " & Message);
398409
end On_Error_Message;
399410

0 commit comments

Comments
 (0)