Skip to content

Commit 5f2b672

Browse files
committed
Merge branch 'topic/colors' into 'master'
Add two color themes: GNAT Studio Light and Dark See merge request eng/ide/ada_language_server!2223
2 parents dd44dcb + b498e52 commit 5f2b672

6 files changed

Lines changed: 1155 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ section below it for the last release. -->
88
* Support `textDocument/definition` for source file references in GPR files
99
* Display fully qualified names in the `labelDetails` and `detail` field of completion items
1010
* Do not propose completion after a `.` in Ada comments
11-
* Highlight `finally` keyword (from Ada extension) with semantic tokens.
11+
* Highlight `finally` keyword (from Ada extension) with semantic tokens
1212
* Prompt the user to restart the Ada Language Server when the workspace `.als.json` configuration file is modified
13+
* Two color themes **GNAT Studio Light** and **GNAT Studio Dark**
1314

1415
## 2026.1.202601121
1516

doc/Custom-colors-in-VS-Code.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
# Custom colors
1+
# Color Themes and Highlighting Customization
2+
3+
The primary method for colorizing Ada code in the VS Code extension is
4+
selecting a color theme.
5+
Two custom color themes, **GNAT Studio Light** and **GNAT Studio Dark**,
6+
are available in the extension.
7+
These themes are designed to visually resemble the light and dark themes
8+
available in GNAT Studio.
9+
10+
For extended customization and configuration, the extension leverages
11+
standard VS Code mechanisms for semantic and syntax highlighting:
12+
13+
## Semantic Highlighting
214

315
Since 23.0.6 Ada Language Server provides
416
[Semantic token provider](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide).
@@ -9,6 +21,7 @@ But not all token types and modifier combination are visually distinguishable th
921

1022
Users are welcome to [customize colors](https://code.visualstudio.com/docs/getstarted/themes#_customizing-a-color-theme) to visualize more token types and modifier combinations. This guide provides more details for this and a customization example.
1123

24+
## Syntax Highlighting
1225
In addition to semantic highlighting, users can customize syntax highlighting for keywords, strings, comments or numbers: syntax highlighting will be used for those when the corresponding tokens are not associated with any modifier. Syntax highlighting customization should be made via TextMate rules, which associate _scopes_ and a given style (color, font etc.).
1326

1427
You can use the [Developer: Inspect editor tokens and scopes](https://www.youtube.com/watch?v=mC_htrJ1QPg&ab_channel=Code2020) command to know the scope of a given token (see the screenshot below).

integration/vscode/ada/package.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"language": "ada",
130130
"scopes": {
131131
"namespace": [
132-
"entity.name.label.ada"
132+
"entity.name.namespace.ada"
133133
],
134134
"type": [
135135
"entity.name.type.ada"
@@ -147,7 +147,7 @@
147147
"entity.name.type.struct.ada"
148148
],
149149
"typeParameter": [
150-
"variable.other.constant.parameter.ada"
150+
"variable.other.constant.discriminant.ada"
151151
],
152152
"parameter": [
153153
"entity.name.variable.parameter.ada"
@@ -281,12 +281,39 @@
281281
"variable.globalVariable": [
282282
"variable.other.global.ada"
283283
],
284+
"variable.globalVariable.declaration": [
285+
"variable.other.global.ada"
286+
],
287+
"variable.globalVariable.declaration.readonly": [
288+
"variable.other.constant.ada"
289+
],
284290
"variable.localVariable": [
285291
"variable.other.local.ada"
292+
],
293+
"variable.globalVariable.readonly": [
294+
"variable.other.constant.ada"
295+
],
296+
"variable.declaration": [
297+
"variable.other.local.ada"
298+
],
299+
"variable.declaration.readonly": [
300+
"variable.other.constant.ada"
286301
]
287302
}
288303
}
289304
],
305+
"themes": [
306+
{
307+
"label": "GNAT Studio Light",
308+
"uiTheme": "vs",
309+
"path": "./themes/gnat-studio-light.json"
310+
},
311+
{
312+
"label": "GNAT Studio Dark",
313+
"uiTheme": "vs-dark",
314+
"path": "./themes/gnat-studio-dark.json"
315+
}
316+
],
290317
"snippets": [
291318
{
292319
"language": "ada",

0 commit comments

Comments
 (0)