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
|
@@ -17,15 +17,23 @@ export interface ExecutionResult {
|
|
|
17
17
|
stderr: string;
|
|
18
18
|
combined: string;
|
|
19
19
|
}
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
22
|
-
|
|
20
|
+
export declare function formatCommandExecutionOutput(workingDirectory: string | undefined, executablePath: string, args: string[]): string;
|
|
21
|
+
export declare function batchExecuteWithProc(executablePath: string, args: string[], workingDirectory?: string | undefined, channel?: ExecutionChannel | undefined, envExtensions?: {
|
|
22
|
+
[key: string]: string;
|
|
23
|
+
} | undefined): [ChildProcessWithoutNullStreams | 'CannotLaunch', Promise<ExecutionResult>];
|
|
24
|
+
export declare function batchExecute(executablePath: string, args: string[], workingDirectory?: string | undefined, channel?: ExecutionChannel | undefined, envExtensions?: {
|
|
25
|
+
[key: string]: string;
|
|
26
|
+
} | undefined): Promise<ExecutionResult>;
|
|
27
|
+
export interface ProgressExecutionOptions {
|
|
23
28
|
cwd?: string | undefined;
|
|
24
29
|
channel?: OutputChannel | undefined;
|
|
25
30
|
translator?: ((line: string) => string | undefined) | undefined;
|
|
31
|
+
envExtensions?: {
|
|
32
|
+
[key: string]: string;
|
|
33
|
+
} | undefined;
|
|
26
34
|
allowCancellation?: boolean;
|
|
27
35
|
}
|
|
28
|
-
export declare function batchExecuteWithProgress(executablePath: string, args: string[], title: string, options?: ProgressExecutionOptions): Promise<ExecutionResult>;
|
|
36
|
+
export declare function batchExecuteWithProgress(executablePath: string, args: string[], context: string | undefined, title: string, options?: ProgressExecutionOptions): Promise<ExecutionResult>;
|
|
29
37
|
type ExecutionHandler = () => Promise<ExecutionResult>;
|
|
30
38
|
export interface BatchExecution {
|
|
31
39
|
execute: ExecutionHandler;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
1
|
import { ProgressLocation, window } from 'vscode';
|
|
3
|
-
import {
|
|
4
|
-
import { displayErrorWithOutput } from './notifs';
|
|
2
|
+
import { displayNotificationWithOutput } from './notifs';
|
|
5
3
|
export var ExecutionExitCode;
|
|
6
4
|
(function (ExecutionExitCode) {
|
|
7
5
|
ExecutionExitCode[ExecutionExitCode["Success"] = 0] = "Success";
|
|
@@ -17,105 +15,120 @@ function createCannotLaunchExecutionResult(message) {
|
|
|
17
15
|
combined: message,
|
|
18
16
|
};
|
|
19
17
|
}
|
|
20
|
-
export function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
export function formatCommandExecutionOutput(workingDirectory, executablePath, args) {
|
|
19
|
+
const formattedCwd = workingDirectory ? `${workingDirectory}` : '';
|
|
20
|
+
const formattedArgs = args.map(arg => (arg.includes(' ') ? `"${arg}"` : arg)).join(' ');
|
|
21
|
+
return `${formattedCwd}> ${executablePath} ${formattedArgs}`;
|
|
22
|
+
}
|
|
23
|
+
export function batchExecuteWithProc(executablePath, args, workingDirectory, channel, envExtensions) {
|
|
24
|
+
return ["CannotLaunch", new Promise(() => { })];
|
|
25
|
+
/*
|
|
26
|
+
let stdout: string = ''
|
|
27
|
+
let stderr: string = ''
|
|
28
|
+
let combined: string = ''
|
|
29
|
+
let options = {}
|
|
25
30
|
if (workingDirectory !== undefined) {
|
|
26
|
-
options = { cwd: workingDirectory }
|
|
31
|
+
options = { cwd: workingDirectory }
|
|
32
|
+
}
|
|
33
|
+
if (envExtensions !== undefined) {
|
|
34
|
+
const env = Object.assign({}, process.env)
|
|
35
|
+
for (const [key, value] of Object.entries(envExtensions)) {
|
|
36
|
+
env[key] = value
|
|
37
|
+
}
|
|
38
|
+
options = { ...options, env }
|
|
27
39
|
}
|
|
28
40
|
if (channel?.combined) {
|
|
29
|
-
|
|
30
|
-
const formattedArgs = args.map(arg => (arg.includes(' ') ? `"${arg}"` : arg)).join(' ');
|
|
31
|
-
channel.combined.appendLine(`${formattedCwd}> ${executablePath} ${formattedArgs}`);
|
|
41
|
+
channel.combined.appendLine(formatCommandExecutionOutput(workingDirectory, executablePath, args))
|
|
32
42
|
}
|
|
33
|
-
|
|
43
|
+
|
|
44
|
+
let proc: ChildProcessWithoutNullStreams
|
|
34
45
|
try {
|
|
35
|
-
proc = spawn(executablePath, args, options)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return ['CannotLaunch', new Promise(resolve => resolve(createCannotLaunchExecutionResult('')))];
|
|
46
|
+
proc = spawn(executablePath, args, options)
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return ['CannotLaunch', new Promise(resolve => resolve(createCannotLaunchExecutionResult('')))]
|
|
39
49
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
|
|
51
|
+
const execPromise: Promise<ExecutionResult> = new Promise(resolve => {
|
|
52
|
+
const conclude = (r: ExecutionResult) =>
|
|
53
|
+
resolve({
|
|
54
|
+
exitCode: r.exitCode,
|
|
55
|
+
stdout: r.stdout.trim(),
|
|
56
|
+
stderr: r.stderr.trim(),
|
|
57
|
+
combined: r.combined.trim(),
|
|
58
|
+
})
|
|
59
|
+
|
|
47
60
|
proc.on('error', err => {
|
|
48
|
-
conclude(createCannotLaunchExecutionResult(err.message))
|
|
49
|
-
})
|
|
61
|
+
conclude(createCannotLaunchExecutionResult(err.message))
|
|
62
|
+
})
|
|
63
|
+
|
|
50
64
|
proc.stdout.on('data', line => {
|
|
51
|
-
const s = line.toString()
|
|
52
|
-
if (channel?.combined)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
65
|
+
const s: string = line.toString()
|
|
66
|
+
if (channel?.combined) channel.combined.appendLine(s)
|
|
67
|
+
if (channel?.stdout) channel.stdout.appendLine(s)
|
|
68
|
+
stdout += s + '\n'
|
|
69
|
+
combined += s + '\n'
|
|
70
|
+
})
|
|
71
|
+
|
|
59
72
|
proc.stderr.on('data', line => {
|
|
60
|
-
const s = line.toString()
|
|
61
|
-
if (channel?.combined)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
});
|
|
73
|
+
const s: string = line.toString()
|
|
74
|
+
if (channel?.combined) channel.combined.appendLine(s)
|
|
75
|
+
if (channel?.stderr) channel.stderr.appendLine(s)
|
|
76
|
+
stderr += s + '\n'
|
|
77
|
+
combined += s + '\n'
|
|
78
|
+
})
|
|
79
|
+
|
|
68
80
|
proc.on('close', (code, signal) => {
|
|
69
|
-
logger.log(`child process exited with code ${code}`)
|
|
81
|
+
logger.log(`child process exited with code ${code}`)
|
|
70
82
|
if (signal === 'SIGTERM') {
|
|
71
83
|
if (channel?.combined) {
|
|
72
|
-
channel.combined.appendLine('=> Operation cancelled by user.')
|
|
84
|
+
channel.combined.appendLine('=> Operation cancelled by user.')
|
|
73
85
|
}
|
|
74
86
|
conclude({
|
|
75
87
|
exitCode: ExecutionExitCode.Cancelled,
|
|
76
88
|
stdout,
|
|
77
89
|
stderr,
|
|
78
90
|
combined,
|
|
79
|
-
})
|
|
80
|
-
return
|
|
91
|
+
})
|
|
92
|
+
return
|
|
81
93
|
}
|
|
82
94
|
if (code !== 0) {
|
|
83
95
|
if (channel?.combined) {
|
|
84
|
-
const formattedCode = code ? `Exit code: ${code}.` : ''
|
|
85
|
-
const formattedSignal = signal ? `Signal: ${signal}.` : ''
|
|
86
|
-
channel.combined.appendLine(`=> Operation failed. ${formattedCode} ${formattedSignal}`.trim())
|
|
96
|
+
const formattedCode = code ? `Exit code: ${code}.` : ''
|
|
97
|
+
const formattedSignal = signal ? `Signal: ${signal}.` : ''
|
|
98
|
+
channel.combined.appendLine(`=> Operation failed. ${formattedCode} ${formattedSignal}`.trim())
|
|
87
99
|
}
|
|
88
100
|
conclude({
|
|
89
101
|
exitCode: ExecutionExitCode.ExecutionError,
|
|
90
102
|
stdout,
|
|
91
103
|
stderr,
|
|
92
104
|
combined,
|
|
93
|
-
})
|
|
94
|
-
return
|
|
105
|
+
})
|
|
106
|
+
return
|
|
95
107
|
}
|
|
96
108
|
conclude({
|
|
97
109
|
exitCode: ExecutionExitCode.Success,
|
|
98
110
|
stdout,
|
|
99
111
|
stderr,
|
|
100
112
|
combined,
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
})
|
|
104
|
-
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
return [proc, execPromise]
|
|
118
|
+
*/
|
|
105
119
|
}
|
|
106
|
-
export async function batchExecute(executablePath, args, workingDirectory, channel) {
|
|
107
|
-
const [_, execPromise] = batchExecuteWithProc(executablePath, args, workingDirectory, channel);
|
|
120
|
+
export async function batchExecute(executablePath, args, workingDirectory, channel, envExtensions) {
|
|
121
|
+
const [_, execPromise] = batchExecuteWithProc(executablePath, args, workingDirectory, channel, envExtensions);
|
|
108
122
|
return execPromise;
|
|
109
123
|
}
|
|
110
|
-
export async function batchExecuteWithProgress(executablePath, args, title, options = {}) {
|
|
111
|
-
const
|
|
124
|
+
export async function batchExecuteWithProgress(executablePath, args, context, title, options = {}) {
|
|
125
|
+
const titlePrefix = context ? `[${context}] ` : '';
|
|
126
|
+
const titleSuffix = options.channel ? ' [(Click for details)](command:lean4.troubleshooting.showOutput)' : '';
|
|
112
127
|
const progressOptions = {
|
|
113
128
|
location: ProgressLocation.Notification,
|
|
114
|
-
title: title + titleSuffix,
|
|
129
|
+
title: titlePrefix + title + titleSuffix,
|
|
115
130
|
cancellable: options.allowCancellation === true,
|
|
116
131
|
};
|
|
117
|
-
let inc = 0;
|
|
118
|
-
let lastReportedMessage;
|
|
119
132
|
let progress;
|
|
120
133
|
const progressChannel = {
|
|
121
134
|
name: 'ProgressChannel',
|
|
@@ -129,14 +142,8 @@ export async function batchExecuteWithProgress(executablePath, args, title, opti
|
|
|
129
142
|
}
|
|
130
143
|
if (options.channel) {
|
|
131
144
|
options.channel.appendLine(value.trimEnd());
|
|
145
|
+
progress?.report({ message: value });
|
|
132
146
|
}
|
|
133
|
-
if (inc < 90) {
|
|
134
|
-
inc += 2;
|
|
135
|
-
}
|
|
136
|
-
if (progress !== undefined) {
|
|
137
|
-
progress.report({ increment: inc, message: value });
|
|
138
|
-
}
|
|
139
|
-
lastReportedMessage = value;
|
|
140
147
|
},
|
|
141
148
|
appendLine(value) {
|
|
142
149
|
this.append(value + '\n');
|
|
@@ -160,7 +167,7 @@ export async function batchExecuteWithProgress(executablePath, args, title, opti
|
|
|
160
167
|
const expensiveExecutionTimeoutPromise = new Promise((resolve, _) => setTimeout(() => resolve(undefined), 250));
|
|
161
168
|
const [proc, executionPromise] = batchExecuteWithProc(executablePath, args, options.cwd, {
|
|
162
169
|
combined: progressChannel,
|
|
163
|
-
});
|
|
170
|
+
}, options.envExtensions);
|
|
164
171
|
if (proc === 'CannotLaunch') {
|
|
165
172
|
return executionPromise; // resolves to a 'CannotLaunch' ExecutionResult
|
|
166
173
|
}
|
|
@@ -172,7 +179,6 @@ export async function batchExecuteWithProgress(executablePath, args, title, opti
|
|
|
172
179
|
const result = await window.withProgress(progressOptions, (p, token) => {
|
|
173
180
|
progress = p;
|
|
174
181
|
token.onCancellationRequested(() => proc.kill());
|
|
175
|
-
progress.report({ message: lastReportedMessage, increment: inc });
|
|
176
182
|
return executionPromise;
|
|
177
183
|
});
|
|
178
184
|
return result;
|
|
@@ -193,7 +199,7 @@ export function displayResultError(result, message) {
|
|
|
193
199
|
throw Error();
|
|
194
200
|
}
|
|
195
201
|
const errorMessage = formatErrorMessage(result, message);
|
|
196
|
-
|
|
202
|
+
displayNotificationWithOutput('Error', errorMessage);
|
|
197
203
|
}
|
|
198
204
|
function formatErrorMessage(error, message) {
|
|
199
205
|
if (error.combined === '') {
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { LeanFileProgressProcessingInfo, ServerStoppedReason } from '@leanprover/infoview-api';
|
|
2
|
-
import { Disposable, OutputChannel
|
|
3
|
-
import { BaseLanguageClient, LanguageClientOptions } from 'vscode-languageclient/node';
|
|
4
|
-
import { PreconditionCheckResult } from '../diagnostics/setupNotifs';
|
|
2
|
+
import { Disposable, OutputChannel } from 'vscode';
|
|
5
3
|
import { LeanClient } from '../leanclient';
|
|
4
|
+
import { LeanPublishDiagnosticsParams } from './converters';
|
|
6
5
|
import { ExtUri } from './exturi';
|
|
7
6
|
import { LeanInstaller } from './leanInstaller';
|
|
7
|
+
import { BaseLanguageClient, LanguageClientOptions } from 'vscode-languageclient/node';
|
|
8
8
|
export declare class LeanClientProvider implements Disposable {
|
|
9
|
-
private checkLean4ProjectPreconditions;
|
|
10
9
|
private setupClient;
|
|
11
10
|
private subscriptions;
|
|
12
11
|
private outputChannel;
|
|
@@ -18,20 +17,21 @@ export declare class LeanClientProvider implements Disposable {
|
|
|
18
17
|
private activeClient;
|
|
19
18
|
private progressChangedEmitter;
|
|
20
19
|
progressChanged: import("vscode").Event<[string, LeanFileProgressProcessingInfo[]]>;
|
|
20
|
+
private diagnosticsChangedEmitter;
|
|
21
|
+
diagnosticsChanged: import("vscode").Event<LeanPublishDiagnosticsParams>;
|
|
21
22
|
private clientAddedEmitter;
|
|
22
23
|
clientAdded: import("vscode").Event<LeanClient>;
|
|
23
24
|
private clientRemovedEmitter;
|
|
24
25
|
clientRemoved: import("vscode").Event<LeanClient>;
|
|
25
26
|
private clientStoppedEmitter;
|
|
26
27
|
clientStopped: import("vscode").Event<[LeanClient, boolean, ServerStoppedReason]>;
|
|
27
|
-
constructor(installer: LeanInstaller, outputChannel: OutputChannel,
|
|
28
|
+
constructor(installer: LeanInstaller, outputChannel: OutputChannel, setupClient: (clientOptions: LanguageClientOptions) => Promise<BaseLanguageClient>);
|
|
28
29
|
getActiveClient(): LeanClient | undefined;
|
|
29
30
|
private onInstallChanged;
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
restartFile(uri: ExtUri): void;
|
|
32
|
+
restartActiveFile(): void;
|
|
33
|
+
private stopClient;
|
|
32
34
|
private restartActiveClient;
|
|
33
|
-
clientIsStarted(): void;
|
|
34
|
-
didOpenEditor(document: TextDocument): Promise<void>;
|
|
35
35
|
findClient(path: ExtUri): LeanClient | undefined;
|
|
36
36
|
getClients(): LeanClient[];
|
|
37
37
|
getClientForFolder(folder: ExtUri): LeanClient | undefined;
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import { EventEmitter, commands
|
|
1
|
+
import { EventEmitter, commands } from 'vscode';
|
|
2
|
+
import { SetupDiagnostics, checkAll } from '../diagnostics/setupDiagnostics';
|
|
2
3
|
import { LeanClient } from '../leanclient';
|
|
3
|
-
import {
|
|
4
|
+
import { lean } from './leanEditorProvider';
|
|
4
5
|
import { logger } from './logger';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
6
|
+
import { displayNotification } from './notifs';
|
|
7
|
+
import { findLeanProjectRootInfo, willUseLakeServer } from './projectInfo';
|
|
8
|
+
async function checkLean4ProjectPreconditions(channel, context, existingFolderUris, folderUri, fileUri, stopOtherServer) {
|
|
9
|
+
const options = {
|
|
10
|
+
errorMode: { mode: 'NonModal' },
|
|
11
|
+
warningMode: { modal: false, proceedByDefault: true },
|
|
12
|
+
};
|
|
13
|
+
const d = new SetupDiagnostics(options);
|
|
14
|
+
return await checkAll(() => d.checkIsValidProjectFolder(channel, folderUri), () => d.checkIsLeanVersionUpToDate(channel, context, folderUri, { toolchainUpdateMode: 'PromptAboutUpdate' }), async () => {
|
|
15
|
+
if (!(await willUseLakeServer(folderUri))) {
|
|
16
|
+
return 'Fulfilled';
|
|
17
|
+
}
|
|
18
|
+
return await d.checkIsLakeInstalledCorrectly(channel, context, folderUri, {
|
|
19
|
+
toolchainUpdateMode: 'PromptAboutUpdate',
|
|
20
|
+
});
|
|
21
|
+
}, () => d.checkIsNestedProjectFolder(existingFolderUris, folderUri, fileUri, stopOtherServer));
|
|
22
|
+
}
|
|
7
23
|
// This class ensures we have one LeanClient per folder.
|
|
8
24
|
export class LeanClientProvider {
|
|
9
|
-
checkLean4ProjectPreconditions;
|
|
10
25
|
setupClient;
|
|
11
26
|
subscriptions = [];
|
|
12
27
|
outputChannel;
|
|
@@ -18,50 +33,35 @@ export class LeanClientProvider {
|
|
|
18
33
|
activeClient = undefined;
|
|
19
34
|
progressChangedEmitter = new EventEmitter();
|
|
20
35
|
progressChanged = this.progressChangedEmitter.event;
|
|
36
|
+
diagnosticsChangedEmitter = new EventEmitter();
|
|
37
|
+
diagnosticsChanged = this.diagnosticsChangedEmitter.event;
|
|
21
38
|
clientAddedEmitter = new EventEmitter();
|
|
22
39
|
clientAdded = this.clientAddedEmitter.event;
|
|
23
40
|
clientRemovedEmitter = new EventEmitter();
|
|
24
41
|
clientRemoved = this.clientRemovedEmitter.event;
|
|
25
42
|
clientStoppedEmitter = new EventEmitter();
|
|
26
43
|
clientStopped = this.clientStoppedEmitter.event;
|
|
27
|
-
constructor(installer, outputChannel,
|
|
28
|
-
this.checkLean4ProjectPreconditions = checkLean4ProjectPreconditions;
|
|
44
|
+
constructor(installer, outputChannel, setupClient) {
|
|
29
45
|
this.setupClient = setupClient;
|
|
30
46
|
this.outputChannel = outputChannel;
|
|
31
47
|
this.installer = installer;
|
|
32
48
|
// we must setup the installChanged event handler first before any didOpenEditor calls.
|
|
33
49
|
this.subscriptions.push(installer.installChanged(async (uri) => await this.onInstallChanged(uri)));
|
|
34
|
-
|
|
35
|
-
this.subscriptions.push(
|
|
36
|
-
if (
|
|
50
|
+
lean.visibleLeanEditors.forEach(e => this.ensureClient(e.documentExtUri));
|
|
51
|
+
this.subscriptions.push(lean.onDidChangeActiveLeanEditor(async (e) => {
|
|
52
|
+
if (e === undefined) {
|
|
37
53
|
return;
|
|
38
54
|
}
|
|
39
|
-
await this.
|
|
40
|
-
}));
|
|
41
|
-
this.subscriptions.push(commands.registerCommand('lean4.restartFile', () => this.restartFile()), commands.registerCommand('lean4.refreshFileDependencies', () => this.restartFile()), commands.registerCommand('lean4.restartServer', () => this.restartActiveClient()), commands.registerCommand('lean4.stopServer', () => this.stopActiveClient()));
|
|
42
|
-
this.subscriptions.push(workspace.onDidOpenTextDocument(document => this.didOpenEditor(document)));
|
|
43
|
-
this.subscriptions.push(workspace.onDidChangeWorkspaceFolders(event => {
|
|
44
|
-
// Remove all clients that are not referenced by any folder anymore
|
|
45
|
-
if (event.removed.length === 0) {
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
this.clients.forEach((client, key) => {
|
|
49
|
-
if (client.folderUri.scheme === 'untitled' || getWorkspaceFolderUri(client.folderUri)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
logger.log(`[ClientProvider] onDidChangeWorkspaceFolders removing client for ${key}`);
|
|
53
|
-
this.clients.delete(key);
|
|
54
|
-
client.dispose();
|
|
55
|
-
this.clientRemovedEmitter.fire(client);
|
|
56
|
-
});
|
|
55
|
+
await this.ensureClient(e.documentExtUri);
|
|
57
56
|
}));
|
|
57
|
+
this.subscriptions.push(commands.registerCommand('lean4.restartFile', () => this.restartActiveFile()), commands.registerCommand('lean4.refreshFileDependencies', () => this.restartActiveFile()), commands.registerCommand('lean4.restartServer', () => this.restartActiveClient()), commands.registerCommand('lean4.stopServer', () => this.stopClient(undefined)));
|
|
58
|
+
this.subscriptions.push(lean.onDidOpenLeanDocument(document => this.ensureClient(document.extUri)));
|
|
58
59
|
}
|
|
59
60
|
getActiveClient() {
|
|
61
|
+
// TODO: Most callers of this function probably don't need an active client, just the folder URI.
|
|
60
62
|
return this.activeClient;
|
|
61
63
|
}
|
|
62
64
|
async onInstallChanged(uri) {
|
|
63
|
-
// Uri is a package Uri in the case a lean package file was changed.
|
|
64
|
-
logger.log(`[ClientProvider] installChanged for ${uri}`);
|
|
65
65
|
this.pendingInstallChanged.push(uri);
|
|
66
66
|
if (this.processingInstallChanged) {
|
|
67
67
|
// avoid re-entrancy.
|
|
@@ -74,18 +74,9 @@ export class LeanClientProvider {
|
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
try {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
const preconditionCheckResult = await this.checkLean4ProjectPreconditions(this.outputChannel, projectUri);
|
|
82
|
-
if (preconditionCheckResult !== 'Fatal') {
|
|
83
|
-
logger.log('[ClientProvider] got lean version 4');
|
|
84
|
-
const [cached, client] = await this.ensureClient(uri);
|
|
85
|
-
if (cached && client) {
|
|
86
|
-
await client.restart();
|
|
87
|
-
logger.log('[ClientProvider] restart complete');
|
|
88
|
-
}
|
|
77
|
+
const [cached, client] = await this.ensureClient(uri);
|
|
78
|
+
if (cached && client) {
|
|
79
|
+
await client.restart();
|
|
89
80
|
}
|
|
90
81
|
}
|
|
91
82
|
catch (e) {
|
|
@@ -94,38 +85,69 @@ export class LeanClientProvider {
|
|
|
94
85
|
}
|
|
95
86
|
this.processingInstallChanged = false;
|
|
96
87
|
}
|
|
97
|
-
restartFile() {
|
|
98
|
-
|
|
99
|
-
|
|
88
|
+
restartFile(uri) {
|
|
89
|
+
const fileName = uri.scheme === 'file' ? uri.baseName() : 'untitled file';
|
|
90
|
+
const client = this.findClient(uri);
|
|
91
|
+
if (!client || !client.isRunning()) {
|
|
92
|
+
displayNotification('Error', `No active client for '${fileName}'.`);
|
|
100
93
|
return;
|
|
101
94
|
}
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
const doc = lean.getLeanDocumentByUri(uri);
|
|
96
|
+
if (doc === undefined) {
|
|
97
|
+
displayNotification('Error', `'${fileName}' was closed in the meantime.`);
|
|
104
98
|
return;
|
|
105
99
|
}
|
|
106
|
-
void
|
|
100
|
+
void client.restartFile(doc);
|
|
107
101
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
restartActiveFile() {
|
|
103
|
+
const doc = lean.lastActiveLeanDocument;
|
|
104
|
+
if (doc === undefined) {
|
|
105
|
+
displayNotification('Error', 'No active Lean editor tab. Make sure to focus the Lean editor tab for which you want to issue a restart.');
|
|
106
|
+
return;
|
|
111
107
|
}
|
|
108
|
+
this.restartFile(doc.extUri);
|
|
112
109
|
}
|
|
113
|
-
async
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (document.languageId !== 'lean4') {
|
|
122
|
-
return;
|
|
110
|
+
async stopClient(folderUri) {
|
|
111
|
+
let clientToStop;
|
|
112
|
+
if (folderUri === undefined) {
|
|
113
|
+
if (this.activeClient === undefined) {
|
|
114
|
+
displayNotification('Error', 'Cannot stop language server: No active client.');
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
clientToStop = this.activeClient;
|
|
123
118
|
}
|
|
124
|
-
|
|
125
|
-
|
|
119
|
+
else {
|
|
120
|
+
const foundClient = this.getClientForFolder(folderUri);
|
|
121
|
+
if (foundClient === undefined) {
|
|
122
|
+
displayNotification('Error', `Cannot stop language server: No client for project at '${folderUri.toString()}'.`);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
clientToStop = foundClient;
|
|
126
|
+
}
|
|
127
|
+
if (clientToStop.isStarted()) {
|
|
128
|
+
await clientToStop.stop();
|
|
129
|
+
}
|
|
130
|
+
const key = clientToStop.folderUri.toString();
|
|
131
|
+
this.clients.delete(key);
|
|
132
|
+
this.pending.delete(key);
|
|
133
|
+
if (clientToStop === this.activeClient) {
|
|
134
|
+
this.activeClient = undefined;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async restartActiveClient() {
|
|
138
|
+
if (this.activeClient === undefined) {
|
|
139
|
+
const activeUri = lean.lastActiveLeanDocument?.extUri;
|
|
140
|
+
if (activeUri === undefined) {
|
|
141
|
+
displayNotification('Error', 'Cannot restart server: No focused Lean tab. Please focus the Lean tab for which you want to restart the server.');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const [cached, client] = await this.ensureClient(activeUri);
|
|
145
|
+
if (cached) {
|
|
146
|
+
await client?.restart();
|
|
147
|
+
}
|
|
126
148
|
return;
|
|
127
149
|
}
|
|
128
|
-
await this.
|
|
150
|
+
await this.activeClient?.restart();
|
|
129
151
|
}
|
|
130
152
|
// Find the client for a given document.
|
|
131
153
|
findClient(path) {
|
|
@@ -154,14 +176,16 @@ export class LeanClientProvider {
|
|
|
154
176
|
getClientForFolder(folder) {
|
|
155
177
|
return this.clients.get(folder.toString());
|
|
156
178
|
}
|
|
157
|
-
// Starts a LeanClient if the given file is in a new workspace we haven't seen before.
|
|
158
|
-
// Returns a boolean "true" if the LeanClient was already created.
|
|
159
|
-
// Returns a null client if it turns out the new workspace is a lean3 workspace.
|
|
160
179
|
async ensureClient(uri) {
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
180
|
+
const projectInfo = await findLeanProjectRootInfo(uri);
|
|
181
|
+
if (projectInfo.kind === 'FileNotFound') {
|
|
182
|
+
return [false, undefined];
|
|
183
|
+
}
|
|
184
|
+
if (projectInfo.kind === 'LakefileWithoutToolchain') {
|
|
185
|
+
displayNotification('Error', `Project at ${projectInfo.projectRootUri} has a Lakefile, but lacks a 'lean-toolchain' file. Please create one with the Lean version that you would like the project to use.`);
|
|
163
186
|
return [false, undefined];
|
|
164
187
|
}
|
|
188
|
+
const folderUri = projectInfo.projectRootUri;
|
|
165
189
|
let client = this.getClientForFolder(folderUri);
|
|
166
190
|
if (client) {
|
|
167
191
|
this.activeClient = client;
|
|
@@ -172,20 +196,36 @@ export class LeanClientProvider {
|
|
|
172
196
|
return [false, undefined];
|
|
173
197
|
}
|
|
174
198
|
this.pending.set(key, true);
|
|
175
|
-
|
|
199
|
+
// lean4monaco: The precondition checks require a file system or executables, which we don't have in the browser.
|
|
200
|
+
/*
|
|
201
|
+
const preconditionCheckResult = await checkLean4ProjectPreconditions(
|
|
202
|
+
this.outputChannel,
|
|
203
|
+
'Client Startup',
|
|
204
|
+
this.getClients().map(client => client.folderUri),
|
|
205
|
+
folderUri,
|
|
206
|
+
uri,
|
|
207
|
+
async (folderUriToStop: FileUri) => {
|
|
208
|
+
await this.stopClient(folderUriToStop)
|
|
209
|
+
await this.ensureClient(uri)
|
|
210
|
+
},
|
|
211
|
+
)
|
|
176
212
|
if (preconditionCheckResult === 'Fatal') {
|
|
177
|
-
this.pending.delete(key)
|
|
178
|
-
|
|
213
|
+
this.pending.delete(key)
|
|
214
|
+
this.activeClient = undefined
|
|
215
|
+
return [false, undefined]
|
|
179
216
|
}
|
|
217
|
+
*/
|
|
180
218
|
logger.log('[ClientProvider] Creating LeanClient for ' + folderUri.toString());
|
|
181
|
-
|
|
182
|
-
client = new LeanClient(folderUri, this.outputChannel, elanDefaultToolchain, this.setupClient);
|
|
219
|
+
client = new LeanClient(folderUri, this.outputChannel, this.setupClient);
|
|
183
220
|
this.subscriptions.push(client);
|
|
184
221
|
this.clients.set(key, client);
|
|
185
222
|
client.serverFailed(err => {
|
|
223
|
+
if (this.activeClient === client) {
|
|
224
|
+
this.activeClient = undefined;
|
|
225
|
+
}
|
|
186
226
|
this.clients.delete(key);
|
|
187
227
|
client.dispose();
|
|
188
|
-
|
|
228
|
+
displayNotification('Error', err);
|
|
189
229
|
});
|
|
190
230
|
client.stopped(reason => {
|
|
191
231
|
this.clientStoppedEmitter.fire([client, client === this.activeClient, reason]);
|
|
@@ -194,10 +234,14 @@ export class LeanClientProvider {
|
|
|
194
234
|
client.progressChanged(arg => {
|
|
195
235
|
this.progressChangedEmitter.fire(arg);
|
|
196
236
|
});
|
|
197
|
-
|
|
237
|
+
client.diagnostics(p => {
|
|
238
|
+
this.diagnosticsChangedEmitter.fire(p);
|
|
239
|
+
});
|
|
240
|
+
// Fired before starting the client because the InfoView uses this to register
|
|
241
|
+
// events on `client` that fire during `start`.
|
|
198
242
|
this.clientAddedEmitter.fire(client);
|
|
199
243
|
await client.start();
|
|
200
|
-
|
|
244
|
+
this.pending.delete(key);
|
|
201
245
|
this.activeClient = client;
|
|
202
246
|
return [false, client];
|
|
203
247
|
}
|
|
@@ -10,6 +10,21 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
import { Code2ProtocolConverter, DidOpenTextDocumentParams, Protocol2CodeConverter } from 'vscode-languageclient';
|
|
13
|
+
import * as ls from 'vscode-languageserver-protocol';
|
|
14
|
+
export declare enum LeanTag {
|
|
15
|
+
UnsolvedGoals = 1,
|
|
16
|
+
GoalsAccomplished = 2
|
|
17
|
+
}
|
|
18
|
+
export interface LeanDiagnostic extends ls.Diagnostic {
|
|
19
|
+
fullRange?: ls.Range;
|
|
20
|
+
isSilent?: boolean;
|
|
21
|
+
leanTags?: LeanTag[];
|
|
22
|
+
}
|
|
23
|
+
export interface LeanPublishDiagnosticsParams {
|
|
24
|
+
uri: ls.DocumentUri;
|
|
25
|
+
version?: ls.integer;
|
|
26
|
+
diagnostics: LeanDiagnostic[];
|
|
27
|
+
}
|
|
13
28
|
export declare function setDependencyBuildMode(params: DidOpenTextDocumentParams, dependencyBuildMode: 'once' | 'never'): DidOpenTextDocumentParams;
|
|
14
29
|
export declare const p2cConverter: Protocol2CodeConverter;
|
|
15
30
|
export declare const c2pConverter: Code2ProtocolConverter;
|
|
@@ -15,6 +15,11 @@ import { createConverter as createP2CConverter } from 'vscode-languageclient/lib
|
|
|
15
15
|
import * as async from 'vscode-languageclient/lib/common/utils/async';
|
|
16
16
|
import * as ls from 'vscode-languageserver-protocol';
|
|
17
17
|
import { automaticallyBuildDependencies } from '../config';
|
|
18
|
+
export var LeanTag;
|
|
19
|
+
(function (LeanTag) {
|
|
20
|
+
LeanTag[LeanTag["UnsolvedGoals"] = 1] = "UnsolvedGoals";
|
|
21
|
+
LeanTag[LeanTag["GoalsAccomplished"] = 2] = "GoalsAccomplished";
|
|
22
|
+
})(LeanTag || (LeanTag = {}));
|
|
18
23
|
var SnippetTextEdit;
|
|
19
24
|
(function (SnippetTextEdit) {
|
|
20
25
|
function is(value) {
|
|
@@ -50,6 +55,8 @@ export function patchConverters(p2cConverter, c2pConverter) {
|
|
|
50
55
|
}
|
|
51
56
|
const diag = oldP2cAsDiagnostic.apply(this, [protDiag]);
|
|
52
57
|
diag.fullRange = p2cConverter.asRange(protDiag.fullRange);
|
|
58
|
+
diag.leanTags = protDiag.leanTags;
|
|
59
|
+
diag.isSilent = protDiag.isSilent;
|
|
53
60
|
return diag;
|
|
54
61
|
};
|
|
55
62
|
// The original definition refers to `asDiagnostic` as a local function
|
|
@@ -61,6 +68,8 @@ export function patchConverters(p2cConverter, c2pConverter) {
|
|
|
61
68
|
c2pConverter.asDiagnostic = function (diag) {
|
|
62
69
|
const protDiag = oldC2pAsDiagnostic.apply(this, [diag]);
|
|
63
70
|
protDiag.fullRange = c2pConverter.asRange(diag.fullRange);
|
|
71
|
+
protDiag.leanTags = diag.leanTags;
|
|
72
|
+
protDiag.isSilent = diag.isSilent;
|
|
64
73
|
return protDiag;
|
|
65
74
|
};
|
|
66
75
|
c2pConverter.asDiagnostics = async (diags, token) => async.map(diags, d => c2pConverter.asDiagnostic(d), token);
|