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
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* For LSP communication, we need a way to translate between LSP types and corresponding VSCode types.
|
|
3
|
-
* By default this translation is provided as a bunch of methods on a `LanguageClient`, but this is
|
|
4
|
-
* awkward to use in multi-client workspaces wherein we need to look up specific clients. In fact the
|
|
5
|
-
* conversions are *not* stateful, so having them depend on the client is unnecessary. Instead, we
|
|
6
|
-
* provide global converters here.
|
|
7
|
-
*
|
|
8
|
-
* Some of the conversions are patched to support extended Lean-specific structures.
|
|
9
|
-
*
|
|
10
|
-
* @module
|
|
11
|
-
*/
|
|
12
|
-
import * as code from 'vscode';
|
|
13
|
-
import { createConverter as createC2PConverter } from 'vscode-languageclient/lib/common/codeConverter';
|
|
14
|
-
import { createConverter as createP2CConverter } from 'vscode-languageclient/lib/common/protocolConverter';
|
|
15
|
-
import * as async from 'vscode-languageclient/lib/common/utils/async';
|
|
16
|
-
import * as ls from 'vscode-languageserver-protocol';
|
|
17
|
-
import { automaticallyBuildDependencies } from '../config';
|
|
18
|
-
var SnippetTextEdit;
|
|
19
|
-
(function (SnippetTextEdit) {
|
|
20
|
-
function is(value) {
|
|
21
|
-
if (!ls.TextEdit.is(value))
|
|
22
|
-
return false;
|
|
23
|
-
if (!('leanExtSnippet' in value))
|
|
24
|
-
return false;
|
|
25
|
-
const snip = value.leanExtSnippet;
|
|
26
|
-
if (snip === null || typeof snip !== 'object')
|
|
27
|
-
return false;
|
|
28
|
-
if (!('value' in snip))
|
|
29
|
-
return false;
|
|
30
|
-
if (typeof snip.value !== 'string' && !(snip.value instanceof String))
|
|
31
|
-
return false;
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
SnippetTextEdit.is = is;
|
|
35
|
-
})(SnippetTextEdit || (SnippetTextEdit = {}));
|
|
36
|
-
export function setDependencyBuildMode(params, dependencyBuildMode) {
|
|
37
|
-
const updatedParams = params;
|
|
38
|
-
updatedParams.dependencyBuildMode = automaticallyBuildDependencies() ? 'always' : dependencyBuildMode;
|
|
39
|
-
return updatedParams;
|
|
40
|
-
}
|
|
41
|
-
export const p2cConverter = createP2CConverter(undefined, true, true);
|
|
42
|
-
export const c2pConverter = createC2PConverter(undefined);
|
|
43
|
-
export function patchConverters(p2cConverter, c2pConverter) {
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
45
|
-
const oldP2cAsDiagnostic = p2cConverter.asDiagnostic;
|
|
46
|
-
p2cConverter.asDiagnostic = function (protDiag) {
|
|
47
|
-
if (!protDiag.message) {
|
|
48
|
-
// Fixes: Notification handler 'textDocument/publishDiagnostics' failed with message: message must be set
|
|
49
|
-
protDiag.message = ' ';
|
|
50
|
-
}
|
|
51
|
-
const diag = oldP2cAsDiagnostic.apply(this, [protDiag]);
|
|
52
|
-
diag.fullRange = p2cConverter.asRange(protDiag.fullRange);
|
|
53
|
-
return diag;
|
|
54
|
-
};
|
|
55
|
-
// The original definition refers to `asDiagnostic` as a local function
|
|
56
|
-
// rather than as a member of `Protocol2CodeConverter`,
|
|
57
|
-
// so we need to overwrite it, too.
|
|
58
|
-
p2cConverter.asDiagnostics = async (diags, token) => async.map(diags, d => p2cConverter.asDiagnostic(d), token);
|
|
59
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
60
|
-
const oldC2pAsDiagnostic = c2pConverter.asDiagnostic;
|
|
61
|
-
c2pConverter.asDiagnostic = function (diag) {
|
|
62
|
-
const protDiag = oldC2pAsDiagnostic.apply(this, [diag]);
|
|
63
|
-
protDiag.fullRange = c2pConverter.asRange(diag.fullRange);
|
|
64
|
-
return protDiag;
|
|
65
|
-
};
|
|
66
|
-
c2pConverter.asDiagnostics = async (diags, token) => async.map(diags, d => c2pConverter.asDiagnostic(d), token);
|
|
67
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
68
|
-
const oldC2pAsOpenTextDocumentParams = c2pConverter.asOpenTextDocumentParams;
|
|
69
|
-
c2pConverter.asOpenTextDocumentParams = doc => {
|
|
70
|
-
const params = oldC2pAsOpenTextDocumentParams.apply(this, [doc]);
|
|
71
|
-
return setDependencyBuildMode(params, 'never');
|
|
72
|
-
};
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
74
|
-
const oldP2CAsWorkspaceEdit = p2cConverter.asWorkspaceEdit;
|
|
75
|
-
p2cConverter.asWorkspaceEdit = async function (item, token) {
|
|
76
|
-
if (item === undefined || item === null)
|
|
77
|
-
return undefined;
|
|
78
|
-
if (item.documentChanges) {
|
|
79
|
-
// 1. Preprocess `documentChanges` by filtering out snippet edits
|
|
80
|
-
// which we support as a Lean-specific extension.
|
|
81
|
-
// 2. Create a `WorkspaceEdit` using the default function
|
|
82
|
-
// which does not take snippet edits into account.
|
|
83
|
-
// 3. Append the snippet edits.
|
|
84
|
-
// Note that this may permute the relative ordering of snippet edits and text edits,
|
|
85
|
-
// so users cannot rely on it;
|
|
86
|
-
// but a mix of both doesn't seem to work in VSCode anyway as of 1.84.2.
|
|
87
|
-
const snippetChanges = [];
|
|
88
|
-
const documentChanges = await async.map(item.documentChanges, change => {
|
|
89
|
-
if (!ls.TextDocumentEdit.is(change))
|
|
90
|
-
return true;
|
|
91
|
-
const uri = code.Uri.parse(change.textDocument.uri);
|
|
92
|
-
const snippetEdits = [];
|
|
93
|
-
const edits = change.edits.filter(edit => {
|
|
94
|
-
if (!SnippetTextEdit.is(edit))
|
|
95
|
-
return true;
|
|
96
|
-
const range = p2cConverter.asRange(edit.range);
|
|
97
|
-
snippetEdits.push(new code.SnippetTextEdit(range, new code.SnippetString(edit.leanExtSnippet.value)));
|
|
98
|
-
return false;
|
|
99
|
-
});
|
|
100
|
-
snippetChanges.push([uri, snippetEdits]);
|
|
101
|
-
return { ...change, edits };
|
|
102
|
-
}, token);
|
|
103
|
-
const newItem = { ...item, documentChanges };
|
|
104
|
-
const result = await oldP2CAsWorkspaceEdit.apply(this, [newItem, token]);
|
|
105
|
-
for (const [uri, snippetEdits] of snippetChanges)
|
|
106
|
-
result.set(uri, snippetEdits);
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
return oldP2CAsWorkspaceEdit.apply(this, [item, token]);
|
|
110
|
-
};
|
|
111
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
112
|
-
const oldP2cAsCodeAction = p2cConverter.asCodeAction;
|
|
113
|
-
p2cConverter.asCodeAction = async function (item, token) {
|
|
114
|
-
if (item === undefined || item === null)
|
|
115
|
-
return undefined;
|
|
116
|
-
if (item.edit || item.diagnostics) {
|
|
117
|
-
const result = await oldP2cAsCodeAction.apply(this, [item, token]);
|
|
118
|
-
if (item.diagnostics !== undefined)
|
|
119
|
-
result.diagnostics = await p2cConverter.asDiagnostics(item.diagnostics, token);
|
|
120
|
-
if (item.edit)
|
|
121
|
-
result.edit = await p2cConverter.asWorkspaceEdit(item.edit, token);
|
|
122
|
-
}
|
|
123
|
-
return oldP2cAsCodeAction.apply(this, [item, token]);
|
|
124
|
-
};
|
|
125
|
-
// Note: as of 2023-12-10, there is no c2pConverter.asWorkspaceEdit.
|
|
126
|
-
// This is possibly because code.WorkspaceEdit supports features
|
|
127
|
-
// that cannot be encoded in ls.WorkspaceEdit.
|
|
128
|
-
}
|
|
129
|
-
patchConverters(p2cConverter, c2pConverter);
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/** Platform independent interface to work with the PATH variable. */
|
|
3
|
-
export declare class PATH {
|
|
4
|
-
paths: string[];
|
|
5
|
-
constructor(paths: string[]);
|
|
6
|
-
static empty(): PATH;
|
|
7
|
-
static ofEnvPath(envPath: string): PATH;
|
|
8
|
-
static ofEnv(env: NodeJS.ProcessEnv): PATH;
|
|
9
|
-
static ofProcessEnv(): PATH;
|
|
10
|
-
toEnvPath(): string;
|
|
11
|
-
setInEnv(env: NodeJS.ProcessEnv): void;
|
|
12
|
-
setInProcessEnv(): void;
|
|
13
|
-
prepend(path: string): PATH;
|
|
14
|
-
join(other: PATH): PATH;
|
|
15
|
-
length(): number;
|
|
16
|
-
isEmpty(): boolean;
|
|
17
|
-
includes(path: string): boolean;
|
|
18
|
-
filter(p: (path: string) => boolean): PATH;
|
|
19
|
-
}
|
|
20
|
-
export declare function setPATH(env: NodeJS.ProcessEnv, path: PATH): void;
|
|
21
|
-
export declare function setProcessEnvPATH(path: PATH): void;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import * as path from 'path';
|
|
2
|
-
/** Platform independent interface to work with the PATH variable. */
|
|
3
|
-
export class PATH {
|
|
4
|
-
paths;
|
|
5
|
-
constructor(paths) {
|
|
6
|
-
this.paths = paths;
|
|
7
|
-
}
|
|
8
|
-
static empty() {
|
|
9
|
-
return new PATH([]);
|
|
10
|
-
}
|
|
11
|
-
static ofEnvPath(envPath) {
|
|
12
|
-
return new PATH(envPath.split(path.delimiter));
|
|
13
|
-
}
|
|
14
|
-
static ofEnv(env) {
|
|
15
|
-
return PATH.ofEnvPath(env.PATH ?? '');
|
|
16
|
-
}
|
|
17
|
-
static ofProcessEnv() {
|
|
18
|
-
return PATH.ofEnv(process.env);
|
|
19
|
-
}
|
|
20
|
-
toEnvPath() {
|
|
21
|
-
return this.paths.join(path.delimiter);
|
|
22
|
-
}
|
|
23
|
-
setInEnv(env) {
|
|
24
|
-
env.PATH = this.toEnvPath();
|
|
25
|
-
}
|
|
26
|
-
setInProcessEnv() {
|
|
27
|
-
this.setInEnv(process.env);
|
|
28
|
-
}
|
|
29
|
-
prepend(path) {
|
|
30
|
-
return new PATH([path].concat(this.paths));
|
|
31
|
-
}
|
|
32
|
-
join(other) {
|
|
33
|
-
return new PATH(this.paths.concat(other.paths));
|
|
34
|
-
}
|
|
35
|
-
length() {
|
|
36
|
-
return this.paths.length;
|
|
37
|
-
}
|
|
38
|
-
isEmpty() {
|
|
39
|
-
return this.length() === 0;
|
|
40
|
-
}
|
|
41
|
-
includes(path) {
|
|
42
|
-
return this.paths.includes(path);
|
|
43
|
-
}
|
|
44
|
-
filter(p) {
|
|
45
|
-
return new PATH(this.paths.filter(p));
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export function setPATH(env, path) {
|
|
49
|
-
path.setInEnv(env);
|
|
50
|
-
}
|
|
51
|
-
export function setProcessEnvPATH(path) {
|
|
52
|
-
setPATH(process.env, path);
|
|
53
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Uri } from 'vscode';
|
|
2
|
-
export declare class FileUri {
|
|
3
|
-
scheme: 'file';
|
|
4
|
-
fsPath: string;
|
|
5
|
-
constructor(fsPath: string);
|
|
6
|
-
static fromUri(uri: Uri): FileUri | undefined;
|
|
7
|
-
static fromUriOrError(uri: Uri): FileUri;
|
|
8
|
-
asUri(): Uri;
|
|
9
|
-
equals(other: FileUri): boolean;
|
|
10
|
-
equalsUri(other: Uri): boolean;
|
|
11
|
-
toString(): string;
|
|
12
|
-
join(...pathSegments: string[]): FileUri;
|
|
13
|
-
isInFolder(folderUri: FileUri): boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function getWorkspaceFolderUri(uri: FileUri): FileUri | undefined;
|
|
16
|
-
export declare class UntitledUri {
|
|
17
|
-
scheme: 'untitled';
|
|
18
|
-
path: string;
|
|
19
|
-
constructor(path?: string | undefined);
|
|
20
|
-
static fromUri(uri: Uri): UntitledUri | undefined;
|
|
21
|
-
static fromUriOrError(uri: Uri): UntitledUri;
|
|
22
|
-
asUri(): Uri;
|
|
23
|
-
equals(other: UntitledUri): boolean;
|
|
24
|
-
equalsUri(other: Uri): boolean;
|
|
25
|
-
toString(): string;
|
|
26
|
-
}
|
|
27
|
-
/** Uris supported by this extension. */
|
|
28
|
-
export type ExtUri = FileUri | UntitledUri;
|
|
29
|
-
export declare function isExtUri(uri: Uri): boolean;
|
|
30
|
-
export declare function toExtUri(uri: Uri): ExtUri | undefined;
|
|
31
|
-
export declare function toExtUriOrError(uri: Uri): ExtUri;
|
|
32
|
-
export declare function parseExtUri(uriString: string): ExtUri | undefined;
|
|
33
|
-
export declare function parseExtUriOrError(uriString: string): ExtUri;
|
|
34
|
-
export declare function extUriEquals(a: ExtUri, b: ExtUri): boolean;
|
|
35
|
-
export declare function extUriToCwdUri(uri: ExtUri): FileUri | undefined;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import { Uri, workspace } from 'vscode';
|
|
2
|
-
import { isFileInFolder } from './fsHelper';
|
|
3
|
-
function unsupportedSchemeError(uri) {
|
|
4
|
-
return new Error(`Got URI with unsupported scheme '${uri.scheme}': '${uri}'`);
|
|
5
|
-
}
|
|
6
|
-
export class FileUri {
|
|
7
|
-
scheme;
|
|
8
|
-
fsPath;
|
|
9
|
-
constructor(fsPath) {
|
|
10
|
-
this.scheme = 'file';
|
|
11
|
-
this.fsPath = fsPath;
|
|
12
|
-
}
|
|
13
|
-
static fromUri(uri) {
|
|
14
|
-
if (uri.scheme !== 'file') {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
return new FileUri(uri.fsPath);
|
|
18
|
-
}
|
|
19
|
-
static fromUriOrError(uri) {
|
|
20
|
-
const fileUri = FileUri.fromUri(uri);
|
|
21
|
-
if (fileUri === undefined) {
|
|
22
|
-
throw unsupportedSchemeError(uri);
|
|
23
|
-
}
|
|
24
|
-
return fileUri;
|
|
25
|
-
}
|
|
26
|
-
asUri() {
|
|
27
|
-
return Uri.file(this.fsPath);
|
|
28
|
-
}
|
|
29
|
-
equals(other) {
|
|
30
|
-
return this.fsPath === other.fsPath;
|
|
31
|
-
}
|
|
32
|
-
equalsUri(other) {
|
|
33
|
-
const otherFileUri = FileUri.fromUri(other);
|
|
34
|
-
if (otherFileUri === undefined) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
return this.equals(otherFileUri);
|
|
38
|
-
}
|
|
39
|
-
toString() {
|
|
40
|
-
return this.asUri().toString();
|
|
41
|
-
}
|
|
42
|
-
join(...pathSegments) {
|
|
43
|
-
return FileUri.fromUriOrError(Uri.joinPath(this.asUri(), ...pathSegments));
|
|
44
|
-
}
|
|
45
|
-
isInFolder(folderUri) {
|
|
46
|
-
return isFileInFolder(this.fsPath, folderUri.fsPath);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
export function getWorkspaceFolderUri(uri) {
|
|
50
|
-
const folder = workspace.getWorkspaceFolder(uri.asUri());
|
|
51
|
-
if (folder === undefined) {
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
const folderUri = FileUri.fromUri(folder.uri);
|
|
55
|
-
if (folderUri === undefined) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
return folderUri;
|
|
59
|
-
}
|
|
60
|
-
export class UntitledUri {
|
|
61
|
-
scheme;
|
|
62
|
-
path;
|
|
63
|
-
constructor(path) {
|
|
64
|
-
this.scheme = 'untitled';
|
|
65
|
-
this.path = path ?? '';
|
|
66
|
-
}
|
|
67
|
-
static fromUri(uri) {
|
|
68
|
-
if (uri.scheme !== 'untitled') {
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
return new UntitledUri(uri.path);
|
|
72
|
-
}
|
|
73
|
-
static fromUriOrError(uri) {
|
|
74
|
-
const untitledUri = UntitledUri.fromUri(uri);
|
|
75
|
-
if (untitledUri === undefined) {
|
|
76
|
-
throw unsupportedSchemeError(uri);
|
|
77
|
-
}
|
|
78
|
-
return untitledUri;
|
|
79
|
-
}
|
|
80
|
-
asUri() {
|
|
81
|
-
return Uri.from({ scheme: 'untitled', path: this.path });
|
|
82
|
-
}
|
|
83
|
-
equals(other) {
|
|
84
|
-
return this.path === other.path;
|
|
85
|
-
}
|
|
86
|
-
equalsUri(other) {
|
|
87
|
-
const otherFileUri = UntitledUri.fromUri(other);
|
|
88
|
-
if (otherFileUri === undefined) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
return this.equals(otherFileUri);
|
|
92
|
-
}
|
|
93
|
-
toString() {
|
|
94
|
-
return this.asUri().toString();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
export function isExtUri(uri) {
|
|
98
|
-
return uri.scheme === 'untitled' || uri.scheme === 'file';
|
|
99
|
-
}
|
|
100
|
-
export function toExtUri(uri) {
|
|
101
|
-
if (uri.scheme === 'untitled') {
|
|
102
|
-
return new UntitledUri(uri.path);
|
|
103
|
-
}
|
|
104
|
-
if (uri.scheme === 'file') {
|
|
105
|
-
return new FileUri(uri.fsPath);
|
|
106
|
-
}
|
|
107
|
-
return undefined;
|
|
108
|
-
}
|
|
109
|
-
export function toExtUriOrError(uri) {
|
|
110
|
-
const result = toExtUri(uri);
|
|
111
|
-
if (result === undefined) {
|
|
112
|
-
throw unsupportedSchemeError(uri);
|
|
113
|
-
}
|
|
114
|
-
return result;
|
|
115
|
-
}
|
|
116
|
-
export function parseExtUri(uriString) {
|
|
117
|
-
return toExtUri(Uri.parse(uriString));
|
|
118
|
-
}
|
|
119
|
-
export function parseExtUriOrError(uriString) {
|
|
120
|
-
return toExtUriOrError(Uri.parse(uriString));
|
|
121
|
-
}
|
|
122
|
-
export function extUriEquals(a, b) {
|
|
123
|
-
if (a.scheme === 'untitled' && b.scheme === 'untitled') {
|
|
124
|
-
return a.equals(b);
|
|
125
|
-
}
|
|
126
|
-
if (a.scheme === 'file' && b.scheme === 'file') {
|
|
127
|
-
return a.equals(b);
|
|
128
|
-
}
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
export function extUriToCwdUri(uri) {
|
|
132
|
-
if (uri.scheme === 'untitled') {
|
|
133
|
-
return undefined;
|
|
134
|
-
}
|
|
135
|
-
return uri;
|
|
136
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { PathLike } from 'fs';
|
|
3
|
-
/**
|
|
4
|
-
* Returns true if `pathFile` exists and is a file
|
|
5
|
-
*/
|
|
6
|
-
export declare function fileExists(pathFile: PathLike): Promise<boolean>;
|
|
7
|
-
/**
|
|
8
|
-
* Returns true if `pathFile` exists and is a directory
|
|
9
|
-
*/
|
|
10
|
-
export declare function dirExists(pathFile: PathLike): Promise<boolean>;
|
|
11
|
-
/**
|
|
12
|
-
* This helper function is used to check if an specific file is in certain Folder.
|
|
13
|
-
* @param file string that contains a file name that will be checked if it exists in a certain folder.
|
|
14
|
-
* @param folder string that contains a folder name where it will check if a certain file exists
|
|
15
|
-
* @returns a boolean that says if the file exists in folder
|
|
16
|
-
*/
|
|
17
|
-
export declare function isFileInFolder(file: string, folder: string): boolean;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
-
import { promises } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
/**
|
|
5
|
-
* Returns true if `pathFile` exists and is a file
|
|
6
|
-
*/
|
|
7
|
-
export async function fileExists(pathFile) {
|
|
8
|
-
try {
|
|
9
|
-
return (await promises.stat(pathFile)).isFile();
|
|
10
|
-
}
|
|
11
|
-
catch (e) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Returns true if `pathFile` exists and is a directory
|
|
17
|
-
*/
|
|
18
|
-
export async function dirExists(pathFile) {
|
|
19
|
-
try {
|
|
20
|
-
return (await promises.stat(pathFile)).isDirectory();
|
|
21
|
-
}
|
|
22
|
-
catch (e) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* This helper function is used to check if an specific file is in certain Folder.
|
|
28
|
-
* @param file string that contains a file name that will be checked if it exists in a certain folder.
|
|
29
|
-
* @param folder string that contains a folder name where it will check if a certain file exists
|
|
30
|
-
* @returns a boolean that says if the file exists in folder
|
|
31
|
-
*/
|
|
32
|
-
export function isFileInFolder(file, folder) {
|
|
33
|
-
const relative = path.relative(folder, file);
|
|
34
|
-
const isSubdir = relative.length > 0 && !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
35
|
-
return isSubdir;
|
|
36
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SemVer } from 'semver';
|
|
2
|
-
import { OutputChannel } from 'vscode';
|
|
3
|
-
import { ExtUri, FileUri } from './exturi';
|
|
4
|
-
import { NotificationSeverity } from './notifs';
|
|
5
|
-
export declare class LeanVersion {
|
|
6
|
-
version: string;
|
|
7
|
-
error: string | undefined;
|
|
8
|
-
}
|
|
9
|
-
export declare class LeanInstaller {
|
|
10
|
-
private leanInstallerLinux;
|
|
11
|
-
private leanInstallerWindows;
|
|
12
|
-
private outputChannel;
|
|
13
|
-
private prompting;
|
|
14
|
-
private installing;
|
|
15
|
-
private freshInstallDefaultToolchain;
|
|
16
|
-
private elanDefaultToolchain;
|
|
17
|
-
private workspaceSuffix;
|
|
18
|
-
private defaultSuffix;
|
|
19
|
-
private promptUser;
|
|
20
|
-
private installChangedEmitter;
|
|
21
|
-
installChanged: import("vscode").Event<FileUri>;
|
|
22
|
-
constructor(outputChannel: OutputChannel, freshInstallDefaultToolchain: string);
|
|
23
|
-
getPromptUser(): boolean;
|
|
24
|
-
getOutputChannel(): OutputChannel;
|
|
25
|
-
handleVersionChanged(packageUri: FileUri): void;
|
|
26
|
-
isPromptVisible(): boolean;
|
|
27
|
-
private showRestartPromptAndRestart;
|
|
28
|
-
handleLakeFileChanged(packageUri: FileUri): void;
|
|
29
|
-
private removeSuffix;
|
|
30
|
-
getElanDefaultToolchain(packageUri: ExtUri): Promise<string>;
|
|
31
|
-
elanListToolChains(packageUri: ExtUri): Promise<string[]>;
|
|
32
|
-
hasElan(): Promise<boolean>;
|
|
33
|
-
displayInstallElanPrompt(severity: NotificationSeverity, reason: string | undefined): Promise<boolean>;
|
|
34
|
-
displayUpdateElanPrompt(severity: NotificationSeverity, currentVersion: SemVer, recommendedVersion: SemVer): Promise<boolean>;
|
|
35
|
-
private autoInstall;
|
|
36
|
-
private installElan;
|
|
37
|
-
}
|