Skip to content

Commit f9fd8e5

Browse files
authored
Merge pull request #92 from CodinGame/fix-missing-color
Fix missing colors
2 parents abca957 + 941da83 commit f9fd8e5

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The VSCode api is composed of:
88
- Some features that are supported by Monaco (Language feature registrations...) which are just forwarded to it (with some transformations)
99
- Some features that are not supported by Monaco, and in such case:
1010
- If it's an important feature: we let the user implement it as they wish.
11-
- If it's some advanced features that don't make a lot of sense on Monaco (debug, tests...), it just throws an error when you try to use it.
11+
- If it's some advanced features that don't make a lot of sense on Monaco (scm, tests...), it just throws an error when you try to use it.
1212

1313
To implement by hands the optional features (file system, workspace folders, file...), you can use the `Services` namespace from `vscode/services`:
1414

@@ -161,6 +161,7 @@ It includes:
161161
- Keybinding service, with user keybindings editor
162162
- Token classification
163163
- Snippets (but not working in monaco 0.34)
164+
- Debuggers
164165

165166
It also uses the `getJsonSchemas` function to register them on the monaco json worker and have autocomplete/hover on settings and keybindings.
166167

@@ -174,6 +175,11 @@ npm start
174175
npm run start:debug
175176
```
176177

178+
For the debug feature, also run:
179+
```bash
180+
npm run start:debugServer
181+
```
182+
177183
### History
178184

179185
This project was mainly created to make the implementation of [monaco-languageclient](https://github.com/TypeFox/monaco-languageclient) more robust and maintainable.

demo/src/style.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
font-weight: 400;
66

77
color-scheme: light dark;
8-
color: rgba(255, 255, 255, 0.87);
9-
background-color: #242424;
108

119
font-synthesis: none;
1210
text-rendering: optimizeLegibility;
@@ -15,6 +13,11 @@
1513
-webkit-text-size-adjust: 100%;
1614
}
1715

16+
body {
17+
background-color: var(--vscode-editorWidget-background);
18+
color: var(--vscode-editorWidget-foreground);
19+
}
20+
1821
.editor {
1922
width: 900px;
2023
height: 400px;

rollup/rollup.config.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ const PURE_FUNCTIONS = new Set([
5858

5959
// Function calls to remove when the result is not used
6060
const FUNCTIONS_TO_REMOVE = new Set([
61-
'registerColor',
6261
'colorRegistry.onDidChangeSchema',
6362
'registerSingleton', // Remove calls to registerSingleton from vscode code, we just want to import things, not registering services
6463
'registerProxyConfigurations',
@@ -94,6 +93,12 @@ const REMOVE_COMMANDS = new Set([
9493
'debug.openBreakpointToSide'
9594
])
9695

96+
const KEEP_COLORS = new Set([
97+
'notifications.background',
98+
'notification.foreground',
99+
'notificationToast.border'
100+
])
101+
97102
function isCallPure (functionName: string, args: recast.types.namedTypes.CallExpression['arguments']): boolean {
98103
if (functionName === 'KeybindingsRegistry.registerCommandAndKeybindingRule') {
99104
const firstParam = args[0]!
@@ -122,6 +127,15 @@ function isCallPure (functionName: string, args: recast.types.namedTypes.CallExp
122127
}
123128
}
124129

130+
if (functionName.endsWith('registerColor')) {
131+
const firstParam = args[0]!
132+
if (firstParam.type === 'StringLiteral') {
133+
if (KEEP_COLORS.has(firstParam.value)) {
134+
return false
135+
}
136+
}
137+
}
138+
125139
return PURE_OR_TO_REMOVE_FUNCTIONS.has(functionName)
126140
}
127141

0 commit comments

Comments
 (0)