11# Ada Language Server configuration
22
3- The ALS reads initial configuration from the ` initializationOptions `
4- property of the ` initialize ` request (if any) and then updates
5- the configuration with each ` workspace/didChangeConfiguration `
6- notification.
3+ ## Configuration Sources
74
8- In the context of Visual Studio Code, configuration settings can be set in the
9- workspace ` settings.json ` file or the [ multi-root workspace
10- file] ( https://code.visualstudio.com/docs/editor/multi-root-workspaces ) by
11- prefixing each setting name with ` ada. ` , e.g.
5+ The ALS can be given configuration settings in the following ways:
6+
7+ 1 . The ` --config CONFIG_FILE ` command line option, if specified.
8+
9+ 2 . The ` initializationOptions ` property of the ` initialize ` request, if specified.
10+
11+ 3 . In ` workspace/didChangeConfiguration ` LSP notifications.
12+
13+ 4 . In the User, Remote or Workspace settings of Visual Studio Code, where each setting name is prefixed with ` ada. ` .
14+
15+ If given, the configuration file must be a JSON file with the following structure:
1216
1317``` json
1418{
15- "ada.projectFile" : " right_project.gpr" ,
16- "ada.scenarioVariables" : {
17- "LIBRARY_TYPE" : " static"
18- },
19- "ada.onTypeFormatting.indentOnly" : true ,
20- "useGnatformat" : true
19+ "projectFile" : " ..." ,
20+ "scenarioVariables" : { ... },
21+ ...
2122}
2223```
2324
24- At the protocol level, any setting in ` workspace/didChangeConfiguration ` should
25- be inside an ` ada ` JSON object, while there is no such wrapping object
26- for ` initializationOptions ` . On the protocol level messages look like:
25+ If specified in the ` initialize ` request, settings should be wrapped into an ` ada ` JSON object in the ` initializationOptions ` property as follows:
2726
2827``` json
2928{
3029 "jsonrpc" : " 2.0" ,
31- "id" : 123 ,
3230 "method" : " initialize" ,
3331 "params" : {
3432 "initializationOptions" : {
35- "projectFile" : " right_project.gpr"
33+ "ada" : {
34+ "projectFile" : " right_project.gpr" ,
35+ "scenarioVariables" : { ... },
36+ ...
37+ }
3638 },
3739 ...
3840 }
3941}
42+ ```
4043
44+ Similarly, settings passed in ` workspace/didChangeConfiguration ` notifications should also be wrapped into an ` ada ` JSON object:
45+
46+ ``` json
4147{
4248 "jsonrpc" : " 2.0" ,
43- "method" : " workspace/didChangeConfiguration" ,
44- "params" : {
45- "settings" : {
46- "ada" : {
47- "projectFile" : " right_project.gpr"
48- }
49- }
49+ "method" : " workspace/didChangeConfiguration" ,
50+ "params" : {
51+ "settings" : {
52+ "ada" : {
53+ "projectFile" : " right_project.gpr"
54+ }
55+ }
5056 }
5157}
5258```
5359
60+ In the context of Visual Studio Code, configuration settings can be set in the
61+ User, Remote or Workspace ` settings.json ` file or the [ multi-root workspace
62+ file] ( https://code.visualstudio.com/docs/editor/multi-root-workspaces ) by
63+ prefixing each setting name with ` ada. ` , e.g.
64+
65+ ``` json
66+ {
67+ "ada.projectFile" : " right_project.gpr" ,
68+ "ada.scenarioVariables" : {
69+ "LIBRARY_TYPE" : " static"
70+ },
71+ "ada.onTypeFormatting.indentOnly" : true ,
72+ "ada.useGnatformat" : true
73+ }
74+ ```
75+
76+ ## Settings
77+
5478Ada Language Server understands these settings:
5579
5680* [ projectFile] ( #projectfile )
@@ -73,7 +97,7 @@ Ada Language Server understands these settings:
7397
7498----
7599
76- ## projectFile
100+ ### projectFile
77101
78102You can configure the GNAT Project File via the ` projectFile ` key.
79103The setting has a string value, that points to the ` .gpr ` file.
@@ -86,7 +110,7 @@ root folder, then ALS will use it.
86110 ' projectFile' : ' gnat/lsp_server.gpr'
87111```
88112
89- ## scenarioVariables
113+ ### scenarioVariables
90114
91115You can configure scenario variables via the ` scenarioVariables ` key.
92116The setting has an object value. Keys in this object correspond to
@@ -98,7 +122,7 @@ scenario variables names and string values to variables values.
98122 }
99123```
100124
101- ## defaultCharset
125+ ### defaultCharset
102126
103127You can set the character set to use when the server has to use when reading
104128files from disk by specifying an ` defaultCharset ` key. The default is
@@ -108,7 +132,7 @@ files from disk by specifying an `defaultCharset` key. The default is
108132 ' defaultCharset' : ' UTF-8'
109133```
110134
111- ## relocateBuildTree
135+ ### relocateBuildTree
112136
113137With this option it is possible to achieve out-of-tree build. That is,
114138real object, library or exec directories are relocated to the current
@@ -121,7 +145,7 @@ for more details about the corresponding gprbuild switch.
121145 ' relocateBuildTree' : ' /home/user/project/build/'
122146```
123147
124- ## rootDir
148+ ### rootDir
125149
126150This option is to be used with relocateBuildTree above and cannot be
127151specified alone. This option specifies the root directory for artifacts
@@ -134,7 +158,7 @@ for more details about the corresponding gprbuild switch.
134158 ' relocateBuildTree' : ' /home/user/project/'
135159```
136160
137- ## enableDiagnostics
161+ ### enableDiagnostics
138162
139163You can explicitly deactivate the emission of diagnostics, via the
140164` enableDiagnostics ` key. By default, diagnostics are enabled.
@@ -144,7 +168,7 @@ The value is a boolean.
144168 ' enableDiagnostics' : false
145169```
146170
147- ## projectDiagnostics
171+ ### projectDiagnostics
148172
149173This setting needs ` enableDiagnostics ` enabled and can be disabled to remove
150174project related diagnotics.
@@ -154,7 +178,7 @@ The value is a boolean.
154178 ' enableDiagnostics' : false
155179```
156180
157- ## enableIndexing
181+ ### enableIndexing
158182
159183By default, the server indexes the source files after loading a project,
160184to speed up subsequent requests. This behavior can be controlled
@@ -165,7 +189,7 @@ The value is a boolean.
165189 ' enableIndexing' : false
166190```
167191
168- ## renameInComments
192+ ### renameInComments
169193
170194The language server is able to edit Ada comments while executing
171195` textDocument/rename ` request. To enable this just set
@@ -176,7 +200,7 @@ The value is a boolean.
176200 ' renameInComments' : false
177201```
178202
179- ## useCompletionSnippets
203+ ### useCompletionSnippets
180204
181205Whether we should use snippets in completion results. Snippets can be
182206returned in case of subprogram calls for instance, with placeholders
@@ -187,7 +211,7 @@ The value is a boolean.
187211 ' useCompletionSnippets' : true
188212```
189213
190- ## insertWithClauses
214+ ### insertWithClauses
191215
192216Whether we should automatically insert missing with-clauses when
193217accepting completion for invisible symbols.
@@ -196,7 +220,7 @@ accepting completion for invisible symbols.
196220 ' insertWithClauses' : true
197221```
198222
199- ## displayMethodAncestryOnNavigation
223+ ### displayMethodAncestryOnNavigation
200224
201225This setting controls the policy for displaying overriding and overridden
202226subprograms on navigation requests such as ` textDocument/definition ` ,
@@ -216,7 +240,7 @@ The different policies are:
216240 ' displayMethodAncestryOnNavigation' : ' always'
217241```
218242
219- ## namedNotationThreshold
243+ ### namedNotationThreshold
220244
221245This setting defines the number of parameters/components at which point named
222246notation is used for subprogram/aggregate completion snippets.
@@ -226,7 +250,7 @@ The value is a number. The default value is `3`.
226250 ' namedNotationThreshold' : 2
227251```
228252
229- ## foldComments
253+ ### foldComments
230254
231255When this setting is ` true ` the server sends blocks information for comments which can be used for folding comment blocks.
232256The value is a boolean. The default is ` true ` .
@@ -235,7 +259,7 @@ The value is a boolean. The default is `true`.
235259 ' foldComments' : false
236260```
237261
238- ## followSymlinks
262+ ### followSymlinks
239263
240264When this setting is ` false ` the server doesn't do any attempts to normalize file names sent by a client.
241265This means that symlinks stay unresolved and character case is unchanged (on case insensitive file systems).
@@ -246,7 +270,7 @@ The value is a boolean. The default is `true`.
246270 ' followSymlinks' : false
247271```
248272
249- ## documentationStyle
273+ ### documentationStyle
250274
251275The language server supports different styles to document entities in the source
252276code. This setting controls primary documentation style of entities. When
@@ -267,7 +291,7 @@ For more information about documentation styles see GNATdoc User's Manual.
267291 ' documentationStyle' : ' gnat'
268292```
269293
270- ## trace.server
294+ ### trace.server
271295
272296This option controls the tracing of the communication between VS Code and the Ada
273297language server. It causes the client to trace each message sent and received
@@ -283,13 +307,13 @@ On the server side this option does not trigger any additional logging.
283307
284308An equivalent setting ` gpr.trace.server ` exists for tracing the communcation between VS Code and the GPR language server.
285309
286- ## onTypeFormatting.indentOnly
310+ ### onTypeFormatting.indentOnly
287311
288312This option controls if the ` textDocument/onTypeFormatting ` request only indents a new line, or if
289313it additionally tries to format the previous node. By default, this option is enabled, that is,
290314` textDocument/onTypeFormatting ` only indents new lines.
291315
292- ## useGnatformat
316+ ### useGnatformat
293317
294318This option controls the formatting provider for the ` textDocument/formatting ` ,
295319` textDocument/rangeFormatting ` and ` textDocument/onTypeFormatting ` request. By default, this option
0 commit comments