Skip to content

Commit 8b50fd7

Browse files
Merge branch 'topic/gs.522.formatting_provider' into 'master'
Revamp the source editor formatting provider See merge request eng/ide/gnatstudio!849
2 parents d57a4b1 + 8896c0f commit 8b50fd7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1577
-1035
lines changed

ada_module/ui/src/ada_module.adb

Lines changed: 200 additions & 181 deletions
Large diffs are not rendered by default.

cpp_module/src/cpp_module.adb

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ package body Cpp_Module is
7070
Align_On_Arrows => False,
7171
Align_Decl_On_Colon => False,
7272
Indent_Comments => C_Indent_Comments.Get_Pref,
73-
Stick_Comments => False,
74-
On_New_Line => C_Action_On_New_Line.Get_Pref);
73+
Stick_Comments => False);
7574

7675
begin
7776
Set_Indentation_Parameters (C_Lang, Params, Style);
@@ -168,16 +167,6 @@ package body Cpp_Module is
168167
Doc => -"Indent lines with only comments.",
169168
Label => -"Indent comments");
170169

171-
C_Action_On_New_Line := Action_On_New_Line_Preferences.Create
172-
(Manager,
173-
Path => -"Editor/C & C++:Indentation",
174-
Name => "C-Action-On-New-Line",
175-
Default => Format,
176-
Doc =>
177-
-"Decide if GNAT Studio should just indent when adding" &
178-
" a new line or if it should also format the current line.",
179-
Label => -"Action on new line");
180-
181170
Hook := new On_Pref_Changed;
182171
Preferences_Changed_Hook.Add (Hook);
183172
Hook.Execute (Kernel, null);

cpp_module/src/cpp_module.ads

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,5 @@ package Cpp_Module is
4040

4141
C_Indent_Extra : Boolean_Preference;
4242
C_Indent_Comments : Boolean_Preference;
43-
C_Action_On_New_Line : Action_On_New_Line_Preferences.Preference;
4443

4544
end Cpp_Module;

gnatstudio/.gnatdebug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,4 @@ GPS.LSP.CODE_ACTIONS=yes
177177
-- Activate DAP debugger for developers
178178
GPS.DEBUGGING.DAP_MODULE=yes
179179
MODULE.Debugger_DAP=yes
180-
GPS.DAP.IN_OUT=yes
180+
GPS.DAP.IN_OUT=yes

gnatstudio/src/gps-main.adb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ with Scenario_Views;
174174
with Shell_Script;
175175
with Socket_Module;
176176
with Src_Editor_Module;
177+
with Src_Editor_Module.Construct_Formatter;
177178
with Switches_Chooser.Scripts;
178179
with Toolchains_Editor;
179180
with VCS2.Module;
@@ -1164,6 +1165,9 @@ procedure GPS.Main is
11641165
end Load_Sources;
11651166

11661167
begin
1168+
-- Freeze the preferences to avoid overwriting preferences.xml too early
1169+
Freeze_Preferences (GPS_Main.Kernel);
1170+
11671171
Update_Splash_Progress_Label ("Loading modules...");
11681172

11691173
-- Register the Learn module and the associated view
@@ -1271,6 +1275,7 @@ procedure GPS.Main is
12711275
-- to access marks that are handled by this module.
12721276

12731277
Src_Editor_Module.Register_Module (GPS_Main.Kernel);
1278+
Src_Editor_Module.Construct_Formatter.Register_Module (GPS_Main.Kernel);
12741279

12751280
-- Initialize the outline view
12761281

@@ -1288,6 +1293,10 @@ procedure GPS.Main is
12881293

12891294
GPS.LSP_Module.Register_Module (GPS_Main.Kernel);
12901295

1296+
-- Create the Formatter provider preferences
1297+
1298+
Src_Editor_Module.Create_Preferences (GPS_Main.Kernel);
1299+
12911300
-- Initialize the ada semantic tree module
12921301

12931302
Ada_Semantic_Tree_Module.Register_Module
@@ -1590,6 +1599,7 @@ procedure GPS.Main is
15901599
GPS.Traces.Register_Module (GPS_Main.Kernel);
15911600

15921601
Load_Preferences (GPS_Main.Kernel);
1602+
Thaw_Preferences (GPS_Main.Kernel);
15931603

15941604
Update_Splash_Progress_Label ("Loading project...");
15951605

0 commit comments

Comments
 (0)