lean4monaco 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editor.js +9 -1
- package/dist/leanmonaco.d.ts +1 -0
- package/dist/leanmonaco.js +24 -12
- package/package.json +1 -1
package/dist/editor.js
CHANGED
|
@@ -15,7 +15,15 @@ export class LeanMonacoEditor {
|
|
|
15
15
|
fs.writeFileSync(fileName, '');
|
|
16
16
|
// Create editor and model
|
|
17
17
|
this.modelRef = await createModelReference(Uri.parse(fileName), code);
|
|
18
|
-
this.editor = monaco.editor.create(editorEl, {
|
|
18
|
+
this.editor = monaco.editor.create(editorEl, {
|
|
19
|
+
automaticLayout: true,
|
|
20
|
+
// Note: looks like setting options here prevents them from being overwritten later.
|
|
21
|
+
// TODO: Looks like these options cannot be set in `updateVSCodeOptions` in `leanmonaco.ts`
|
|
22
|
+
// so we set them here
|
|
23
|
+
contextmenu: false, // the context menu breaks mobile support.
|
|
24
|
+
lineNumbersMinChars: 1, // minimal no. of characters for line numbers
|
|
25
|
+
lineDecorationsWidth: 5, // distance (px) between line number and code.
|
|
26
|
+
});
|
|
19
27
|
this.editor.setModel(this.modelRef.object.textEditorModel);
|
|
20
28
|
// Set focus on editor to trigger infoview to open
|
|
21
29
|
this.editor.focus();
|
package/dist/leanmonaco.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare class LeanMonaco {
|
|
|
38
38
|
infoviewEl: HTMLElement | undefined;
|
|
39
39
|
disposed: boolean;
|
|
40
40
|
start(options: LeanMonacoOptions): Promise<void>;
|
|
41
|
+
/** Update options of the editor */
|
|
41
42
|
updateVSCodeOptions(vsCodeOptions: {
|
|
42
43
|
[id: string]: any;
|
|
43
44
|
}): void;
|
package/dist/leanmonaco.js
CHANGED
|
@@ -96,7 +96,15 @@ export class LeanMonaco {
|
|
|
96
96
|
getElanDefaultToolchain: () => { return "lean4/stable"; }
|
|
97
97
|
}, { appendLine: () => { }
|
|
98
98
|
}, setupMonacoClient(this.getWebSocketOptions(options)), checkLean4ProjectPreconditions);
|
|
99
|
-
|
|
99
|
+
const asAbsolutePath = (path) => {
|
|
100
|
+
switch (path) {
|
|
101
|
+
case "media/progress-light.svg": return Uri.parse(`${new URL('vscode-lean4/vscode-lean4/media/progress-light.svg', import.meta.url)}`);
|
|
102
|
+
case "media/progress-dark.svg": return Uri.parse(`${new URL('vscode-lean4/vscode-lean4/media/progress-dark.svg', import.meta.url)}`);
|
|
103
|
+
case "media/progress-error-light.svg": return Uri.parse(`${new URL('vscode-lean4/vscode-lean4/media/progress-error-light.svg', import.meta.url)}`);
|
|
104
|
+
case "media/progress-error-dark.svg": return Uri.parse(`${new URL('vscode-lean4/vscode-lean4/media/progress-error-dark.svg', import.meta.url)}`);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
this.taskGutter = new LeanTaskGutter(this.clientProvider, { asAbsolutePath });
|
|
100
108
|
const fontFile = new FontFace("JuliaMono", `url(${new URL("./JuliaMono-Regular.ttf", import.meta.url)})`);
|
|
101
109
|
document.fonts.add(fontFile);
|
|
102
110
|
this.iframeWebviewFactory = new IFrameInfoWebviewFactory(themeService, configurationService, fontFile);
|
|
@@ -104,28 +112,32 @@ export class LeanMonaco {
|
|
|
104
112
|
this.iframeWebviewFactory.setInfoviewElement(this.infoviewEl);
|
|
105
113
|
this.infoProvider = new InfoProvider(this.clientProvider, { language: 'lean4' }, {}, this.iframeWebviewFactory);
|
|
106
114
|
await fontFile.load();
|
|
115
|
+
// Here we provide default options for the editor. They can be overwritten by the user.
|
|
107
116
|
this.updateVSCodeOptions({
|
|
108
|
-
//
|
|
117
|
+
// Layout options, trying to maximise the usable space of the code editor
|
|
118
|
+
"editor.lineNumbers": "on",
|
|
119
|
+
"editor.stickyScroll.enabled": false,
|
|
120
|
+
"editor.folding": false,
|
|
109
121
|
"editor.minimap.enabled": false,
|
|
110
|
-
|
|
111
|
-
"editor.
|
|
112
|
-
// "editor.lineNumbersMinChars": 1, // TODO: I believe this has no effect
|
|
113
|
-
"editor.glyphMargin": true,
|
|
114
|
-
// "editor.lineDecorationsWidth": 0,
|
|
115
|
-
// "editor.lineDecorationsWidth": 5,
|
|
116
|
-
"editor.detectIndentation": false,
|
|
117
|
-
"editor.lightbulb.enabled": "on",
|
|
122
|
+
// features useful for Lean
|
|
123
|
+
"editor.glyphMargin": true, // Shows the yellow/red task gutter on the left.
|
|
118
124
|
"editor.semanticHighlighting.enabled": true,
|
|
125
|
+
"editor.lightbulb.enabled": "on",
|
|
126
|
+
"editor.detectIndentation": false, // rather, indentation in Lean is always 2
|
|
127
|
+
"editor.acceptSuggestionOnEnter": "off", // since there are plenty suggestions
|
|
128
|
+
// other options
|
|
129
|
+
"editor.renderWhitespace": "trailing",
|
|
130
|
+
"editor.fontFamily": "JuliaMono",
|
|
119
131
|
"editor.wordWrap": "on",
|
|
120
132
|
"editor.wrappingStrategy": "advanced",
|
|
121
|
-
"
|
|
122
|
-
"editor.fontFamily": "JuliaMono",
|
|
133
|
+
"workbench.colorTheme": "Visual Studio Light",
|
|
123
134
|
...options.vscode
|
|
124
135
|
});
|
|
125
136
|
if (this.disposed)
|
|
126
137
|
return;
|
|
127
138
|
this.ready();
|
|
128
139
|
}
|
|
140
|
+
/** Update options of the editor */
|
|
129
141
|
updateVSCodeOptions(vsCodeOptions) {
|
|
130
142
|
for (const key in vsCodeOptions) {
|
|
131
143
|
workspace.getConfiguration().update(key, vsCodeOptions[key]);
|