Skip to content

Commit 1594065

Browse files
committed
Merge branch 'topic/stable_bump_20230807' into 'master'
Merge edge into master See merge request eng/ide/ada_language_server!1279
2 parents d6f6814 + 8f818fd commit 1594065

File tree

102 files changed

+3923
-1894
lines changed

Some content is hidden

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

102 files changed

+3923
-1894
lines changed

.vscode/launch.json

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"!**/node_modules/**"
2222
],
2323
"args": [
24-
"--extensionDevelopmentPath=${workspaceFolder}/integration/vscode/ada",
24+
"--extensionDevelopmentPath=${workspaceFolder}/integration/vscode/ada"
2525

2626
// It is useful to have workspace available for local debugging. The
2727
// following one is provided within the repository with test folders
@@ -34,7 +34,6 @@
3434
// So you can checkout a second copy of the ALS repository under
3535
// ../als-rt and use it with the following line.
3636
// "${workspaceFolder}/../als-rt"
37-
"${workspaceFolder}/integration/vscode/ada/test/TestWorkspace"
3837
],
3938
"preLaunchTask": "npm: compile",
4039
"env": {
@@ -47,40 +46,7 @@
4746
}
4847
},
4948
{
50-
"name": "Extension Tests",
51-
"type": "extensionHost",
52-
"request": "launch",
53-
"runtimeExecutable": "${execPath}",
54-
"outFiles": [
55-
"${workspaceFolder}/integration/vscode/ada/out/**/*.js",
56-
"!**/node_modules/**"
57-
],
58-
"args": [
59-
"--extensionDevelopmentPath=${workspaceFolder}/integration/vscode/ada",
60-
"--extensionTestsPath=${workspaceFolder}/integration/vscode/ada/out/test/suite/index",
61-
"${workspaceFolder}/integration/vscode/ada/test/TestWorkspace"
62-
],
63-
// Below we make the executables of node modules visible to the tests.
64-
// In particular, vscode-tmgrammar-snap is used for syntax highlighting
65-
// tests.
66-
"env": {
67-
// This is necessary to make the "child" vscode inherit the PATH
68-
// variable set in the workspace settings. Without it in some setups
69-
// (e.g. vscode remote) the child vscode does not get visibility
70-
// over the Ada toolchain available in the parent vscode
71-
// environment.
72-
"PATH": "${env:PATH}",
73-
// This is custom env var that we use in
74-
// integration/vscode/ada/test/suite/index.ts to prevent timeouts in
75-
// tests when debugging
76-
"MOCHA_TIMEOUT": "0"
77-
},
78-
"preLaunchTask": "npm: pretest",
79-
// Switch to Debug Console to see test results
80-
"internalConsoleOptions": "openOnSessionStart"
81-
},
82-
{
83-
"name": "Extension Tests (Update Test Refs)",
49+
"name": "Highlighting Tests (Update Test Refs)",
8450
"type": "extensionHost",
8551
"request": "launch",
8652
"runtimeExecutable": "${execPath}",
@@ -136,7 +102,7 @@
136102
],
137103
"args": [
138104
"--extensionDevelopmentPath=${workspaceFolder}/integration/vscode/ada",
139-
"--extensionTestsPath=${workspaceFolder}/integration/vscode/ada/out/test/suite/index",
105+
"--extensionTestsPath=${workspaceFolder}/integration/vscode/ada/out/test/suite/highlighting/index",
140106
"${workspaceFolder}/integration/vscode/ada/test/TestWorkspace"
141107
],
142108
// Below we make the executables of node modules visible to the tests.

.vscode/settings.json.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
// ada_language_server executable after relocation into the VS Code
66
// extension.
77
"LIBRARY_TYPE": "static"
8+
"ada.onTypeFormatting.indentOnly": true,
9+
"[ada]": {
10+
"editor.autoIndent": "none",
11+
"editor.formatOnType": false,
12+
"editor.tabSize": 3
813
},
914
"python.analysis.extraPaths": ["testsuite"],
1015
"python.linting.enabled": true,

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ To build the language server you need:
7676
* The [gnatdoc](https://github.com/AdaCore/gnatdoc) library
7777
* The [gpr](https://github.com/AdaCore/gpr) library
7878
* The process [spawn](https://github.com/AdaCore/spawn) library
79+
* The [lal-refactor](https://github.com/AdaCore/lal-refactor) library
80+
* The [templates-parser](https://github.com/AdaCore/templates-parser) library
7981

8082
Project files of the libraries must be available via the `GPR_PROJECT_PATH`
8183
environment variable.

doc/object_dir.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Object Directory
2+
3+
## Short introduction
4+
5+
This is a custom request used by the VS Code extension to retrieve the Object Directory from the GPR project file, allowing us to get the path to the object directory currently in use.
6+
7+
## Change description
8+
9+
We introduce a new type to represent the request results:
10+
11+
```typescript
12+
13+
type ObjDirResponse = {
14+
Value : string;
15+
};
16+
17+
```
18+
19+
And a new request:
20+
21+
method: `$/glsObjectDir`
22+
params: null
23+
24+
Returning the project file of the loaded project like this:
25+
26+
result: `ObjDirResponse`

doc/project_file.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Project File
2+
3+
## Short introduction
4+
5+
This is a custom request used by the VS Code extension to retrieve the GPR project file uploaded by the ALS, allowing us to get the path to the project file currently in use.
6+
7+
## Change description
8+
9+
We introduce a new type to represent the request results:
10+
11+
```typescript
12+
13+
export type ProjectFileResponse = {
14+
Value : string; // The Path to the GPR project file
15+
};
16+
```
17+
18+
And a new request:
19+
20+
method: `$/glsProjectFile`
21+
params: null
22+
23+
Returning the project file of the loaded project like this:
24+
25+
result: `ProjectFileResponse`

doc/refactoring_tools.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
* The new parameter type is infered when only the name is provided.
3939
* The new parameter location is infered from the cursor position.
4040

41-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-subprogram_signature.ads)
41+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-subprogram_signature.ads)
4242

4343
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/add_parameter/)
4444

@@ -50,7 +50,7 @@
5050
* All subprogram specs are updated.
5151
* Actual parameter is removed from the subprogram calls.
5252

53-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-subprogram_signature-remove_parameter.ads)
53+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-subprogram_signature-remove_parameter.ads)
5454

