lean4monaco 1.0.5 → 1.0.7
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/README.md +29 -0
- package/dist/JuliaMono-Regular.ttf +0 -0
- package/dist/editor.js +27 -1
- package/dist/webview.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -76,4 +76,33 @@ export default {
|
|
|
76
76
|
},
|
|
77
77
|
[...]
|
|
78
78
|
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Moreover, the infoview javascript files need to be served:
|
|
82
|
+
```ts
|
|
83
|
+
// vite.config.ts
|
|
84
|
+
import { viteStaticCopy } from 'vite-plugin-static-copy'
|
|
85
|
+
import { normalizePath } from 'vite'
|
|
86
|
+
import path from 'node:path'
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
plugins: [
|
|
90
|
+
viteStaticCopy({
|
|
91
|
+
targets: [
|
|
92
|
+
{
|
|
93
|
+
src: normalizePath(path.resolve(__dirname, './node_modules/@leanprover/infoview/dist/*.production.min.js')),
|
|
94
|
+
dest: 'infoview'
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Troubleshooting
|
|
103
|
+
|
|
104
|
+
* Make sure that only one version of the npm package `monaco-vscode-api` is installed.
|
|
105
|
+
The error I typically got is:
|
|
106
|
+
```
|
|
107
|
+
this._configurationService.onDidChangeConfiguration is not a function
|
|
79
108
|
```
|
|
Binary file
|
package/dist/editor.js
CHANGED
|
@@ -15,11 +15,37 @@ export class LeanMonacoEditor {
|
|
|
15
15
|
fs.writeFileSync(fileName, '');
|
|
16
16
|
// Create editor and model
|
|
17
17
|
const theme = "Visual Studio Light"; //"Visual Studio Dark" //"Default Light Modern" //"Default Light+" //"Default Dark+" //"Default High Contrast"
|
|
18
|
-
this.editor = monaco.editor.create(editorEl, {
|
|
18
|
+
this.editor = monaco.editor.create(editorEl, {
|
|
19
|
+
theme,
|
|
20
|
+
glyphMargin: true,
|
|
21
|
+
lineDecorationsWidth: 5,
|
|
22
|
+
folding: false,
|
|
23
|
+
lineNumbers: 'on',
|
|
24
|
+
lineNumbersMinChars: 1,
|
|
25
|
+
// lightbulb: {
|
|
26
|
+
// enabled: true
|
|
27
|
+
// },
|
|
28
|
+
unicodeHighlight: {
|
|
29
|
+
ambiguousCharacters: false,
|
|
30
|
+
},
|
|
31
|
+
automaticLayout: true,
|
|
32
|
+
minimap: {
|
|
33
|
+
enabled: false
|
|
34
|
+
},
|
|
35
|
+
tabSize: 2,
|
|
36
|
+
'semanticHighlighting.enabled': true,
|
|
37
|
+
// wordWrap: config.wordWrap ? "on" : "off",
|
|
38
|
+
// acceptSuggestionOnEnter: config.acceptSuggestionOnEnter ? "on" : "off",
|
|
39
|
+
fontFamily: "JuliaMono",
|
|
40
|
+
wrappingStrategy: "advanced",
|
|
41
|
+
});
|
|
19
42
|
this.modelRef = await createModelReference(Uri.parse(fileName), code);
|
|
20
43
|
this.editor.setModel(this.modelRef.object.textEditorModel);
|
|
21
44
|
// Set focus on editor to trigger infoview to open
|
|
22
45
|
this.editor.focus();
|
|
46
|
+
const fontFile = new FontFace("JuliaMono", `url(${new URL("./JuliaMono-Regular.ttf", import.meta.url)})`);
|
|
47
|
+
document.fonts.add(fontFile);
|
|
48
|
+
fontFile.load();
|
|
23
49
|
}
|
|
24
50
|
dispose() {
|
|
25
51
|
if (this.modelRef)
|
package/dist/webview.js
CHANGED
|
@@ -7,10 +7,10 @@ const editorApi = rpc.getApi();
|
|
|
7
7
|
const div = document.querySelector('#react_root');
|
|
8
8
|
if (div) {
|
|
9
9
|
const imports = {
|
|
10
|
-
'@leanprover/infoview': '
|
|
11
|
-
'react': '
|
|
12
|
-
'react/jsx-runtime': '
|
|
13
|
-
'react-dom': '
|
|
10
|
+
'@leanprover/infoview': '/infoview/index.production.min.js',
|
|
11
|
+
'react': '/infoview/react.production.min.js',
|
|
12
|
+
'react/jsx-runtime': '/infoview/react-jsx-runtime.production.min.js',
|
|
13
|
+
'react-dom': '/infoview/react-dom.production.min.js',
|
|
14
14
|
};
|
|
15
15
|
console.log(imports);
|
|
16
16
|
loadRenderInfoview(imports, [editorApi, div], api => rpc.register(api));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lean4monaco",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build_server": "cd server/LeanProject && lake build",
|
|
13
13
|
"start_server": "cd server && npm start",
|
|
14
14
|
"start": "concurrently \"npm run start_client\" \"npm run start_server\" -n client,server -c \"bgBlue.bold,bgMagenta.bold\"",
|
|
15
|
-
"build": "tsc && cd src && copyfiles \"**/*.json\" \"**/*.css\" ../dist/",
|
|
15
|
+
"build": "tsc && cd src && copyfiles \"**/*.json\" \"**/*.css\" \"**/*.ttf\" ../dist/",
|
|
16
16
|
"test": "concurrently --kill-others \"cd demo && npm install && npm start\" \"wait-on http://localhost:5173 && cypress run\" -n server,cypress -s command-cypress"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"typescript": "^5.4.5",
|
|
28
28
|
"vite": "^5.2.0",
|
|
29
29
|
"vite-plugin-node-polyfills": "^0.22.0",
|
|
30
|
+
"vite-plugin-static-copy": "^1.0.6",
|
|
30
31
|
"wait-on": "^7.2.0"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@codingame/monaco-vscode-views-service-override": "^6.0.1",
|
|
34
34
|
"@leanprover/infoview": "=0.7.0",
|
|
35
35
|
"@leanprover/infoview-api": "^0.4.0",
|
|
36
36
|
"@leanprover/unicode-input": "^0.1.0",
|