@@ -17,6 +17,8 @@ import getModelServiceOverride from '@codingame/monaco-vscode-model-service-over
17
17
import { ExtensionHostKind , IExtensionManifest , registerExtension } from 'vscode/extensions'
18
18
import { DisposableStore } from 'vscode/monaco'
19
19
import packageJson from './vscode-lean4/vscode-lean4/package.json'
20
+ import { IConfiguration , IGrammar } from 'vscode/vscode/vs/platform/extensions/common/extensions'
21
+ import { ExtensionKind } from 'vscode/vscode/vs/platform/environment/common/environment'
20
22
21
23
/** Options for LeanMonaco.
22
24
*
@@ -37,7 +39,7 @@ export type LeanMonacoOptions = {
37
39
}
38
40
39
41
40
- export class LeanMonaco {
42
+ export class LeanMonaco {
41
43
private ready : ( value : void | PromiseLike < void > ) => void
42
44
whenReady = new Promise < void > ( ( resolve ) => {
43
45
this . ready = resolve
@@ -184,84 +186,50 @@ export class LeanMonaco {
184
186
return extensionFiles
185
187
}
186
188
189
+ /** This basically returns the `package.json` of `vscode-lean4` with some ts-fixes,
190
+ * some lean4monaco-specific default options for the editor, and the custom themes.
191
+ */
187
192
protected getExtensionManifest ( ) : IExtensionManifest {
188
193
return {
189
- name : 'lean4web' ,
190
- publisher : 'leanprover-community' ,
191
- version : '1.0.0' ,
192
- engines : {
193
- vscode : '*'
194
- } ,
195
- "contributes" : {
196
- "configuration" : packageJson . contributes . configuration as any ,
197
- "languages" : [
198
- {
199
- "id" : "lean4" ,
200
- "configuration" : "./language-configuration.json" ,
201
- "extensions" : [
202
- ".lean"
203
- ] ,
204
- } ,
205
- {
206
- "id" : "lean4markdown" ,
207
- "aliases" : [ ] ,
208
- "extensions" : [
209
- ".lean4markdown"
210
- ] ,
211
- "configuration" : "./language-configuration.json"
212
- }
213
- ] ,
214
- colors : packageJson . contributes . colors as any ,
215
- "grammars" : [
216
- {
217
- "language" : "lean4" ,
218
- "scopeName" : "source.lean4" ,
219
- "path" : "./syntaxes/lean4.json"
220
- } ,
221
- {
222
- "language" : "lean4markdown" ,
223
- "scopeName" : "source.lean4.markdown" ,
224
- "path" : "./syntaxes/lean4-markdown.json"
225
- } ,
194
+ ...packageJson ,
195
+ contributes : {
196
+ ...packageJson . contributes ,
197
+ configuration : packageJson . contributes . configuration as IConfiguration ,
198
+ // TODO: This is suspect, the thrid entry does not have "language", yet it doesn't complain
199
+ // look into that.
200
+ grammars : packageJson . contributes . grammars as IGrammar [ ] ,
201
+ // Somehow `submenu` is incompatible. Since we don't use that anyways we just drop
202
+ // `menus` and `submenus` from the package.json
203
+ menus : undefined ,
204
+ submenus : undefined ,
205
+ configurationDefaults : {
206
+ ...packageJson . contributes . configurationDefaults ,
207
+ // Tweak the default VSCode settings here.
208
+ "editor.minimap.enabled" : false ,
209
+ // "editor.folding": false,
210
+ // "editor.lineNumbers": 'on',
211
+ // "editor.lineNumbersMinChars": 1,
212
+ "editor.glyphMargin" : true ,
213
+ // "editor.lineDecorationsWidth": 5,
214
+ // "editor.detectIndentation": false,
215
+ "editor.lightbulb.enabled" : "on" ,
216
+ "editor.semanticHighlighting.enabled" : true ,
217
+ "editor.wordWrap" : "on" ,
218
+ "editor.wrappingStrategy" : "advanced" ,
219
+ "editor.acceptSuggestionOnEnter" : "off" ,
220
+ "editor.fontFamily" : "JuliaMono" ,
221
+ } ,
222
+ // Add custom themes here.
223
+ themes : [
226
224
{
227
- "language" : "lean4" ,
228
- "scopeName" : "markdown.lean4.codeblock" ,
229
- "path" : "./syntaxes/codeblock.json" ,
230
- "injectTo" : [
231
- "text.html.markdown"
232
- ] ,
233
- "embeddedLanguages" : {
234
- "meta.embedded.block.lean4" : "lean4"
235
- }
225
+ "id" : "Cobalt" ,
226
+ "label" : "Cobalt" ,
227
+ "uiTheme" : "vs" ,
228
+ "path" : "./themes/cobalt2.json"
236
229
}
237
230
] ,
238
- "configurationDefaults" : {
239
- "editor.folding" : false ,
240
- "editor.wordSeparators" : "`~@$%^&*()-=+[{]}⟨⟩⦃⦄⟦⟧⟮⟯‹›\\|;:\",.<>/" ,
241
- "editor.lineNumbers" : 'on' ,
242
- "editor.lineNumbersMinChars" : 1 ,
243
- "editor.glyphMargin" : true ,
244
- "editor.lineDecorationsWidth" : 5 ,
245
- "editor.tabSize" : 2 ,
246
- "editor.detectIndentation" : false ,
247
- "editor.lightbulb.enabled" : "on" ,
248
- "editor.unicodeHighlight.ambiguousCharacters" : false ,
249
- "editor.minimap.enabled" : false ,
250
- "editor.semanticHighlighting.enabled" : true ,
251
- "editor.wordWrap" : "off" ,
252
- "editor.acceptSuggestionOnEnter" : "off" ,
253
- "editor.fontFamily" : "JuliaMono" ,
254
- "editor.wrappingStrategy" : "advanced" ,
255
- } ,
256
- "themes" : [
257
- {
258
- "id" : "Cobalt" ,
259
- "label" : "Cobalt" ,
260
- "uiTheme" : "vs" ,
261
- "path" : "./themes/cobalt2.json"
262
- }
263
- ] ,
264
231
} ,
232
+ extensionKind : packageJson . extensionKind as ExtensionKind [ ] ,
265
233
}
266
234
}
267
235
0 commit comments