5555
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/remove_parameter)
5656

@@ -62,7 +62,7 @@
6262
* All subprogram specs are updated.
6363
* Actual parameter are moved in the subprogram calls when needed.
6464

65-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-subprogram_signature.ads)
65+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-subprogram_signature.ads)
6666

6767
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/move_parameter)
6868

@@ -73,7 +73,7 @@
7373
* Changes the parameter mode within a subprogram spec.
7474
* All subprogram specs are updated.
7575

76-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-subprogram_signature.ads)
76+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-subprogram_signature.ads)
7777

7878
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/change_parameter_mode)
7979

@@ -85,7 +85,7 @@
8585
* Only subtype indications with correct syntax are accepted.
8686
* All subprogram specs are updated.
8787

88-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-subprogram_signature-change_parameters_type.ads)
88+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-subprogram_signature-change_parameters_type.ads)
8989

9090
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/change_parameter_type)
9191

@@ -97,7 +97,7 @@
9797
* Only default value expressions with correct syntax are accepted.
9898
* All subprogram specs are updated.
9999

100-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-subprogram_signature-change_parameters_defualt_value.ads)
100+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-subprogram_signature-change_parameters_default_value.ads)
101101

102102
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/change_parameter_default_value)
103103

@@ -110,7 +110,7 @@
110110
* Local declarations of for loop and exception handlers are passed to the extracted subprogram as new parameters.
111111
* Extract function is available is the last statment is either an assignment or a return statment.
112112

113-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-extract_subprogram.ads)
113+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-extract_subprogram.ads)
114114

115115
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/extract_subprogram)
116116

@@ -121,7 +121,7 @@
121121
* Moves a declaration and its dependent declarations to their parent declarative part.
122122
* When pulling up a subprogram, object declaration are not pulled up. Instead, they're added as formal parameters to the subprogram specification and as actual parameters to the subprogram calls.
123123

124-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-pull_up_declaration.ads)
124+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-pull_up_declaration.ads)
125125

126126
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/pull_up_declaration)
127127

@@ -133,7 +133,7 @@
133133
* Use clauses in the separate subunit are moved to the subprogram's declarative part to avoid namespace collisions.
134134
* .bak is added to the separate subunit source filename.
135135

136-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-suppress_separate.ads)
136+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-suppress_separate.ads)
137137

138138
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/suppress_separate)
139139

@@ -145,7 +145,7 @@
145145
* All references of the object declaration or expression are replaced by the introduced parameter.
146146
* The user must mannually fix the calls to the subprogram that was refactored by addings the corresponding actual parameter.
147147

148-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-introduce_parameter.ads)
148+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-introduce_parameter.ads)
149149

150150
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/introduce_parameter)
151151

@@ -155,7 +155,7 @@
155155

156156
* Replaces a type in the intire project by another type provided by the user.
157157

158-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-replace_type.ads)
158+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-replace_type.ads)
159159

160160
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/replace_type)
161161

@@ -165,7 +165,7 @@
165165

166166
* For an unresolved name, suggests all packages that can be imported and prefix to be added so that that the name gets resolved.
167167

168-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor_imports.ads)
168+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-refactor_imports.ads)
169169

170170
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/auto_import)
171171

@@ -175,7 +175,7 @@
175175

176176
* Sorts all with and use clauses and their associated pragmas.
177177

178-
[Source](https://github.com/AdaCore/libadalang-tools/blob/master/src/laltools-refactor-sort_dependencies.ads)
178+
[Source](https://github.com/AdaCore/lal-refactor/blob/main/src/lal_refactor-sort_dependencies.ads)
179179

180180
[Demo Source](../integration/vscode/Code%20Samples/refactoring_demos/sort_dependencies)
181181

doc/settings.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Ada Language Server understands these settings:
4747
* [foldComments](#foldComments)
4848
* [followSymlinks](#followSymlinks)
4949
* [documentationStyle](#documentationStyle)
50+
* [onTypeFormatting.indentOnly](#onTypeFormatting.indentOnly)
5051

5152
----
5253

@@ -214,4 +215,10 @@ For more information about documentation styles see GNATdoc User's Manual.
214215
## trace.server
215216

216217
This option controls the tracing of the communication between VSCode and the Ada language server.
217-
The separate setting `gpr.trace.server` controls tracing for GPR language server.
218+
The separate setting `gpr.trace.server` controls tracing for GPR language server.
219+
220+
## onTypeFormatting.indentOnly
221+
222+
This option controls if the `textDocument/onTypeFormatting` request only indents a new line, or if
223+
it additionally tries to format the previous node. By default, this option is enabled, that is,
224+
`textDocument/onTypeFormatting` only indents new lines.

gnat/lsp_server.gpr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
with "gpr2.gpr";
1919
with "libadalang";
2020
with "lal_tools.gpr";
21+
with "lal_refactor.gpr";
2122
with "ada_libfswatch.gpr";
2223
with "libgnatdoc.gpr";
2324
with "spawn.gpr";

integration/vscode/ada/package-lock.json

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)