lean4monaco 1.0.46 → 1.1.0
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 +75 -0
- package/dist/JuliaMono-Regular.ttf +0 -0
- package/dist/css/custom.css +7 -1
- package/dist/infowebview.d.ts +3 -4
- package/dist/infowebview.js +4 -4
- package/dist/lean4-infoview/codicon.ttf +0 -0
- package/dist/lean4-infoview/esm-shims/react-dom.d.ts +5 -0
- package/dist/lean4-infoview/esm-shims/react-jsx-runtime.d.ts +5 -0
- package/dist/lean4-infoview/esm-shims/react.d.ts +5 -0
- package/dist/lean4-infoview/index.css +4161 -0
- package/dist/lean4-infoview/index.d.ts +16 -0
- package/dist/lean4-infoview/index.development.js +37312 -0
- package/dist/lean4-infoview/index.production.min.js +1528 -0
- package/dist/lean4-infoview/infoview/collapsing.d.ts +12 -0
- package/dist/lean4-infoview/infoview/contexts.d.ts +10 -0
- package/dist/lean4-infoview/infoview/editorConnection.d.ts +22 -0
- package/dist/lean4-infoview/infoview/errors.d.ts +14 -0
- package/dist/lean4-infoview/infoview/event.d.ts +33 -0
- package/dist/lean4-infoview/infoview/goalLocation.d.ts +61 -0
- package/dist/lean4-infoview/infoview/goals.d.ts +46 -0
- package/dist/lean4-infoview/infoview/info.d.ts +18 -0
- package/dist/lean4-infoview/infoview/infos.d.ts +2 -0
- package/dist/lean4-infoview/infoview/interactiveCode.d.ts +19 -0
- package/dist/lean4-infoview/infoview/main.d.ts +13 -0
- package/dist/lean4-infoview/infoview/messages.d.ts +19 -0
- package/dist/lean4-infoview/infoview/rpcSessions.d.ts +11 -0
- package/dist/lean4-infoview/infoview/serverVersion.d.ts +10 -0
- package/dist/lean4-infoview/infoview/tooltips.d.ts +32 -0
- package/dist/lean4-infoview/infoview/traceExplorer.d.ts +11 -0
- package/dist/lean4-infoview/infoview/userWidget.d.ts +39 -0
- package/dist/lean4-infoview/infoview/util.d.ts +144 -0
- package/dist/lean4-infoview/loader.d.ts +20 -0
- package/dist/lean4-infoview/loader.development.js +1006 -0
- package/dist/lean4-infoview/loader.production.min.js +1 -0
- package/dist/lean4-infoview/react-dom.development.js +30537 -0
- package/dist/lean4-infoview/react-dom.production.min.js +21 -0
- package/dist/lean4-infoview/react-jsx-runtime.development.js +1362 -0
- package/dist/lean4-infoview/react-jsx-runtime.production.min.js +1 -0
- package/dist/lean4-infoview/react.development.js +2823 -0
- package/dist/lean4-infoview/react.production.min.js +1 -0
- package/dist/leanmonaco.js +5 -4
- package/dist/monaco-lean4/vscode-lean4/package.json +944 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.d.ts +9 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.js +20 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.d.ts +12 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.js +40 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.d.ts +20 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.js +79 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.d.ts +13 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.js +29 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.d.ts +28 -0
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.js +124 -0
- package/dist/monaco-lean4/vscode-lean4/src/config.d.ts +33 -0
- package/dist/monaco-lean4/vscode-lean4/src/config.js +119 -0
- package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.d.ts +27 -0
- package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.js +133 -0
- package/dist/monaco-lean4/vscode-lean4/src/infoview.d.ts +69 -0
- package/dist/monaco-lean4/vscode-lean4/src/infoview.js +711 -0
- package/dist/monaco-lean4/vscode-lean4/src/leanclient.d.ts +67 -0
- package/dist/monaco-lean4/vscode-lean4/src/leanclient.js +443 -0
- package/dist/monaco-lean4/vscode-lean4/src/rpc.d.ts +16 -0
- package/dist/monaco-lean4/vscode-lean4/src/rpc.js +102 -0
- package/dist/monaco-lean4/vscode-lean4/src/taskgutter.d.ts +11 -0
- package/dist/monaco-lean4/vscode-lean4/src/taskgutter.js +130 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/batch.d.ts +37 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/batch.js +203 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.d.ts +41 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.js +205 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/converters.d.ts +16 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/converters.js +129 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/elan.d.ts +3 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/elan.js +4 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.d.ts +21 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.js +53 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.d.ts +35 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.js +136 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.d.ts +17 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.js +36 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.d.ts +37 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.js +210 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/logger.d.ts +7 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/logger.js +20 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.d.ts +24 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.js +110 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.d.ts +9 -0
- package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.js +125 -0
- package/dist/monacoleanclient.d.ts +1 -2
- package/dist/monacoleanclient.js +3 -3
- package/dist/vscode-lean4/lean4-infoview/package.json +25 -23
- package/dist/vscode-lean4/lean4-infoview/src/infoview/highlightjs.css +210 -0
- package/dist/vscode-lean4/lean4-infoview/tsconfig.json +6 -2
- package/dist/vscode-lean4/lean4-infoview-api/package.json +1 -1
- package/dist/vscode-lean4/lean4-unicode-input/package.json +1 -1
- package/dist/vscode-lean4/lean4-unicode-input/src/abbreviations.json +12 -12
- package/dist/vscode-lean4/lean4-unicode-input-component/package.json +2 -2
- package/dist/vscode-lean4/package-lock.json +6129 -3245
- package/dist/vscode-lean4/vscode-lean4/language-configuration.json +1 -1
- package/dist/vscode-lean4/vscode-lean4/loogleview/static/index.css +19 -16
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-dark.svg +91 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-dark.svg +114 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-light.svg +114 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-passthrough-dark.svg +109 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-i-passthrough-light.svg +109 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-init-dark.svg +100 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-init-light.svg +100 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-dark.svg +123 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-light.svg +123 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-passthrough-dark.svg +109 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-l-passthrough-light.svg +109 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-light.svg +91 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-dark.svg +123 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-light.svg +123 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-passthrough-dark.svg +118 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/error-t-passthrough-light.svg +118 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-dark.svg +138 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-i-passthrough-dark.svg +160 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-i-passthrough-light.svg +160 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-l-passthrough-dark.svg +158 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-l-passthrough-light.svg +158 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-light.svg +138 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-t-passthrough-dark.svg +169 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-checkmark-t-passthrough-light.svg +169 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-dark.svg +147 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-i-passthrough-dark.svg +170 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-i-passthrough-light.svg +170 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-l-passthrough-dark.svg +167 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-l-passthrough-light.svg +167 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-light.svg +147 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-t-passthrough-dark.svg +179 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-circled-checkmark-t-passthrough-light.svg +179 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-dark.svg +165 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-i-passthrough-dark.svg +187 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-i-passthrough-light.svg +187 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-l-passthrough-dark.svg +185 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-l-passthrough-light.svg +185 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-light.svg +165 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-t-passthrough-dark.svg +196 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-octopus-t-passthrough-light.svg +196 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-dark.svg +184 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-i-passthrough-dark.svg +206 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-i-passthrough-light.svg +206 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-l-passthrough-dark.svg +204 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-l-passthrough-light.svg +204 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-light.svg +184 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-t-passthrough-dark.svg +215 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/goals-accomplished-tada-t-passthrough-light.svg +215 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-dark.svg +132 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-i-passthrough-dark.svg +154 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-i-passthrough-light.svg +154 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-l-passthrough-dark.svg +152 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-l-passthrough-light.svg +152 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-light.svg +132 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-t-passthrough-dark.svg +163 -0
- package/dist/vscode-lean4/vscode-lean4/media/diagnostic-gutter-icons/warning-t-passthrough-light.svg +163 -0
- package/dist/vscode-lean4/vscode-lean4/moogleview/static/index.css +198 -0
- package/dist/vscode-lean4/vscode-lean4/moogleview/tsconfig.json +10 -0
- package/dist/vscode-lean4/vscode-lean4/package.json +638 -18
- package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.d.ts +2 -2
- package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.js +2 -2
- package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.d.ts +2 -3
- package/dist/vscode-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.js +3 -5
- package/dist/vscode-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.d.ts +1 -2
- package/dist/vscode-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.js +4 -8
- package/dist/vscode-lean4/vscode-lean4/src/config.d.ts +14 -1
- package/dist/vscode-lean4/vscode-lean4/src/config.js +56 -5
- package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnoser.d.ts +36 -5
- package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnoser.js +59 -23
- package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnostics.d.ts +22 -17
- package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupDiagnostics.js +182 -119
- package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupNotifs.d.ts +33 -20
- package/dist/vscode-lean4/vscode-lean4/src/diagnostics/setupNotifs.js +235 -89
- package/dist/vscode-lean4/vscode-lean4/src/infoview.d.ts +7 -18
- package/dist/vscode-lean4/vscode-lean4/src/infoview.js +217 -102
- package/dist/vscode-lean4/vscode-lean4/src/leanclient.d.ts +12 -7
- package/dist/vscode-lean4/vscode-lean4/src/leanclient.js +187 -64
- package/dist/vscode-lean4/vscode-lean4/src/taskgutter.d.ts +35 -3
- package/dist/vscode-lean4/vscode-lean4/src/taskgutter.js +533 -93
- package/dist/vscode-lean4/vscode-lean4/src/utils/batch.d.ts +12 -4
- package/dist/vscode-lean4/vscode-lean4/src/utils/batch.js +78 -72
- package/dist/vscode-lean4/vscode-lean4/src/utils/clientProvider.d.ts +9 -9
- package/dist/vscode-lean4/vscode-lean4/src/utils/clientProvider.js +121 -77
- package/dist/vscode-lean4/vscode-lean4/src/utils/converters.d.ts +15 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/converters.js +9 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/elan.d.ts +179 -1
- package/dist/vscode-lean4/vscode-lean4/src/utils/elan.js +422 -3
- package/dist/vscode-lean4/vscode-lean4/src/utils/exturi.d.ts +3 -1
- package/dist/vscode-lean4/vscode-lean4/src/utils/exturi.js +11 -11
- package/dist/vscode-lean4/vscode-lean4/src/utils/groupBy.d.ts +2 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/groupBy.js +17 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/internalErrors.d.ts +2 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/internalErrors.js +35 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/leanCmdRunner.d.ts +34 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/leanCmdRunner.js +249 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/leanEditorProvider.d.ts +83 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/leanEditorProvider.js +323 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/leanInstaller.d.ts +41 -12
- package/dist/vscode-lean4/vscode-lean4/src/utils/leanInstaller.js +245 -128
- package/dist/vscode-lean4/vscode-lean4/src/utils/notifs.d.ts +27 -22
- package/dist/vscode-lean4/vscode-lean4/src/utils/notifs.js +177 -82
- package/dist/vscode-lean4/vscode-lean4/src/utils/projectInfo.d.ts +11 -4
- package/dist/vscode-lean4/vscode-lean4/src/utils/projectInfo.js +18 -16
- package/dist/vscode-lean4/vscode-lean4/src/utils/semverRegex.d.ts +1 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/semverRegex.js +2 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/viewColumn.d.ts +3 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/viewColumn.js +22 -0
- package/dist/vscode-lean4/vscode-lean4/tsconfig.json +2 -1
- package/dist/vscode-lean4/vscode-lean4/webview/tsconfig.json +3 -1
- package/dist/vscode.css +7 -0
- package/package.json +7 -5
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { commands, EventEmitter, window, workspace, } from 'vscode';
|
|
2
|
+
import { isExtUri, toExtUriOrError } from './exturi';
|
|
3
|
+
import { groupByKey, groupByUniqueKey } from './groupBy';
|
|
4
|
+
export class LeanDocument {
|
|
5
|
+
doc;
|
|
6
|
+
extUri;
|
|
7
|
+
constructor(doc, extUri) {
|
|
8
|
+
this.doc = doc;
|
|
9
|
+
this.extUri = extUri;
|
|
10
|
+
}
|
|
11
|
+
equals(other) {
|
|
12
|
+
return this.doc === other.doc;
|
|
13
|
+
}
|
|
14
|
+
equalsTextDocument(other) {
|
|
15
|
+
return this.doc === other;
|
|
16
|
+
}
|
|
17
|
+
static equalsWithUndefined(a, b) {
|
|
18
|
+
if (a === undefined) {
|
|
19
|
+
return b === undefined;
|
|
20
|
+
}
|
|
21
|
+
if (b === undefined) {
|
|
22
|
+
return a === undefined;
|
|
23
|
+
}
|
|
24
|
+
return a.equals(b);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class LeanEditor {
|
|
28
|
+
editor;
|
|
29
|
+
documentExtUri;
|
|
30
|
+
constructor(editor, documentExtUri) {
|
|
31
|
+
this.editor = editor;
|
|
32
|
+
this.documentExtUri = documentExtUri;
|
|
33
|
+
}
|
|
34
|
+
equals(other) {
|
|
35
|
+
return this.editor === other.editor;
|
|
36
|
+
}
|
|
37
|
+
equalsTextEditor(other) {
|
|
38
|
+
return this.editor === other;
|
|
39
|
+
}
|
|
40
|
+
static equalsWithUndefined(a, b) {
|
|
41
|
+
if (a === undefined) {
|
|
42
|
+
return b === undefined;
|
|
43
|
+
}
|
|
44
|
+
if (b === undefined) {
|
|
45
|
+
return a === undefined;
|
|
46
|
+
}
|
|
47
|
+
return a.equals(b);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class LeanDocumentIndex {
|
|
51
|
+
docsByUri;
|
|
52
|
+
/**
|
|
53
|
+
* Assumes that `docs` only contains at most one `LeanDocument` per URI.
|
|
54
|
+
* This is given for `TextDocument`s from VS Code.
|
|
55
|
+
* */
|
|
56
|
+
constructor(docs) {
|
|
57
|
+
this.docsByUri = groupByUniqueKey(docs, doc => doc.extUri.toString());
|
|
58
|
+
}
|
|
59
|
+
get(uri) {
|
|
60
|
+
return this.docsByUri.get(uri.toString());
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class LeanEditorIndex {
|
|
64
|
+
editorsByUri;
|
|
65
|
+
constructor(editors) {
|
|
66
|
+
this.editorsByUri = groupByKey(editors, editor => editor.documentExtUri.toString());
|
|
67
|
+
}
|
|
68
|
+
get(uri) {
|
|
69
|
+
return this.editorsByUri.get(uri.toString());
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export function isLeanDocument(doc) {
|
|
73
|
+
return isExtUri(doc.uri) && doc.languageId === 'lean4';
|
|
74
|
+
}
|
|
75
|
+
export function asLeanDocument(doc) {
|
|
76
|
+
if (isLeanDocument(doc)) {
|
|
77
|
+
return new LeanDocument(doc, toExtUriOrError(doc.uri));
|
|
78
|
+
}
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
export function filterLeanDocuments(docs) {
|
|
82
|
+
return docs.map(doc => asLeanDocument(doc)).filter(doc => doc !== undefined);
|
|
83
|
+
}
|
|
84
|
+
export function filterLeanDocument(doc) {
|
|
85
|
+
if (doc === undefined) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
return asLeanDocument(doc);
|
|
89
|
+
}
|
|
90
|
+
export function isLeanEditor(editor) {
|
|
91
|
+
return isLeanDocument(editor.document);
|
|
92
|
+
}
|
|
93
|
+
export function asLeanEditor(editor) {
|
|
94
|
+
if (isLeanEditor(editor)) {
|
|
95
|
+
return new LeanEditor(editor, toExtUriOrError(editor.document.uri));
|
|
96
|
+
}
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
export function filterLeanEditors(editors) {
|
|
100
|
+
return editors.map(editor => asLeanEditor(editor)).filter(editor => editor !== undefined);
|
|
101
|
+
}
|
|
102
|
+
export function filterLeanEditor(editor) {
|
|
103
|
+
if (editor === undefined) {
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
return asLeanEditor(editor);
|
|
107
|
+
}
|
|
108
|
+
export class LeanEditorProvider {
|
|
109
|
+
subscriptions = [];
|
|
110
|
+
_visibleLeanEditors;
|
|
111
|
+
visibleLeanEditorsByUri;
|
|
112
|
+
onDidChangeVisibleLeanEditorsEmitter = new EventEmitter();
|
|
113
|
+
onDidChangeVisibleLeanEditors = this.onDidChangeVisibleLeanEditorsEmitter.event;
|
|
114
|
+
_activeLeanEditor;
|
|
115
|
+
onDidChangeActiveLeanEditorEmitter = new EventEmitter();
|
|
116
|
+
onDidChangeActiveLeanEditor = this.onDidChangeActiveLeanEditorEmitter.event;
|
|
117
|
+
_lastActiveLeanEditor;
|
|
118
|
+
onDidChangeLastActiveLeanEditorEmitter = new EventEmitter();
|
|
119
|
+
onDidChangeLastActiveLeanEditor = this.onDidChangeLastActiveLeanEditorEmitter.event;
|
|
120
|
+
_leanDocuments;
|
|
121
|
+
leanDocumentsByUri;
|
|
122
|
+
onDidChangeLeanDocumentsEmitter = new EventEmitter();
|
|
123
|
+
onDidChangeLeanDocuments = this.onDidChangeLeanDocumentsEmitter.event;
|
|
124
|
+
onDidOpenLeanDocumentEmitter = new EventEmitter();
|
|
125
|
+
onDidOpenLeanDocument = this.onDidOpenLeanDocumentEmitter.event;
|
|
126
|
+
onDidCloseLeanDocumentEmitter = new EventEmitter();
|
|
127
|
+
onDidCloseLeanDocument = this.onDidCloseLeanDocumentEmitter.event;
|
|
128
|
+
_lastActiveLeanDocument;
|
|
129
|
+
onDidChangeLastActiveLeanDocumentEmitter = new EventEmitter();
|
|
130
|
+
onDidChangeLastActiveLeanDocument = this.onDidChangeLastActiveLeanDocumentEmitter.event;
|
|
131
|
+
onDidRevealLeanEditorEmitter = new EventEmitter();
|
|
132
|
+
onDidRevealLeanEditor = this.onDidRevealLeanEditorEmitter.event;
|
|
133
|
+
onDidConcealLeanEditorEmitter = new EventEmitter();
|
|
134
|
+
onDidConcealLeanEditor = this.onDidConcealLeanEditorEmitter.event;
|
|
135
|
+
onDidChangeLeanEditorSelectionEmitter = new EventEmitter();
|
|
136
|
+
onDidChangeLeanEditorSelection = this.onDidChangeLeanEditorSelectionEmitter.event;
|
|
137
|
+
constructor() {
|
|
138
|
+
this._visibleLeanEditors = filterLeanEditors(window.visibleTextEditors);
|
|
139
|
+
this.visibleLeanEditorsByUri = new LeanEditorIndex(this._visibleLeanEditors);
|
|
140
|
+
this.subscriptions.push(window.onDidChangeVisibleTextEditors(editors => this.updateVisibleTextEditors(editors)));
|
|
141
|
+
this._activeLeanEditor = filterLeanEditor(window.activeTextEditor);
|
|
142
|
+
this.subscriptions.push(window.onDidChangeActiveTextEditor(editor => this.updateActiveTextEditor(editor)));
|
|
143
|
+
this._leanDocuments = filterLeanDocuments(workspace.textDocuments);
|
|
144
|
+
this.leanDocumentsByUri = new LeanDocumentIndex(this._leanDocuments);
|
|
145
|
+
this.subscriptions.push(workspace.onDidOpenTextDocument(doc => {
|
|
146
|
+
this.updateLeanDocuments(workspace.textDocuments);
|
|
147
|
+
this.openLeanDocument(doc);
|
|
148
|
+
// Update visible and active editors in case this `onDidOpenTextDocument` call was
|
|
149
|
+
// triggered by a changed language ID.
|
|
150
|
+
this.updateVisibleTextEditors(window.visibleTextEditors);
|
|
151
|
+
this.updateActiveTextEditor(window.activeTextEditor);
|
|
152
|
+
}));
|
|
153
|
+
this.subscriptions.push(workspace.onDidCloseTextDocument(doc => {
|
|
154
|
+
// Update visible and active editors in case this `onDidCloseTextDocument` call was
|
|
155
|
+
// triggered by a changed language ID.
|
|
156
|
+
this.updateVisibleTextEditors(window.visibleTextEditors);
|
|
157
|
+
this.updateActiveTextEditor(window.activeTextEditor);
|
|
158
|
+
this.updateLeanDocuments(workspace.textDocuments);
|
|
159
|
+
this.closeLeanDocument(doc);
|
|
160
|
+
this.invalidateClosedLastActiveLeanDocument(doc);
|
|
161
|
+
}));
|
|
162
|
+
this.subscriptions.push(window.onDidChangeTextEditorSelection(event => this.updateTextEditorSelection(event)));
|
|
163
|
+
}
|
|
164
|
+
updateVisibleTextEditors(visibleTextEditors) {
|
|
165
|
+
const oldVisibleLeanEditors = [...this._visibleLeanEditors];
|
|
166
|
+
this.updateVisibleLeanEditors(visibleTextEditors);
|
|
167
|
+
this.invalidateInvisibleLastActiveLeanEditor(visibleTextEditors);
|
|
168
|
+
this.revealLeanEditors(oldVisibleLeanEditors, visibleTextEditors);
|
|
169
|
+
this.concealLeanEditors(oldVisibleLeanEditors, visibleTextEditors);
|
|
170
|
+
}
|
|
171
|
+
updateActiveTextEditor(activeTextEditor) {
|
|
172
|
+
this.updateActiveLeanEditor(activeTextEditor);
|
|
173
|
+
this.updateLastActiveLeanEditor(activeTextEditor);
|
|
174
|
+
this.updateLastActiveLeanDocument(activeTextEditor);
|
|
175
|
+
}
|
|
176
|
+
updateVisibleLeanEditors(visibleTextEditors) {
|
|
177
|
+
const newVisibleLeanEditors = filterLeanEditors(visibleTextEditors);
|
|
178
|
+
if (newVisibleLeanEditors.length === this._visibleLeanEditors.length &&
|
|
179
|
+
newVisibleLeanEditors.every((newVisibleLeanEditor, i) => newVisibleLeanEditor.equals(this._visibleLeanEditors[i]))) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
this._visibleLeanEditors = newVisibleLeanEditors;
|
|
183
|
+
this.visibleLeanEditorsByUri = new LeanEditorIndex(newVisibleLeanEditors);
|
|
184
|
+
this.onDidChangeVisibleLeanEditorsEmitter.fire(newVisibleLeanEditors);
|
|
185
|
+
}
|
|
186
|
+
revealLeanEditors(oldVisibleLeanEditors, newVisibleTextEditors) {
|
|
187
|
+
const oldVisibleLeanEditorsIndex = new Set(oldVisibleLeanEditors.map(leanEditor => leanEditor.editor));
|
|
188
|
+
const newVisibleLeanEditors = filterLeanEditors(newVisibleTextEditors);
|
|
189
|
+
const revealedLeanEditors = newVisibleLeanEditors.filter(newVisibleLeanEditor => !oldVisibleLeanEditorsIndex.has(newVisibleLeanEditor.editor));
|
|
190
|
+
for (const revealedLeanEditor of revealedLeanEditors) {
|
|
191
|
+
this.onDidRevealLeanEditorEmitter.fire(revealedLeanEditor);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
concealLeanEditors(oldVisibleLeanEditors, newVisibleTextEditors) {
|
|
195
|
+
const newVisibleLeanEditors = filterLeanEditors(newVisibleTextEditors);
|
|
196
|
+
const newVisibleLeanEditorsIndex = new Set(newVisibleLeanEditors.map(leanEditor => leanEditor.editor));
|
|
197
|
+
const concealedLeanEditors = oldVisibleLeanEditors.filter(newVisibleLeanEditor => !newVisibleLeanEditorsIndex.has(newVisibleLeanEditor.editor));
|
|
198
|
+
for (const concealedLeanEditor of concealedLeanEditors) {
|
|
199
|
+
this.onDidConcealLeanEditorEmitter.fire(concealedLeanEditor);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
updateActiveLeanEditor(activeTextEditor) {
|
|
203
|
+
const newActiveLeanEditor = filterLeanEditor(activeTextEditor);
|
|
204
|
+
if (LeanEditor.equalsWithUndefined(newActiveLeanEditor, this._activeLeanEditor)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
this._activeLeanEditor = newActiveLeanEditor;
|
|
208
|
+
this.onDidChangeActiveLeanEditorEmitter.fire(newActiveLeanEditor);
|
|
209
|
+
}
|
|
210
|
+
invalidateInvisibleLastActiveLeanEditor(visibleTextEditors) {
|
|
211
|
+
if (this._lastActiveLeanEditor !== undefined &&
|
|
212
|
+
!visibleTextEditors.includes(this._lastActiveLeanEditor.editor)) {
|
|
213
|
+
this._lastActiveLeanEditor = undefined;
|
|
214
|
+
this.onDidChangeLastActiveLeanEditorEmitter.fire(undefined);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
updateLastActiveLeanEditor(activeTextEditor) {
|
|
218
|
+
const newLastActiveLeanEditor = filterLeanEditor(activeTextEditor);
|
|
219
|
+
if (newLastActiveLeanEditor === undefined) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (LeanEditor.equalsWithUndefined(newLastActiveLeanEditor, this._lastActiveLeanEditor)) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this._lastActiveLeanEditor = newLastActiveLeanEditor;
|
|
226
|
+
this.onDidChangeLastActiveLeanEditorEmitter.fire(newLastActiveLeanEditor);
|
|
227
|
+
}
|
|
228
|
+
updateLeanDocuments(textDocuments) {
|
|
229
|
+
const newLeanDocuments = filterLeanDocuments(textDocuments);
|
|
230
|
+
if (newLeanDocuments.length === this._leanDocuments.length &&
|
|
231
|
+
newLeanDocuments.every((newLeanDocument, i) => newLeanDocument.equals(this._leanDocuments[i]))) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
this._leanDocuments = newLeanDocuments;
|
|
235
|
+
this.leanDocumentsByUri = new LeanDocumentIndex(newLeanDocuments);
|
|
236
|
+
this.onDidChangeLeanDocumentsEmitter.fire(newLeanDocuments);
|
|
237
|
+
}
|
|
238
|
+
openLeanDocument(textDocument) {
|
|
239
|
+
const leanTextDocument = filterLeanDocument(textDocument);
|
|
240
|
+
if (leanTextDocument === undefined) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.onDidOpenLeanDocumentEmitter.fire(leanTextDocument);
|
|
244
|
+
}
|
|
245
|
+
closeLeanDocument(textDocument) {
|
|
246
|
+
const leanTextDocument = filterLeanDocument(textDocument);
|
|
247
|
+
if (leanTextDocument === undefined) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
this.onDidCloseLeanDocumentEmitter.fire(leanTextDocument);
|
|
251
|
+
}
|
|
252
|
+
invalidateClosedLastActiveLeanDocument(closedTextDocument) {
|
|
253
|
+
if (this._lastActiveLeanDocument?.doc === closedTextDocument) {
|
|
254
|
+
this._lastActiveLeanDocument = undefined;
|
|
255
|
+
this.onDidChangeLastActiveLeanDocumentEmitter.fire(undefined);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
updateLastActiveLeanDocument(activeTextEditor) {
|
|
259
|
+
const newLastActiveLeanDocument = filterLeanDocument(activeTextEditor?.document);
|
|
260
|
+
if (newLastActiveLeanDocument === undefined) {
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
if (LeanDocument.equalsWithUndefined(newLastActiveLeanDocument, this._lastActiveLeanDocument)) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
this._lastActiveLeanDocument = newLastActiveLeanDocument;
|
|
267
|
+
this.onDidChangeLastActiveLeanDocumentEmitter.fire(newLastActiveLeanDocument);
|
|
268
|
+
}
|
|
269
|
+
updateTextEditorSelection(event) {
|
|
270
|
+
if (!isLeanEditor(event.textEditor)) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
this.onDidChangeLeanEditorSelectionEmitter.fire(event);
|
|
274
|
+
}
|
|
275
|
+
get visibleLeanEditors() {
|
|
276
|
+
return this._visibleLeanEditors;
|
|
277
|
+
}
|
|
278
|
+
get activeLeanEditor() {
|
|
279
|
+
return this._activeLeanEditor;
|
|
280
|
+
}
|
|
281
|
+
get lastActiveLeanEditor() {
|
|
282
|
+
return this._lastActiveLeanEditor;
|
|
283
|
+
}
|
|
284
|
+
get leanDocuments() {
|
|
285
|
+
return this._leanDocuments;
|
|
286
|
+
}
|
|
287
|
+
get lastActiveLeanDocument() {
|
|
288
|
+
return this._lastActiveLeanDocument;
|
|
289
|
+
}
|
|
290
|
+
getVisibleLeanEditorsByUri(uri) {
|
|
291
|
+
return this.visibleLeanEditorsByUri.get(uri) ?? [];
|
|
292
|
+
}
|
|
293
|
+
getLeanDocumentByUri(uri) {
|
|
294
|
+
return this.leanDocumentsByUri.get(uri);
|
|
295
|
+
}
|
|
296
|
+
registerLeanEditorCommand(command, callback, thisArg) {
|
|
297
|
+
return commands.registerTextEditorCommand(command, (editor, edit, ...args) => {
|
|
298
|
+
const leanEditor = filterLeanEditor(editor);
|
|
299
|
+
if (leanEditor === undefined) {
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
callback(leanEditor, edit, ...args);
|
|
303
|
+
}, thisArg);
|
|
304
|
+
}
|
|
305
|
+
dispose() {
|
|
306
|
+
for (const s of this.subscriptions) {
|
|
307
|
+
s.dispose();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
export let lean;
|
|
312
|
+
/** Must be called at the very start when the extension is activated so that `lean` is defined. */
|
|
313
|
+
export function registerLeanEditorProvider(context) {
|
|
314
|
+
lean = new LeanEditorProvider();
|
|
315
|
+
context.subscriptions.push(lean);
|
|
316
|
+
context.subscriptions.push({
|
|
317
|
+
dispose: () => {
|
|
318
|
+
const u = undefined;
|
|
319
|
+
// Implicit invariant: When the extension deactivates, `lean` is not called after this assignment.
|
|
320
|
+
lean = u;
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
}
|
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { SemVer } from 'semver';
|
|
2
|
-
import { OutputChannel } from 'vscode';
|
|
3
|
-
import {
|
|
4
|
-
import { NotificationSeverity } from './notifs';
|
|
2
|
+
import { Disposable, OutputChannel } from 'vscode';
|
|
3
|
+
import { FileUri } from './exturi';
|
|
4
|
+
import { NotificationSeverity, StickyInput, StickyNotificationOptions } from './notifs';
|
|
5
5
|
export declare class LeanVersion {
|
|
6
6
|
version: string;
|
|
7
7
|
error: string | undefined;
|
|
8
8
|
}
|
|
9
|
+
export type UpdateElanMode = {
|
|
10
|
+
kind: 'Outdated';
|
|
11
|
+
versions: {
|
|
12
|
+
currentVersion: SemVer;
|
|
13
|
+
recommendedVersion: SemVer;
|
|
14
|
+
};
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'Manual';
|
|
17
|
+
versions: {
|
|
18
|
+
currentVersion: SemVer;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
9
21
|
export declare class LeanInstaller {
|
|
10
22
|
private leanInstallerLinux;
|
|
11
23
|
private leanInstallerWindows;
|
|
12
24
|
private outputChannel;
|
|
13
25
|
private prompting;
|
|
14
|
-
private
|
|
26
|
+
private pendingOperation;
|
|
15
27
|
private freshInstallDefaultToolchain;
|
|
16
|
-
private elanDefaultToolchain;
|
|
17
|
-
private workspaceSuffix;
|
|
18
|
-
private defaultSuffix;
|
|
19
28
|
private promptUser;
|
|
20
29
|
private installChangedEmitter;
|
|
21
30
|
installChanged: import("vscode").Event<FileUri>;
|
|
@@ -26,12 +35,32 @@ export declare class LeanInstaller {
|
|
|
26
35
|
isPromptVisible(): boolean;
|
|
27
36
|
private showRestartPromptAndRestart;
|
|
28
37
|
handleLakeFileChanged(packageUri: FileUri): void;
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
private installElanPrompt;
|
|
39
|
+
displayInstallElanPromptWithItems(severity: NotificationSeverity, reason: string | undefined, otherItems?: string[], defaultItem?: string | undefined): Promise<{
|
|
40
|
+
kind: 'InstallElan';
|
|
41
|
+
success: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'OtherItem';
|
|
44
|
+
choice: string;
|
|
45
|
+
} | undefined>;
|
|
33
46
|
displayInstallElanPrompt(severity: NotificationSeverity, reason: string | undefined): Promise<boolean>;
|
|
34
|
-
|
|
47
|
+
displayStickyInstallElanPrompt(severity: NotificationSeverity, reason: string | undefined, options: StickyNotificationOptions<'Install Elan' | string>, otherItems?: StickyInput<string>[]): Disposable;
|
|
48
|
+
private updateElanPrompt;
|
|
49
|
+
private displayElanUpdateSuccessfulPrompt;
|
|
50
|
+
private updateElan;
|
|
51
|
+
displayUpdateElanPromptWithItems(severity: NotificationSeverity, mode: UpdateElanMode, otherItems?: string[], defaultItem?: string | undefined): Promise<{
|
|
52
|
+
kind: 'UpdateElan';
|
|
53
|
+
success: boolean;
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'OtherItem';
|
|
56
|
+
choice: string;
|
|
57
|
+
} | undefined>;
|
|
58
|
+
displayUpdateElanPrompt(severity: NotificationSeverity, mode: UpdateElanMode): Promise<boolean>;
|
|
59
|
+
displayStickyUpdateElanPrompt(severity: NotificationSeverity, mode: UpdateElanMode, options: StickyNotificationOptions<'Update Elan' | string>, otherItems?: StickyInput<string>[]): Disposable;
|
|
60
|
+
displayManualUpdateElanPrompt(): Promise<void>;
|
|
35
61
|
private autoInstall;
|
|
62
|
+
private installElanAndDisplaySettingPrompt;
|
|
36
63
|
private installElan;
|
|
64
|
+
uninstallElan(): Promise<void>;
|
|
65
|
+
private performOperation;
|
|
37
66
|
}
|