Skip to content

Commit 5f29413

Browse files
author
mergerepo
committed
Merge remote branch 'origin/master' into edge
(no-precommit-check no-tn-check)
2 parents a2ff667 + 5a5d4d7 commit 5f29413

16 files changed

+3890
-3822
lines changed

doc/settings.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,25 @@ The value is a boolean.
102102
'renameInComments': false
103103
```
104104

105+
## displayMethodAncestryOnNavigation
106+
This setting controls the policy for displaying overriding and overridden
107+
subprograms on navigation requests such as `textDocument/definition`,
108+
`textDocument/declaration` or `textDocument/implementation`.
109+
110+
The different policies are:
111+
112+
* `never`: Never list overridding and/or overridden suprograms.
113+
* `usage_and_abstract_only`: List overridding and/or overridden suprograms
114+
on dispatching calls and on abstract subprogram declarations.
115+
* `definition_only`: List overridding and/or overridden suprograms on
116+
declarations only.
117+
* `always`: Always list overridding and/or overridden suprograms when
118+
possible.
119+
120+
```javascript
121+
'displayMethodAncestryOnNavigation': 'always'
122+
```
123+
105124
## namedNotationThreshold
106125
This setting defines the number of parameters/components at which point named
107126
notation is used for subprogram/aggregate completion snippets.

gnat/gnat.adc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pragma Restrictions (No_Obsolescent_Features);

gnat/lsp.gpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ project LSP is
9494

9595
package Compiler is
9696
for Default_Switches ("Ada") use Ada_Switches;
97+
for Local_Configuration_Pragmas use "gnat.adc";
9798
end Compiler;
9899

99100
package Naming is

gnat/lsp_server.gpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ project LSP_Server is
4747
for Switches ("lsp-ada_driver.adb") use
4848
LSP.Ada_Switches & ("-gnateDVERSION=""" & VERSION & """");
4949
for Switches ("s-memory.adb") use ("-g", "-O2", "-gnatpg");
50+
for Local_Configuration_Pragmas use "gnat.adc";
5051
end Compiler;
5152

5253
package Linker is

scripts/predefined_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def convert_to_ada(json_filename, output_file):
7979
output += f"\n\n Db{statement_counter} : constant String := "
8080
statement_counter += 1
8181

82-
output += '"' + line.strip().replace('"', '""') + '" & ASCII.LF\n & '
82+
output += '"' + line.strip().replace('"', '""') + '"\n & '
8383

8484
line_counter += 1
8585

source/ada/generated/lsp-predefined_completion-ada2012.ads

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

source/ada/lsp-ada_documents.adb

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
-- of the license. --
1616
------------------------------------------------------------------------------
1717

18+
with Ada.Characters.Latin_1;
1819
with Ada.Characters.Wide_Wide_Latin_1;
1920
with Ada.Unchecked_Deallocation;
2021

@@ -144,6 +145,10 @@ package body LSP.Ada_Documents is
144145

145146
begin
146147
if J.Has_Element then
148+
-- Update Line_Terminator of the document
149+
Self.Line_Terminator := Self.Text.Slice
150+
(J.Terminator_First_Marker, J.Terminator_Last_Marker);
151+
147152
loop
148153
Self.Line_To_Marker.Append (J.First_Marker);
149154
Last_Line_Terminated := J.Has_Line_Terminator;
@@ -1143,6 +1148,20 @@ package body LSP.Ada_Documents is
11431148
end loop;
11441149
end Get_Symbols;
11451150

1151+
---------------------
1152+
-- Line_Terminator --
1153+
---------------------
1154+
1155+
function Line_Terminator (Self : Document'Class) return String is
1156+
begin
1157+
if Self.Line_Terminator.Is_Empty then
1158+
-- Document has no line terminator yet, return LF as most used
1159+
return (1 => Ada.Characters.Latin_1.LF);
1160+
else
1161+
return VSS.Strings.Conversions.To_UTF_8_String (Self.Line_Terminator);
1162+
end if;
1163+
end Line_Terminator;
1164+
11461165
-----------------
11471166
-- Get_Node_At --
11481167
-----------------
@@ -1834,11 +1853,11 @@ package body LSP.Ada_Documents is
18341853

18351854
if not Doc_Text.Is_Empty then
18361855
Loc_Text.Append
1837-
(VSS.Strings.Conversions.To_Virtual_String
1838-
(ASCII.LF & ASCII.LF));
1839-
end if;
1856+
(VSS.Strings.To_Virtual_String
1857+
((1 .. 2 => Ada.Characters.Wide_Wide_Latin_1.LF)));
18401858

1841-
Loc_Text.Append (Doc_Text);
1859+
Loc_Text.Append (Doc_Text);
1860+
end if;
18421861

18431862
Item.documentation :=
18441863
(Is_Set => True,

source/ada/lsp-ada_documents.ads

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ package LSP.Ada_Documents is
258258
return Langkit_Support.Slocs.Source_Location;
259259
-- Convert a Positon to a Source_Location
260260

261+
function Line_Terminator (Self : Document'Class) return String;
262+
-- Return line terminator for the document
263+
261264
private
262265

263266
package Line_Marker_Vectors is new Ada.Containers.Vectors
@@ -300,6 +303,8 @@ private
300303
-- Cache of all defining name symbol of the document.
301304
Refresh_Symbol_Cache : Boolean := False;
302305
-- Symbol_Cache rebuild is required before.
306+
Line_Terminator : VSS.Strings.Virtual_String;
307+
-- Line terminator for the text, if known, "" otherwise
303308
end record;
304309

305310
procedure Diff

source/ada/lsp-ada_driver.adb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
--
1818
-- This is driver to run LSP server for Ada language.
1919

20+
with Ada.Characters.Latin_1;
2021
with Ada.Text_IO;
2122
with Ada.Exceptions; use Ada.Exceptions;
2223
with GNAT.Command_Line; use GNAT.Command_Line;
@@ -106,7 +107,8 @@ procedure LSP.Ada_Driver is
106107
procedure On_Uncaught_Exception (E : Exception_Occurrence) is
107108
begin
108109
Trace (Server_Trace,
109-
"EXCEPTION: " & Exception_Name (E) & ASCII.LF &
110+
"EXCEPTION: " & Exception_Name (E) &
111+
Ada.Characters.Latin_1.LF &
110112
Symbolic_Traceback (E));
111113
Handler.Handle_Error;
112114
end On_Uncaught_Exception;
@@ -118,7 +120,8 @@ procedure LSP.Ada_Driver is
118120
procedure Die_On_Uncaught (E : Exception_Occurrence) is
119121
begin
120122
Trace (Server_Trace,
121-
"EXCEPTION: " & Exception_Name (E) & ASCII.LF &
123+
"EXCEPTION: " & Exception_Name (E) &
124+
Ada.Characters.Latin_1.LF &
122125
Symbolic_Traceback (E));
123126
-- An exception occurred while fuzzing: make it fatal.
124127
GNAT.OS_Lib.OS_Exit (42);

source/ada/lsp-ada_handlers-refactor_imports_commands.adb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,14 @@ package body LSP.Ada_Handlers.Refactor_Imports_Commands is
270270
Edit.span := LSP.Lal_Utils.To_Span (S);
271271
if Last then
272272
Edit.newText := LSP.Types.To_LSP_String
273-
("" & ASCII.LF
273+
(Document.Line_Terminator
274274
& LSP.Types.To_UTF_8_String
275275
("with " & Self.With_Clause & ";"));
276276
else
277277
Edit.newText := LSP.Types.To_LSP_String
278278
(LSP.Types.To_UTF_8_String
279-
("with " & Self.With_Clause & ";") & ASCII.LF);
279+
("with " & Self.With_Clause & ";")
280+
& Document.Line_Terminator);
280281
end if;
281282

282283
if Message_Handler.Versioned_Documents then

0 commit comments

Comments
 (0)