-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathextension.js
More file actions
121 lines (112 loc) · 3.46 KB
/
extension.js
File metadata and controls
121 lines (112 loc) · 3.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
const vscode = require('vscode');
function activate(context) {
const updateColors = () => {
const colorsConfig = vscode.workspace.getConfiguration('armSyntax.colors');
const boldConfig = vscode.workspace.getConfiguration('armSyntax.bold');
const italicConfig = vscode.workspace.getConfiguration('armSyntax.italic');
const editorConfig = vscode.workspace.getConfiguration('editor');
const createFontStyle = (bold, italic) => {
let styles = [];
if (bold) styles.push("bold");
if (italic) styles.push("italic");
return styles.join(" ");
};
const tokenColorCustomizations = {
textMateRules: [
{
scope: "keyword.mnemonic.arm",
settings: {
foreground: colorsConfig.get('mnemonics', '#3E69E2'),
fontStyle: createFontStyle(
boldConfig.get('mnemonics', true),
italicConfig.get('mnemonics', false)
)
}
},
{
scope: "comment.line.arm",
settings: {
foreground: colorsConfig.get('comments', '#7EC699'),
fontStyle: createFontStyle(
boldConfig.get('comments', false),
italicConfig.get('comments', true)
)
}
},
{
scope: "variable.register.arm",
settings: {
foreground: colorsConfig.get('registers', '#3E69E2'),
fontStyle: createFontStyle(
boldConfig.get('registers', false),
italicConfig.get('registers', false)
)
}
},
{
scope: "constant.numeric.arm",
settings: {
foreground: colorsConfig.get('constants', '#D34AD8'),
fontStyle: createFontStyle(
boldConfig.get('constants', false),
italicConfig.get('constants', false)
)
}
},
{
scope: "entity.name.label.arm",
settings: {
foreground: colorsConfig.get('labels', '#ECB827'),
fontStyle: createFontStyle(
boldConfig.get('labels', false),
italicConfig.get('labels', false)
)
}
},
{
scope: "support.directive.arm",
settings: {
foreground: colorsConfig.get('directives', '#FD4444'),
fontStyle: createFontStyle(
boldConfig.get('directives', false),
italicConfig.get('directives', false)
)
}
},
{
scope: "displacement_op2.arm",
settings: {
foreground: colorsConfig.get('displacements', '#E8F348'),
fontStyle: createFontStyle(
boldConfig.get('displacements', false),
italicConfig.get('displacements', false)
)
}
}
]
};
editorConfig.update(
'tokenColorCustomizations',
tokenColorCustomizations,
vscode.ConfigurationTarget.Workspace
);
};
// Update colors when the extension activates
updateColors();
// Listen for configuration changes
const disposable = vscode.workspace.onDidChangeConfiguration((event) => {
if (
event.affectsConfiguration('armSyntax.colors') ||
event.affectsConfiguration('armSyntax.bold') ||
event.affectsConfiguration('armSyntax.italic')
) {
updateColors();
}
});
context.subscriptions.push(disposable);
}
function deactivate() {}
module.exports = {
activate,
deactivate
};