lean4monaco 1.1.3 → 1.1.5
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 +2 -4
- package/dist/vscode-lean4/vscode-lean4/src/utils/depInstaller.d.ts +81 -0
- package/dist/vscode-lean4/vscode-lean4/src/utils/depInstaller.js +372 -0
- package/package.json +1 -1
- package/dist/JuliaMono-Regular.ttf +0 -0
- package/dist/lean4-infoview/codicon.ttf +0 -0
- package/dist/lean4-infoview/esm-shims/react-dom.d.ts +0 -5
- package/dist/lean4-infoview/esm-shims/react-jsx-runtime.d.ts +0 -5
- package/dist/lean4-infoview/esm-shims/react.d.ts +0 -5
- package/dist/lean4-infoview/index.css +0 -4161
- package/dist/lean4-infoview/index.d.ts +0 -16
- package/dist/lean4-infoview/index.development.js +0 -37312
- package/dist/lean4-infoview/index.production.min.js +0 -1528
- package/dist/lean4-infoview/infoview/collapsing.d.ts +0 -12
- package/dist/lean4-infoview/infoview/contexts.d.ts +0 -10
- package/dist/lean4-infoview/infoview/editorConnection.d.ts +0 -22
- package/dist/lean4-infoview/infoview/errors.d.ts +0 -14
- package/dist/lean4-infoview/infoview/event.d.ts +0 -33
- package/dist/lean4-infoview/infoview/goalLocation.d.ts +0 -61
- package/dist/lean4-infoview/infoview/goals.d.ts +0 -46
- package/dist/lean4-infoview/infoview/info.d.ts +0 -18
- package/dist/lean4-infoview/infoview/infos.d.ts +0 -2
- package/dist/lean4-infoview/infoview/interactiveCode.d.ts +0 -19
- package/dist/lean4-infoview/infoview/main.d.ts +0 -13
- package/dist/lean4-infoview/infoview/messages.d.ts +0 -19
- package/dist/lean4-infoview/infoview/rpcSessions.d.ts +0 -11
- package/dist/lean4-infoview/infoview/serverVersion.d.ts +0 -10
- package/dist/lean4-infoview/infoview/tooltips.d.ts +0 -32
- package/dist/lean4-infoview/infoview/traceExplorer.d.ts +0 -11
- package/dist/lean4-infoview/infoview/userWidget.d.ts +0 -39
- package/dist/lean4-infoview/infoview/util.d.ts +0 -144
- package/dist/lean4-infoview/loader.d.ts +0 -20
- package/dist/lean4-infoview/loader.development.js +0 -1006
- package/dist/lean4-infoview/loader.production.min.js +0 -1
- package/dist/lean4-infoview/react-dom.development.js +0 -30537
- package/dist/lean4-infoview/react-dom.production.min.js +0 -21
- package/dist/lean4-infoview/react-jsx-runtime.development.js +0 -1362
- package/dist/lean4-infoview/react-jsx-runtime.production.min.js +0 -1
- package/dist/lean4-infoview/react.development.js +0 -2823
- package/dist/lean4-infoview/react.production.min.js +0 -1
- package/dist/monaco-lean4/vscode-lean4/package.json +0 -944
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.d.ts +0 -9
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationFeature.js +0 -20
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.d.ts +0 -12
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationHoverProvider.js +0 -40
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.d.ts +0 -20
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/AbbreviationRewriterFeature.js +0 -79
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.d.ts +0 -13
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationConfig.js +0 -29
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.d.ts +0 -28
- package/dist/monaco-lean4/vscode-lean4/src/abbreviation/VSCodeAbbreviationRewriter.js +0 -124
- package/dist/monaco-lean4/vscode-lean4/src/config.d.ts +0 -33
- package/dist/monaco-lean4/vscode-lean4/src/config.js +0 -119
- package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.d.ts +0 -27
- package/dist/monaco-lean4/vscode-lean4/src/diagnostics/setupNotifs.js +0 -133
- package/dist/monaco-lean4/vscode-lean4/src/infoview.d.ts +0 -69
- package/dist/monaco-lean4/vscode-lean4/src/infoview.js +0 -711
- package/dist/monaco-lean4/vscode-lean4/src/leanclient.d.ts +0 -67
- package/dist/monaco-lean4/vscode-lean4/src/leanclient.js +0 -443
- package/dist/monaco-lean4/vscode-lean4/src/rpc.d.ts +0 -16
- package/dist/monaco-lean4/vscode-lean4/src/rpc.js +0 -102
- package/dist/monaco-lean4/vscode-lean4/src/taskgutter.d.ts +0 -11
- package/dist/monaco-lean4/vscode-lean4/src/taskgutter.js +0 -130
- package/dist/monaco-lean4/vscode-lean4/src/utils/batch.d.ts +0 -37
- package/dist/monaco-lean4/vscode-lean4/src/utils/batch.js +0 -203
- package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.d.ts +0 -41
- package/dist/monaco-lean4/vscode-lean4/src/utils/clientProvider.js +0 -205
- package/dist/monaco-lean4/vscode-lean4/src/utils/converters.d.ts +0 -16
- package/dist/monaco-lean4/vscode-lean4/src/utils/converters.js +0 -129
- package/dist/monaco-lean4/vscode-lean4/src/utils/elan.d.ts +0 -3
- package/dist/monaco-lean4/vscode-lean4/src/utils/elan.js +0 -4
- package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.d.ts +0 -21
- package/dist/monaco-lean4/vscode-lean4/src/utils/envPath.js +0 -53
- package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.d.ts +0 -35
- package/dist/monaco-lean4/vscode-lean4/src/utils/exturi.js +0 -136
- package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.d.ts +0 -17
- package/dist/monaco-lean4/vscode-lean4/src/utils/fsHelper.js +0 -36
- package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.d.ts +0 -37
- package/dist/monaco-lean4/vscode-lean4/src/utils/leanInstaller.js +0 -210
- package/dist/monaco-lean4/vscode-lean4/src/utils/logger.d.ts +0 -7
- package/dist/monaco-lean4/vscode-lean4/src/utils/logger.js +0 -20
- package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.d.ts +0 -24
- package/dist/monaco-lean4/vscode-lean4/src/utils/notifs.js +0 -110
- package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.d.ts +0 -9
- package/dist/monaco-lean4/vscode-lean4/src/utils/projectInfo.js +0 -125
- package/dist/useragent.d.ts +0 -1
- package/dist/useragent.js +0 -31
- package/dist/vscode.css +0 -7
package/README.md
CHANGED
|
@@ -109,7 +109,7 @@ export default {
|
|
|
109
109
|
For Vite dev mode to work properly, the following plugin is necessary:
|
|
110
110
|
|
|
111
111
|
```
|
|
112
|
-
npm install -
|
|
112
|
+
npm install --save-dev '@codingame/esbuild-import-meta-url-plugin'
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
```ts
|
|
@@ -126,8 +126,6 @@ export default {
|
|
|
126
126
|
}
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
This could be replaced by `npm install --save-dev @codingame/esbuild-import-meta-url-plugin` when this PR is accepted: https://github.com/CodinGame/esbuild-import-meta-url-plugin/pull/5
|
|
130
|
-
|
|
131
129
|
#### infoview
|
|
132
130
|
|
|
133
131
|
Moreover, the infoview javascript files need to be served:
|
|
@@ -231,7 +229,7 @@ If there are merge conflicts, resolve them.
|
|
|
231
229
|
|
|
232
230
|
Make sure that the `@leanprover` packages (and possibly others?)
|
|
233
231
|
listed under `dependencies` in `package.json` point to the same versions as the packages
|
|
234
|
-
listed under `dependencies` in `src/vscode-lean4/package.json`.
|
|
232
|
+
listed under `dependencies` in `src/vscode-lean4/package.json`.
|
|
235
233
|
|
|
236
234
|
Verify that the everything still works:
|
|
237
235
|
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Disposable, OutputChannel } from 'vscode';
|
|
2
|
+
import { ExecutionResult } from './batch';
|
|
3
|
+
import { NotificationSeverity, StickyInput, StickyNotificationOptions } from './notifs';
|
|
4
|
+
export type LinuxPackageManager = {
|
|
5
|
+
kind: 'Apt';
|
|
6
|
+
isPkExecAvailable: boolean;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'Dnf';
|
|
9
|
+
isPkExecAvailable: boolean;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'Other';
|
|
12
|
+
};
|
|
13
|
+
export type DependencyInstallationMethod = {
|
|
14
|
+
kind: 'Automatic';
|
|
15
|
+
shell: 'Windows' | 'Unix';
|
|
16
|
+
script: string;
|
|
17
|
+
manualBackupScript: string | undefined;
|
|
18
|
+
pathExtensions: string[];
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'Manual';
|
|
21
|
+
script: string | undefined;
|
|
22
|
+
};
|
|
23
|
+
export type MissingDependencyInstallationProcedure = {
|
|
24
|
+
kind: 'Linux';
|
|
25
|
+
isGitAvailable: boolean;
|
|
26
|
+
isCurlAvailable: boolean;
|
|
27
|
+
packageManager: LinuxPackageManager;
|
|
28
|
+
} | {
|
|
29
|
+
kind: 'MacOS';
|
|
30
|
+
isGitAvailable: boolean;
|
|
31
|
+
isCurlAvailable: true;
|
|
32
|
+
} | {
|
|
33
|
+
kind: 'Windows';
|
|
34
|
+
isGitAvailable: boolean;
|
|
35
|
+
isCurlAvailable: true;
|
|
36
|
+
isWinGetAvailable: boolean;
|
|
37
|
+
} | {
|
|
38
|
+
kind: 'Other';
|
|
39
|
+
isGitAvailable: boolean;
|
|
40
|
+
isCurlAvailable: boolean;
|
|
41
|
+
};
|
|
42
|
+
export type DependencyInstallationProcedure = {
|
|
43
|
+
kind: 'AllDepsInstalled';
|
|
44
|
+
} | (MissingDependencyInstallationProcedure & {
|
|
45
|
+
method: DependencyInstallationMethod;
|
|
46
|
+
});
|
|
47
|
+
export type DependencyInstallationResult = {
|
|
48
|
+
kind: 'Success';
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'Error';
|
|
51
|
+
result: ExecutionResult;
|
|
52
|
+
} | {
|
|
53
|
+
kind: 'Cancelled';
|
|
54
|
+
} | {
|
|
55
|
+
kind: 'PendingInstall';
|
|
56
|
+
};
|
|
57
|
+
export declare function depInstallationLocations(): string[];
|
|
58
|
+
export declare class DepInstaller implements Disposable {
|
|
59
|
+
readonly outputChannel: OutputChannel;
|
|
60
|
+
private pendingInstall;
|
|
61
|
+
private diagnoser;
|
|
62
|
+
private subscriptions;
|
|
63
|
+
constructor(outputChannel: OutputChannel);
|
|
64
|
+
displayInstallDependenciesPrompt(severity: NotificationSeverity, reason: string | undefined): Promise<'Success' | 'PendingInstall' | 'Failure'>;
|
|
65
|
+
displayStickyInstallDependenciesPrompt(severity: NotificationSeverity, reason: string | undefined, options: StickyNotificationOptions<string>, otherItems?: StickyInput<string>[]): Promise<Disposable>;
|
|
66
|
+
private installMissingDepsAndDisplayNotification;
|
|
67
|
+
installMissingDeps(p: MissingDependencyInstallationProcedure & {
|
|
68
|
+
method: DependencyInstallationMethod;
|
|
69
|
+
}): Promise<DependencyInstallationResult>;
|
|
70
|
+
private addDepsToProcessEnv;
|
|
71
|
+
determineDependencyInstallationProcedure(): Promise<DependencyInstallationProcedure>;
|
|
72
|
+
private determineMissingDependencyInstallationProcedure;
|
|
73
|
+
private runCommand;
|
|
74
|
+
dispose(): void;
|
|
75
|
+
}
|
|
76
|
+
export declare function missingDepsSentence(p: MissingDependencyInstallationProcedure): string;
|
|
77
|
+
export declare function sentenceJoin(entries: string[]): string;
|
|
78
|
+
export declare function missingDeps(p: MissingDependencyInstallationProcedure): string[];
|
|
79
|
+
export declare function unsuccessfulDependencyInstallationPrompt(p: MissingDependencyInstallationProcedure & {
|
|
80
|
+
method: DependencyInstallationMethod;
|
|
81
|
+
}): string;
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import * as os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { commands, Disposable, env } from 'vscode';
|
|
4
|
+
import { SetupDiagnoser } from '../diagnostics/setupDiagnoser';
|
|
5
|
+
import { batchExecuteWithProgress, displayModalResultError, ExecutionExitCode, } from './batch';
|
|
6
|
+
import { addToProcessEnvPATH } from './envPath';
|
|
7
|
+
import { displayModalNotification, displayNotification, displayNotificationWithInput, displayStickyNotificationWithOptionalInput, } from './notifs';
|
|
8
|
+
const gitInstallDir = path.join('c:', 'Program Files', 'Git', 'cmd');
|
|
9
|
+
export function depInstallationLocations() {
|
|
10
|
+
switch (os.type()) {
|
|
11
|
+
case 'Linux':
|
|
12
|
+
// Installation locations of Git and curl should already be in PATH on most Linux systems
|
|
13
|
+
return [];
|
|
14
|
+
case 'Darwin':
|
|
15
|
+
// MacOS ships with a dummy executable for Git that is already in the PATH, which is replaced
|
|
16
|
+
// with the real executable when Apple Command Line Tools is installed.
|
|
17
|
+
return [];
|
|
18
|
+
case 'Windows_NT':
|
|
19
|
+
return [gitInstallDir];
|
|
20
|
+
}
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
const windowsRawGitInstallScript = `$gitInstallerUrl = "https://github.com/git-for-windows/git/releases/download/v2.50.1.windows.1/Git-2.50.1-64-bit.exe"
|
|
24
|
+
$installDir = "%TEMP%\\lean4-vscode-extension"
|
|
25
|
+
$gitInstallerLoc = "$installDir\\GitInstaller.exe"
|
|
26
|
+
New-Item -ItemType Directory -Path $installDir -Force
|
|
27
|
+
Invoke-WebRequest -Uri $gitInstallerUrl -OutFile $gitInstallerLoc
|
|
28
|
+
& $gitInstallerLoc /VERYSILENT /NORESTART /SP-
|
|
29
|
+
exit $LASTEXITCODE`;
|
|
30
|
+
const macOsInstallScript = `set -e
|
|
31
|
+
touch "/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
|
|
32
|
+
aclt_label="$(/usr/sbin/softwareupdate -l |
|
|
33
|
+
grep -B 1 -E 'Command Line Tools' |
|
|
34
|
+
awk -F'*' '/^ *\\*/ {print $2}' |
|
|
35
|
+
sed -e 's/^ *Label: //' -e 's/^ *//' |
|
|
36
|
+
sort -V |
|
|
37
|
+
tail -n1 |
|
|
38
|
+
tr -d '\n')"
|
|
39
|
+
/usr/sbin/softwareupdate -i "$aclt_label"`;
|
|
40
|
+
export class DepInstaller {
|
|
41
|
+
outputChannel;
|
|
42
|
+
pendingInstall = false;
|
|
43
|
+
diagnoser;
|
|
44
|
+
subscriptions = [];
|
|
45
|
+
constructor(outputChannel) {
|
|
46
|
+
this.outputChannel = outputChannel;
|
|
47
|
+
this.diagnoser = new SetupDiagnoser({
|
|
48
|
+
channel: outputChannel,
|
|
49
|
+
cwdUri: undefined,
|
|
50
|
+
context: 'Dependency Installation',
|
|
51
|
+
});
|
|
52
|
+
this.subscriptions.push(commands.registerCommand('lean4.setup.installDeps', () => this.displayInstallDependenciesPrompt('Information', undefined)));
|
|
53
|
+
}
|
|
54
|
+
async displayInstallDependenciesPrompt(severity, reason) {
|
|
55
|
+
const p = await this.determineDependencyInstallationProcedure();
|
|
56
|
+
if (p.kind === 'AllDepsInstalled') {
|
|
57
|
+
displayNotification('Information', 'All dependencies of Lean (Git and curl) are already installed.');
|
|
58
|
+
return 'Success';
|
|
59
|
+
}
|
|
60
|
+
if (p.method.kind === 'Manual') {
|
|
61
|
+
await displayManualInstallationPrompt(severity, reason, p);
|
|
62
|
+
return 'Failure';
|
|
63
|
+
}
|
|
64
|
+
const choice = await displayNotificationWithInput(severity, installDependenciesPrompt(reason, p), ['Proceed']);
|
|
65
|
+
if (choice !== 'Proceed') {
|
|
66
|
+
return 'Failure';
|
|
67
|
+
}
|
|
68
|
+
return await this.installMissingDepsAndDisplayNotification(p);
|
|
69
|
+
}
|
|
70
|
+
async displayStickyInstallDependenciesPrompt(severity, reason, options, otherItems = []) {
|
|
71
|
+
const p = await this.determineDependencyInstallationProcedure();
|
|
72
|
+
if (p.kind === 'AllDepsInstalled') {
|
|
73
|
+
displayNotification('Information', 'All dependencies of Lean (Git and curl) are already installed.');
|
|
74
|
+
return Disposable.from();
|
|
75
|
+
}
|
|
76
|
+
if (p.method.kind === 'Manual') {
|
|
77
|
+
return await displayStickyManualInstallationPrompt(severity, reason, p, options, otherItems);
|
|
78
|
+
}
|
|
79
|
+
const installDepsItem = {
|
|
80
|
+
input: 'Install Dependencies',
|
|
81
|
+
continueDisplaying: false,
|
|
82
|
+
action: async () => {
|
|
83
|
+
await this.installMissingDepsAndDisplayNotification(p);
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
return displayStickyNotificationWithOptionalInput(severity, installDependenciesPrompt(reason, p), options, [
|
|
87
|
+
installDepsItem,
|
|
88
|
+
...otherItems,
|
|
89
|
+
]);
|
|
90
|
+
}
|
|
91
|
+
async installMissingDepsAndDisplayNotification(p) {
|
|
92
|
+
const r = await this.installMissingDeps(p);
|
|
93
|
+
switch (r.kind) {
|
|
94
|
+
case 'Success':
|
|
95
|
+
displayNotification('Information', 'Dependency installation successful!');
|
|
96
|
+
return 'Success';
|
|
97
|
+
case 'Error':
|
|
98
|
+
await displayModalResultError(r.result, unsuccessfulDependencyInstallationPrompt(p));
|
|
99
|
+
return 'Failure';
|
|
100
|
+
case 'Cancelled':
|
|
101
|
+
return 'Failure';
|
|
102
|
+
case 'PendingInstall':
|
|
103
|
+
return 'PendingInstall';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async installMissingDeps(p) {
|
|
107
|
+
if (p.method.kind === 'Manual') {
|
|
108
|
+
throw new Error('got manual installation method in `installMissingDeps`');
|
|
109
|
+
}
|
|
110
|
+
if (this.pendingInstall) {
|
|
111
|
+
displayNotification('Error', 'Dependencies are already being installed.');
|
|
112
|
+
return { kind: 'PendingInstall' };
|
|
113
|
+
}
|
|
114
|
+
this.pendingInstall = true;
|
|
115
|
+
try {
|
|
116
|
+
const installationResult = await this.runCommand(p.method.script, [], 'Installing missing dependencies', p.method.shell);
|
|
117
|
+
switch (installationResult.exitCode) {
|
|
118
|
+
case ExecutionExitCode.Success:
|
|
119
|
+
this.addDepsToProcessEnv(p.method);
|
|
120
|
+
return { kind: 'Success' };
|
|
121
|
+
case ExecutionExitCode.CannotLaunch:
|
|
122
|
+
case ExecutionExitCode.ExecutionError:
|
|
123
|
+
return { kind: 'Error', result: installationResult };
|
|
124
|
+
case ExecutionExitCode.Cancelled:
|
|
125
|
+
return { kind: 'Cancelled' };
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
finally {
|
|
129
|
+
this.pendingInstall = false;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
addDepsToProcessEnv(method) {
|
|
133
|
+
if (method.kind !== 'Automatic') {
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
for (const pathExt of method.pathExtensions) {
|
|
137
|
+
addToProcessEnvPATH(pathExt);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
async determineDependencyInstallationProcedure() {
|
|
141
|
+
const p = await this.determineMissingDependencyInstallationProcedure();
|
|
142
|
+
if (p === undefined) {
|
|
143
|
+
return { kind: 'AllDepsInstalled' };
|
|
144
|
+
}
|
|
145
|
+
return { ...p, method: dependencyInstallationMethod(p) };
|
|
146
|
+
}
|
|
147
|
+
async determineMissingDependencyInstallationProcedure() {
|
|
148
|
+
const isCurlAvailable = await this.diagnoser.checkCurlAvailable();
|
|
149
|
+
const isGitAvailable = await this.diagnoser.checkGitAvailable();
|
|
150
|
+
if (isCurlAvailable && isGitAvailable) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
switch (os.type()) {
|
|
154
|
+
case 'Linux':
|
|
155
|
+
const isAptAvailable = await this.diagnoser.checkAptGetAvailable();
|
|
156
|
+
if (isAptAvailable) {
|
|
157
|
+
const isPkExecAvailable = await this.diagnoser.checkPkExecAvailable();
|
|
158
|
+
return {
|
|
159
|
+
kind: 'Linux',
|
|
160
|
+
isCurlAvailable,
|
|
161
|
+
isGitAvailable,
|
|
162
|
+
packageManager: { kind: 'Apt', isPkExecAvailable },
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const isDnfAvailable = await this.diagnoser.checkDnfAvailable();
|
|
166
|
+
if (isDnfAvailable) {
|
|
167
|
+
const isPkExecAvailable = await this.diagnoser.checkPkExecAvailable();
|
|
168
|
+
return {
|
|
169
|
+
kind: 'Linux',
|
|
170
|
+
isCurlAvailable,
|
|
171
|
+
isGitAvailable,
|
|
172
|
+
packageManager: { kind: 'Dnf', isPkExecAvailable },
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
kind: 'Linux',
|
|
177
|
+
isCurlAvailable,
|
|
178
|
+
isGitAvailable,
|
|
179
|
+
packageManager: { kind: 'Other' },
|
|
180
|
+
};
|
|
181
|
+
case 'Darwin':
|
|
182
|
+
return {
|
|
183
|
+
kind: 'MacOS',
|
|
184
|
+
isCurlAvailable: true,
|
|
185
|
+
isGitAvailable,
|
|
186
|
+
};
|
|
187
|
+
case 'Windows_NT':
|
|
188
|
+
const isWinGetAvailable = await this.diagnoser.checkWinGetAvailable();
|
|
189
|
+
return {
|
|
190
|
+
kind: 'Windows',
|
|
191
|
+
isCurlAvailable: true,
|
|
192
|
+
isGitAvailable,
|
|
193
|
+
isWinGetAvailable,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
return {
|
|
197
|
+
kind: 'Other',
|
|
198
|
+
isCurlAvailable,
|
|
199
|
+
isGitAvailable,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
async runCommand(executablePath, args, title, shell) {
|
|
203
|
+
const options = {
|
|
204
|
+
allowCancellation: true,
|
|
205
|
+
channel: this.outputChannel,
|
|
206
|
+
shell,
|
|
207
|
+
};
|
|
208
|
+
return batchExecuteWithProgress(executablePath, args, 'Dependency Installation', title, options);
|
|
209
|
+
}
|
|
210
|
+
dispose() {
|
|
211
|
+
for (const s of this.subscriptions) {
|
|
212
|
+
s.dispose();
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function dependencyInstallationMethod(p) {
|
|
217
|
+
switch (p.kind) {
|
|
218
|
+
case 'Linux':
|
|
219
|
+
switch (p.packageManager.kind) {
|
|
220
|
+
case 'Apt':
|
|
221
|
+
const manualAptScript = `sudo apt update && sudo apt install ${missingDeps(p).join(' ')}`;
|
|
222
|
+
if (!p.packageManager.isPkExecAvailable) {
|
|
223
|
+
return {
|
|
224
|
+
kind: 'Manual',
|
|
225
|
+
script: manualAptScript,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
kind: 'Automatic',
|
|
230
|
+
shell: 'Unix',
|
|
231
|
+
// `ulimit -Sn 1024`: https://github.com/microsoft/vscode/issues/237427
|
|
232
|
+
script: `ulimit -Sn 1024; pkexec bash -c 'export DEBIAN_FRONTEND=noninteractive; apt-get update -y && apt-get install -y ${missingDeps(p).join(' ')}'`,
|
|
233
|
+
manualBackupScript: manualAptScript,
|
|
234
|
+
pathExtensions: [],
|
|
235
|
+
};
|
|
236
|
+
case 'Dnf':
|
|
237
|
+
const manualDnfScript = `sudo dnf install ${missingDeps(p).join(' ')}`;
|
|
238
|
+
if (!p.packageManager.isPkExecAvailable) {
|
|
239
|
+
return {
|
|
240
|
+
kind: 'Manual',
|
|
241
|
+
script: manualDnfScript,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
kind: 'Automatic',
|
|
246
|
+
shell: 'Unix',
|
|
247
|
+
script: `pkexec dnf install -y ${missingDeps(p).join(' ')}`,
|
|
248
|
+
manualBackupScript: manualDnfScript,
|
|
249
|
+
pathExtensions: [],
|
|
250
|
+
};
|
|
251
|
+
case 'Other':
|
|
252
|
+
return {
|
|
253
|
+
kind: 'Manual',
|
|
254
|
+
script: undefined,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
case 'MacOS':
|
|
258
|
+
return {
|
|
259
|
+
kind: 'Automatic',
|
|
260
|
+
shell: 'Unix',
|
|
261
|
+
script: macOsInstallScript,
|
|
262
|
+
manualBackupScript: macOsInstallScript,
|
|
263
|
+
pathExtensions: [],
|
|
264
|
+
};
|
|
265
|
+
case 'Windows':
|
|
266
|
+
if (!p.isWinGetAvailable) {
|
|
267
|
+
return {
|
|
268
|
+
kind: 'Automatic',
|
|
269
|
+
shell: 'Windows',
|
|
270
|
+
script: windowsRawGitInstallScript,
|
|
271
|
+
manualBackupScript: undefined,
|
|
272
|
+
pathExtensions: [gitInstallDir],
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const windowsWingetGitInstallScript = 'winget install -e --id Git.Git --silent --accept-package-agreements --accept-source-agreements --disable-interactivity';
|
|
276
|
+
return {
|
|
277
|
+
kind: 'Automatic',
|
|
278
|
+
shell: 'Windows',
|
|
279
|
+
script: windowsWingetGitInstallScript,
|
|
280
|
+
manualBackupScript: windowsWingetGitInstallScript,
|
|
281
|
+
pathExtensions: [gitInstallDir],
|
|
282
|
+
};
|
|
283
|
+
case 'Other':
|
|
284
|
+
return {
|
|
285
|
+
kind: 'Manual',
|
|
286
|
+
script: undefined,
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
async function displayManualInstallationPrompt(severity, reason, p) {
|
|
291
|
+
let reasonPrefix = '';
|
|
292
|
+
if (reason !== undefined) {
|
|
293
|
+
reasonPrefix = `${reason} `;
|
|
294
|
+
}
|
|
295
|
+
if (p.method.script === undefined) {
|
|
296
|
+
await displayModalNotification(severity, `${reasonPrefix}Please install ${missingDepsSentence(p)} and restart VS Code.`);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const prompt = `${reasonPrefix}Please install ${missingDepsSentence(p)} from a terminal using the script below and restart VS Code.\n\n${p.method.script}`;
|
|
300
|
+
const copyToClipboardInput = 'Copy Script to Clipboard';
|
|
301
|
+
const choice = await displayNotificationWithInput('Information', prompt, [copyToClipboardInput], 'Close');
|
|
302
|
+
if (choice === copyToClipboardInput) {
|
|
303
|
+
await env.clipboard.writeText(p.method.script);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
async function displayStickyManualInstallationPrompt(severity, reason, p, options, otherItems = []) {
|
|
307
|
+
let reasonPrefix = '';
|
|
308
|
+
if (reason !== undefined) {
|
|
309
|
+
reasonPrefix = `${reason} `;
|
|
310
|
+
}
|
|
311
|
+
const script = p.method.script;
|
|
312
|
+
if (script === undefined) {
|
|
313
|
+
await displayModalNotification(severity, `${reasonPrefix}Please install ${missingDepsSentence(p)} and restart VS Code.`);
|
|
314
|
+
return Disposable.from();
|
|
315
|
+
}
|
|
316
|
+
const prompt = `${reasonPrefix}Please install ${missingDepsSentence(p)} from a [terminal](command:workbench.action.terminal.new) using the script below and restart VS Code.\n\n${script}`;
|
|
317
|
+
const copyToClipboardItem = {
|
|
318
|
+
input: 'Copy Script to Clipboard',
|
|
319
|
+
continueDisplaying: true,
|
|
320
|
+
action: async () => {
|
|
321
|
+
await env.clipboard.writeText(script);
|
|
322
|
+
},
|
|
323
|
+
};
|
|
324
|
+
return displayStickyNotificationWithOptionalInput(severity, prompt, options, [copyToClipboardItem, ...otherItems]);
|
|
325
|
+
}
|
|
326
|
+
export function missingDepsSentence(p) {
|
|
327
|
+
return sentenceJoin(missingDeps(p).map(d => '`' + d + '`'));
|
|
328
|
+
}
|
|
329
|
+
export function sentenceJoin(entries) {
|
|
330
|
+
if (entries.length === 0) {
|
|
331
|
+
throw new Error('Cannot join empty array.');
|
|
332
|
+
}
|
|
333
|
+
if (entries.length === 1) {
|
|
334
|
+
return entries[0];
|
|
335
|
+
}
|
|
336
|
+
if (entries.length === 2) {
|
|
337
|
+
return `${entries[0]} and ${entries[1]}`;
|
|
338
|
+
}
|
|
339
|
+
return `${entries.slice(0, entries.length - 1).join(', ')} and ${entries[entries.length - 1]}`;
|
|
340
|
+
}
|
|
341
|
+
export function missingDeps(p) {
|
|
342
|
+
const missingDeps = [];
|
|
343
|
+
if (!p.isGitAvailable) {
|
|
344
|
+
missingDeps.push('git');
|
|
345
|
+
}
|
|
346
|
+
if (!p.isCurlAvailable) {
|
|
347
|
+
missingDeps.push('curl');
|
|
348
|
+
}
|
|
349
|
+
return missingDeps;
|
|
350
|
+
}
|
|
351
|
+
function installDependenciesPrompt(reason, p) {
|
|
352
|
+
if (p.method.kind === 'Manual') {
|
|
353
|
+
throw new Error('cannot display installDependenciesPrompt for manual installation');
|
|
354
|
+
}
|
|
355
|
+
let reasonPrefix = '';
|
|
356
|
+
if (reason !== undefined) {
|
|
357
|
+
reasonPrefix = `${reason} `;
|
|
358
|
+
}
|
|
359
|
+
return `${reasonPrefix}Do you wish to install ${missingDepsSentence(p)}?`;
|
|
360
|
+
}
|
|
361
|
+
export function unsuccessfulDependencyInstallationPrompt(p) {
|
|
362
|
+
if (p.method.kind === 'Manual') {
|
|
363
|
+
throw new Error('cannot display unsuccessfulDependencyInstallationPrompt for manual installation');
|
|
364
|
+
}
|
|
365
|
+
if (p.method.manualBackupScript === undefined) {
|
|
366
|
+
return `Installation of ${missingDepsSentence(p)} unsuccessful.`;
|
|
367
|
+
}
|
|
368
|
+
return `Installation of ${missingDepsSentence(p)} unsuccessful.
|
|
369
|
+
If you are unable to figure out the issue from the command output below, you can also try running the following manual installation script from a terminal:
|
|
370
|
+
|
|
371
|
+
${p.method.manualBackupScript}`;
|
|
372
|
+
}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** @module See `rollup.config.js` for what this file does. */
|
|
2
|
-
import * as ReactDOM from 'react-dom';
|
|
3
|
-
import { createPortal, createRoot, findDOMNode, flushSync, hydrate, hydrateRoot, render, unmountComponentAtNode, unstable_batchedUpdates, unstable_renderSubtreeIntoContainer, version, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } from 'react-dom';
|
|
4
|
-
export default ReactDOM;
|
|
5
|
-
export { __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, createPortal, createRoot, findDOMNode, flushSync, hydrate, hydrateRoot, render, unmountComponentAtNode, unstable_batchedUpdates, unstable_renderSubtreeIntoContainer, version, };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/** @module See `rollup.config.js` for what this file does. */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
export default React;
|
|
4
|
-
import { Children, cloneElement, Component, createContext, createElement, createFactory, createRef, forwardRef, Fragment, isValidElement, lazy, memo, Profiler, PureComponent, startTransition, StrictMode, Suspense, unstable_act, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED } from 'react';
|
|
5
|
-
export { Children, Component, Fragment, Profiler, PureComponent, StrictMode, Suspense, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, cloneElement, createContext, createElement, createFactory, createRef, forwardRef, isValidElement, lazy, memo, startTransition, unstable_act, useCallback, useContext, useDebugValue, useDeferredValue, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore, useTransition, version, };
|