@spyglassmc/core 0.1.2 → 0.4.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 +7 -0
- package/lib/browser.d.ts +2 -0
- package/lib/browser.js +2 -0
- package/lib/common/Dev.d.ts +11 -0
- package/lib/common/Dev.js +90 -0
- package/lib/{service → common}/Logger.d.ts +0 -0
- package/lib/{service → common}/Logger.js +2 -5
- package/lib/common/Operations.d.ts +12 -0
- package/lib/common/Operations.js +33 -0
- package/lib/common/ReadonlyProxy.d.ts +9 -0
- package/lib/common/ReadonlyProxy.js +23 -0
- package/lib/common/StateProxy.d.ts +35 -0
- package/lib/common/StateProxy.js +69 -0
- package/lib/common/TwoWayMap.js +4 -10
- package/lib/common/externals/BrowserExternals.d.ts +3 -0
- package/lib/common/externals/BrowserExternals.js +191 -0
- package/lib/common/externals/NodeJsExternals.d.ts +3 -0
- package/lib/common/externals/NodeJsExternals.js +152 -0
- package/lib/common/externals/downloader.d.ts +31 -0
- package/lib/common/externals/downloader.js +32 -0
- package/lib/common/externals/index.d.ts +96 -0
- package/lib/common/externals/index.js +2 -0
- package/lib/common/index.d.ts +8 -1
- package/lib/common/index.js +8 -17
- package/lib/common/util.d.ts +48 -20
- package/lib/common/util.js +71 -86
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -23
- package/lib/node/AstNode.d.ts +12 -11
- package/lib/node/AstNode.js +10 -16
- package/lib/node/BooleanNode.d.ts +2 -2
- package/lib/node/BooleanNode.js +4 -7
- package/lib/node/CommentNode.d.ts +6 -5
- package/lib/node/CommentNode.js +4 -9
- package/lib/node/ErrorNode.d.ts +1 -1
- package/lib/node/ErrorNode.js +2 -5
- package/lib/node/FileNode.d.ts +8 -4
- package/lib/node/FileNode.js +3 -6
- package/lib/node/FloatNode.d.ts +3 -3
- package/lib/node/FloatNode.js +4 -7
- package/lib/node/IntegerNode.d.ts +3 -3
- package/lib/node/IntegerNode.js +4 -7
- package/lib/node/ListNode.d.ts +2 -2
- package/lib/node/ListNode.js +2 -5
- package/lib/node/LiteralNode.d.ts +4 -4
- package/lib/node/LiteralNode.js +4 -7
- package/lib/node/LongNode.d.ts +3 -3
- package/lib/node/LongNode.js +4 -7
- package/lib/node/RecordNode.d.ts +2 -2
- package/lib/node/RecordNode.js +2 -5
- package/lib/node/ResourceLocationNode.d.ts +7 -7
- package/lib/node/ResourceLocationNode.js +9 -12
- package/lib/node/Sequence.d.ts +2 -2
- package/lib/node/Sequence.js +4 -7
- package/lib/node/StringNode.d.ts +5 -5
- package/lib/node/StringNode.js +9 -12
- package/lib/node/SymbolNode.d.ts +4 -4
- package/lib/node/SymbolNode.js +4 -7
- package/lib/node/index.d.ts +15 -15
- package/lib/node/index.js +15 -31
- package/lib/nodejs.d.ts +2 -0
- package/lib/nodejs.js +2 -0
- package/lib/parser/Parser.d.ts +3 -3
- package/lib/parser/Parser.js +1 -4
- package/lib/parser/boolean.d.ts +2 -2
- package/lib/parser/boolean.js +3 -6
- package/lib/parser/comment.d.ts +2 -2
- package/lib/parser/comment.js +5 -9
- package/lib/parser/empty.d.ts +1 -1
- package/lib/parser/empty.js +1 -5
- package/lib/parser/error.d.ts +2 -2
- package/lib/parser/error.js +5 -9
- package/lib/parser/file.d.ts +3 -3
- package/lib/parser/file.js +9 -13
- package/lib/parser/float.d.ts +4 -4
- package/lib/parser/float.js +12 -16
- package/lib/parser/index.d.ts +16 -16
- package/lib/parser/index.js +16 -38
- package/lib/parser/integer.d.ts +4 -4
- package/lib/parser/integer.js +10 -14
- package/lib/parser/list.d.ts +2 -2
- package/lib/parser/list.js +15 -19
- package/lib/parser/literal.d.ts +2 -2
- package/lib/parser/literal.js +5 -9
- package/lib/parser/long.d.ts +4 -4
- package/lib/parser/long.js +10 -14
- package/lib/parser/record.d.ts +3 -3
- package/lib/parser/record.js +20 -24
- package/lib/parser/resourceLocation.d.ts +2 -2
- package/lib/parser/resourceLocation.js +12 -24
- package/lib/parser/string.d.ts +7 -7
- package/lib/parser/string.js +36 -42
- package/lib/parser/symbol.d.ts +3 -3
- package/lib/parser/symbol.js +4 -14
- package/lib/parser/util.d.ts +6 -5
- package/lib/parser/util.js +40 -60
- package/lib/processor/ColorInfoProvider.d.ts +1 -1
- package/lib/processor/ColorInfoProvider.js +6 -9
- package/lib/processor/InlayHintProvider.d.ts +4 -3
- package/lib/processor/InlayHintProvider.js +1 -2
- package/lib/processor/SignatureHelpProvider.d.ts +4 -3
- package/lib/processor/SignatureHelpProvider.js +1 -2
- package/lib/processor/binder/Binder.d.ts +26 -0
- package/lib/processor/binder/Binder.js +18 -0
- package/lib/processor/binder/builtin.d.ts +27 -0
- package/lib/processor/binder/builtin.js +116 -0
- package/lib/processor/binder/index.d.ts +3 -0
- package/lib/processor/binder/index.js +3 -0
- package/lib/processor/checker/Checker.d.ts +2 -2
- package/lib/processor/checker/Checker.js +1 -5
- package/lib/processor/checker/builtin.d.ts +4 -4
- package/lib/processor/checker/builtin.js +22 -33
- package/lib/processor/checker/index.d.ts +2 -2
- package/lib/processor/checker/index.js +2 -31
- package/lib/processor/colorizer/Colorizer.d.ts +6 -5
- package/lib/processor/colorizer/Colorizer.js +8 -11
- package/lib/processor/colorizer/builtin.d.ts +3 -3
- package/lib/processor/colorizer/builtin.js +34 -46
- package/lib/processor/colorizer/index.d.ts +2 -2
- package/lib/processor/colorizer/index.js +2 -31
- package/lib/processor/completer/Completer.d.ts +6 -5
- package/lib/processor/completer/Completer.js +14 -33
- package/lib/processor/completer/builtin.d.ts +10 -9
- package/lib/processor/completer/builtin.js +47 -63
- package/lib/processor/completer/index.d.ts +2 -2
- package/lib/processor/completer/index.js +2 -31
- package/lib/processor/formatter/Formatter.d.ts +4 -3
- package/lib/processor/formatter/Formatter.js +2 -7
- package/lib/processor/formatter/builtin.d.ts +3 -3
- package/lib/processor/formatter/builtin.js +22 -36
- package/lib/processor/formatter/index.d.ts +2 -2
- package/lib/processor/formatter/index.js +2 -31
- package/lib/processor/index.d.ts +10 -9
- package/lib/processor/index.js +10 -25
- package/lib/processor/linter/Linter.d.ts +4 -3
- package/lib/processor/linter/Linter.js +1 -2
- package/lib/processor/linter/builtin/undeclaredSymbol.d.ts +2 -2
- package/lib/processor/linter/builtin/undeclaredSymbol.js +20 -24
- package/lib/processor/linter/builtin.d.ts +4 -3
- package/lib/processor/linter/builtin.js +19 -26
- package/lib/processor/linter/index.d.ts +2 -2
- package/lib/processor/linter/index.js +2 -31
- package/lib/processor/util.d.ts +4 -14
- package/lib/processor/util.js +1 -16
- package/lib/service/CacheService.d.ts +13 -8
- package/lib/service/CacheService.js +45 -57
- package/lib/service/Config.d.ts +11 -12
- package/lib/service/Config.js +50 -45
- package/lib/service/Context.d.ts +23 -20
- package/lib/service/Context.js +39 -36
- package/lib/service/Dependency.js +2 -5
- package/lib/service/Downloader.d.ts +9 -40
- package/lib/service/Downloader.js +37 -110
- package/lib/service/ErrorReporter.d.ts +2 -2
- package/lib/service/ErrorReporter.js +10 -14
- package/lib/service/FileService.d.ts +15 -14
- package/lib/service/FileService.js +55 -92
- package/lib/service/Hover.d.ts +2 -2
- package/lib/service/Hover.js +4 -7
- package/lib/service/MetaRegistry.d.ts +22 -12
- package/lib/service/MetaRegistry.js +81 -73
- package/lib/service/Profiler.d.ts +3 -2
- package/lib/service/Profiler.js +81 -45
- package/lib/service/Project.d.ts +105 -76
- package/lib/service/Project.js +449 -370
- package/lib/service/Service.d.ts +17 -27
- package/lib/service/Service.js +37 -43
- package/lib/service/SymbolLocations.d.ts +3 -3
- package/lib/service/SymbolLocations.js +4 -7
- package/lib/service/SymbolRegistrar.d.ts +1 -1
- package/lib/service/SymbolRegistrar.js +1 -2
- package/lib/service/UriProcessor.d.ts +5 -0
- package/lib/service/UriProcessor.js +2 -0
- package/lib/service/fileUtil.d.ts +15 -45
- package/lib/service/fileUtil.js +38 -143
- package/lib/service/index.d.ts +16 -17
- package/lib/service/index.js +16 -35
- package/lib/source/IndexMap.d.ts +1 -1
- package/lib/source/IndexMap.js +7 -10
- package/lib/source/LanguageError.d.ts +20 -6
- package/lib/source/LanguageError.js +16 -9
- package/lib/source/Location.d.ts +3 -3
- package/lib/source/Location.js +6 -9
- package/lib/source/Offset.d.ts +1 -1
- package/lib/source/Offset.js +4 -7
- package/lib/source/Position.js +2 -5
- package/lib/source/PositionRange.d.ts +3 -3
- package/lib/source/PositionRange.js +17 -20
- package/lib/source/Range.d.ts +1 -1
- package/lib/source/Range.js +7 -10
- package/lib/source/Source.d.ts +5 -3
- package/lib/source/Source.js +34 -29
- package/lib/source/index.d.ts +8 -8
- package/lib/source/index.js +8 -24
- package/lib/symbol/Symbol.d.ts +5 -4
- package/lib/symbol/Symbol.js +49 -65
- package/lib/symbol/SymbolUtil.d.ts +29 -31
- package/lib/symbol/SymbolUtil.js +178 -157
- package/lib/symbol/index.d.ts +2 -3
- package/lib/symbol/index.js +2 -19
- package/package.json +7 -4
- package/lib/service/Operations.d.ts +0 -8
- package/lib/service/Operations.js +0 -26
- package/lib/symbol/UriBinder.d.ts +0 -3
- package/lib/symbol/UriBinder.js +0 -3
package/lib/service/Project.d.ts
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import EventEmitter from 'events';
|
|
3
1
|
import type { TextDocumentContentChangeEvent } from 'vscode-languageserver-textdocument';
|
|
4
2
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
import type {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
export declare type
|
|
19
|
-
|
|
20
|
-
|
|
3
|
+
import type { ExternalEventEmitter, Externals } from '../common/index.js';
|
|
4
|
+
import { Logger } from '../common/index.js';
|
|
5
|
+
import type { AstNode } from '../node/index.js';
|
|
6
|
+
import { FileNode } from '../node/index.js';
|
|
7
|
+
import type { PosRangeLanguageError } from '../source/index.js';
|
|
8
|
+
import { SymbolUtil } from '../symbol/index.js';
|
|
9
|
+
import { CacheService } from './CacheService.js';
|
|
10
|
+
import type { Config } from './Config.js';
|
|
11
|
+
import { Downloader } from './Downloader.js';
|
|
12
|
+
import { FileService } from './FileService.js';
|
|
13
|
+
import type { RootUriString } from './fileUtil.js';
|
|
14
|
+
import { MetaRegistry } from './MetaRegistry.js';
|
|
15
|
+
import { ProfilerFactory } from './Profiler.js';
|
|
16
|
+
export declare type ProjectInitializerContext = Pick<Project, 'cacheRoot' | 'config' | 'downloader' | 'externals' | 'logger' | 'meta' | 'projectRoot'>;
|
|
17
|
+
export declare type SyncProjectInitializer = (this: void, ctx: ProjectInitializerContext) => Record<string, string> | void;
|
|
18
|
+
export declare type AsyncProjectInitializer = (this: void, ctx: ProjectInitializerContext) => PromiseLike<Record<string, string> | void>;
|
|
19
|
+
export declare type ProjectInitializer = SyncProjectInitializer | AsyncProjectInitializer;
|
|
20
|
+
export interface ProjectOptions {
|
|
21
|
+
cacheRoot: RootUriString;
|
|
22
|
+
defaultConfig?: Config;
|
|
21
23
|
downloader?: Downloader;
|
|
24
|
+
externals: Externals;
|
|
22
25
|
fs?: FileService;
|
|
23
26
|
initializers?: readonly ProjectInitializer[];
|
|
24
27
|
logger?: Logger;
|
|
25
28
|
profilers?: ProfilerFactory;
|
|
26
29
|
/**
|
|
27
|
-
* A file
|
|
30
|
+
* A file URI to the root of this project.
|
|
28
31
|
*/
|
|
29
|
-
|
|
32
|
+
projectRoot: RootUriString;
|
|
30
33
|
symbols?: SymbolUtil;
|
|
31
34
|
}
|
|
32
35
|
export interface DocAndNode {
|
|
@@ -35,8 +38,10 @@ export interface DocAndNode {
|
|
|
35
38
|
}
|
|
36
39
|
interface DocumentEvent extends DocAndNode {
|
|
37
40
|
}
|
|
38
|
-
interface DocumentErrorEvent
|
|
39
|
-
errors:
|
|
41
|
+
interface DocumentErrorEvent {
|
|
42
|
+
errors: readonly PosRangeLanguageError[];
|
|
43
|
+
uri: string;
|
|
44
|
+
version?: number;
|
|
40
45
|
}
|
|
41
46
|
interface FileEvent {
|
|
42
47
|
uri: string;
|
|
@@ -50,48 +55,56 @@ interface SymbolRegistrarEvent {
|
|
|
50
55
|
id: string;
|
|
51
56
|
checksum: string | undefined;
|
|
52
57
|
}
|
|
53
|
-
export declare type ProjectData = Pick<Project, 'cacheRoot' | 'config' | 'downloader' | '
|
|
54
|
-
export declare namespace ProjectData {
|
|
55
|
-
function mock(data?: Partial<ProjectData>): ProjectData;
|
|
56
|
-
}
|
|
57
|
-
export interface Project extends EventEmitter {
|
|
58
|
-
on(event: 'documentErrorred', callbackFn: (data: DocumentErrorEvent) => void): this;
|
|
59
|
-
on(event: 'documentUpdated', callbackFn: (data: DocumentEvent) => void): this;
|
|
60
|
-
on(event: 'documentRemoved', callbackFn: (data: FileEvent) => void): this;
|
|
61
|
-
on(event: `file${'Created' | 'Modified' | 'Deleted'}`, callbackFn: (data: FileEvent) => void): this;
|
|
62
|
-
on(event: 'ready', callbackFn: (data: EmptyEvent) => void): this;
|
|
63
|
-
on(event: 'rootsUpdated', callbackFn: (data: RootsEvent) => void): this;
|
|
64
|
-
on(event: 'symbolRegistrarExecuted', callbackFn: (data: SymbolRegistrarEvent) => void): this;
|
|
65
|
-
once(event: 'documentErrorred', callbackFn: (data: DocumentErrorEvent) => void): this;
|
|
66
|
-
once(event: 'documentUpdated', callbackFn: (data: DocumentEvent) => void): this;
|
|
67
|
-
once(event: 'documentRemoved', callbackFn: (data: FileEvent) => void): this;
|
|
68
|
-
once(event: `file${'Created' | 'Modified' | 'Deleted'}`, callbackFn: (data: FileEvent) => void): this;
|
|
69
|
-
once(event: 'ready', callbackFn: (data: EmptyEvent) => void): this;
|
|
70
|
-
once(event: 'rootsUpdated', callbackFn: (data: RootsEvent) => void): this;
|
|
71
|
-
once(event: 'symbolRegistrarExecuted', callbackFn: (data: SymbolRegistrarEvent) => void): this;
|
|
72
|
-
emit(event: 'documentErrorred', data: DocumentErrorEvent): boolean;
|
|
73
|
-
emit(event: 'documentUpdated', data: DocumentEvent): boolean;
|
|
74
|
-
emit(event: 'documentRemoved', data: FileEvent): boolean;
|
|
75
|
-
emit(event: `file${'Created' | 'Modified' | 'Deleted'}`, data: FileEvent): boolean;
|
|
76
|
-
emit(event: 'ready', data: EmptyEvent): boolean;
|
|
77
|
-
emit(event: 'rootsUpdated', data: RootsEvent): boolean;
|
|
78
|
-
emit(event: 'symbolRegistrarExecuted', data: SymbolRegistrarEvent): boolean;
|
|
79
|
-
}
|
|
58
|
+
export declare type ProjectData = Pick<Project, 'cacheRoot' | 'config' | 'downloader' | 'ensureBindingStarted' | 'externals' | 'fs' | 'logger' | 'meta' | 'profilers' | 'projectRoot' | 'roots' | 'symbols' | 'ctx'>;
|
|
80
59
|
/**
|
|
81
60
|
* Manage all tracked documents and errors.
|
|
61
|
+
*
|
|
62
|
+
* The four stages of processing a document:
|
|
63
|
+
* 1. `read` - read the file from the external file system as a `TextDocument`.
|
|
64
|
+
* 2. `parse` - Parse the `TextDocument` into an `AstNode`.
|
|
65
|
+
* 3. `bind` - Bind the `AstNode` and populate both the global symbol table and the local symbol tables on the nodes.
|
|
66
|
+
* 4. `check` (includes `lint`) - Check the `AstNode` with information from the symbol tables.
|
|
67
|
+
*
|
|
68
|
+
* **Caching**
|
|
69
|
+
*
|
|
70
|
+
* The global symbol table along with a list of file URIs and checksums is cached in memory and is periodically saved to disk.
|
|
71
|
+
*
|
|
72
|
+
* The `TextDocument`s and file `AstNode`s (including their local symbol tables) managed by the client are stored in memory until the client sends a `didClose` notification.
|
|
73
|
+
*
|
|
74
|
+
* Some `TextDocument`s may be cached to avoid excessive reading from the file system.
|
|
75
|
+
*
|
|
76
|
+
* **INIT and READY**
|
|
77
|
+
*
|
|
78
|
+
* When a new instance of the {@link Project} class is constructed, its INIT and READY processes are immediately started in serial.
|
|
79
|
+
*
|
|
80
|
+
* During the INIT process of the project, the config and language feature initialization are processed.
|
|
81
|
+
* The Promise returned by the {@link init} function resolves when the INIT process is complete.
|
|
82
|
+
*
|
|
83
|
+
* During the READY process of the project, the whole project is analyzed mainly to populate the global symbol table.
|
|
84
|
+
* The Promise returned by the {@link ready} function resolves when the READY process is complete.
|
|
85
|
+
*
|
|
86
|
+
* The following generally happens during the READY process:
|
|
87
|
+
* 1. A list of file URIs under the project is obtained.
|
|
88
|
+
* 2. The global symbol cache, if available, is loaded and validated against the know list of files.
|
|
89
|
+
* A list of files that need to be (re)processed is returned in this step.
|
|
90
|
+
* 3. For each files in the new list, the file is read, parsed, bound, and checked.
|
|
91
|
+
*
|
|
92
|
+
* **EDITING**
|
|
93
|
+
*
|
|
94
|
+
* After the READY process is complete, editing text documents as signaled by the client or the file watcher results in the file being re-processed.
|
|
82
95
|
*/
|
|
83
|
-
export declare class Project
|
|
96
|
+
export declare class Project implements ExternalEventEmitter {
|
|
84
97
|
#private;
|
|
85
98
|
private static readonly RootSuffix;
|
|
86
99
|
readonly cacheService: CacheService;
|
|
87
100
|
get isReady(): boolean;
|
|
88
101
|
config: Config;
|
|
89
102
|
readonly downloader: Downloader;
|
|
103
|
+
readonly externals: Externals;
|
|
90
104
|
readonly fs: FileService;
|
|
91
105
|
readonly logger: Logger;
|
|
92
106
|
readonly meta: MetaRegistry;
|
|
93
107
|
readonly profilers: ProfilerFactory;
|
|
94
|
-
readonly projectPath: string;
|
|
95
108
|
readonly projectRoot: RootUriString;
|
|
96
109
|
symbols: SymbolUtil;
|
|
97
110
|
/**
|
|
@@ -109,10 +122,31 @@ export declare class Project extends EventEmitter {
|
|
|
109
122
|
*/
|
|
110
123
|
get ctx(): Record<string, string>;
|
|
111
124
|
/**
|
|
112
|
-
* File
|
|
125
|
+
* File URI to a directory where all cache files of Spyglass should be stored.
|
|
113
126
|
*/
|
|
114
|
-
get cacheRoot():
|
|
127
|
+
get cacheRoot(): RootUriString;
|
|
115
128
|
private updateRoots;
|
|
129
|
+
on(event: 'documentErrored', callbackFn: (data: DocumentErrorEvent) => void): this;
|
|
130
|
+
on(event: 'documentUpdated', callbackFn: (data: DocumentEvent) => void): this;
|
|
131
|
+
on(event: 'documentRemoved', callbackFn: (data: FileEvent) => void): this;
|
|
132
|
+
on(event: `file${'Created' | 'Modified' | 'Deleted'}`, callbackFn: (data: FileEvent) => void): this;
|
|
133
|
+
on(event: 'ready', callbackFn: (data: EmptyEvent) => void): this;
|
|
134
|
+
on(event: 'rootsUpdated', callbackFn: (data: RootsEvent) => void): this;
|
|
135
|
+
on(event: 'symbolRegistrarExecuted', callbackFn: (data: SymbolRegistrarEvent) => void): this;
|
|
136
|
+
once(event: 'documentErrored', callbackFn: (data: DocumentErrorEvent) => void): this;
|
|
137
|
+
once(event: 'documentUpdated', callbackFn: (data: DocumentEvent) => void): this;
|
|
138
|
+
once(event: 'documentRemoved', callbackFn: (data: FileEvent) => void): this;
|
|
139
|
+
once(event: `file${'Created' | 'Modified' | 'Deleted'}`, callbackFn: (data: FileEvent) => void): this;
|
|
140
|
+
once(event: 'ready', callbackFn: (data: EmptyEvent) => void): this;
|
|
141
|
+
once(event: 'rootsUpdated', callbackFn: (data: RootsEvent) => void): this;
|
|
142
|
+
once(event: 'symbolRegistrarExecuted', callbackFn: (data: SymbolRegistrarEvent) => void): this;
|
|
143
|
+
emit(event: 'documentErrored', data: DocumentErrorEvent): boolean;
|
|
144
|
+
emit(event: 'documentUpdated', data: DocumentEvent): boolean;
|
|
145
|
+
emit(event: 'documentRemoved', data: FileEvent): boolean;
|
|
146
|
+
emit(event: `file${'Created' | 'Modified' | 'Deleted'}`, data: FileEvent): boolean;
|
|
147
|
+
emit(event: 'ready', data: EmptyEvent): boolean;
|
|
148
|
+
emit(event: 'rootsUpdated', data: RootsEvent): boolean;
|
|
149
|
+
emit(event: 'symbolRegistrarExecuted', data: SymbolRegistrarEvent): boolean;
|
|
116
150
|
/**
|
|
117
151
|
* Get all files that are tracked and supported.
|
|
118
152
|
*
|
|
@@ -120,53 +154,48 @@ export declare class Project extends EventEmitter {
|
|
|
120
154
|
* are not loaded into the memory.
|
|
121
155
|
*/
|
|
122
156
|
getTrackedFiles(): string[];
|
|
123
|
-
constructor({ cacheRoot, downloader, fs, initializers, logger, profilers,
|
|
157
|
+
constructor({ cacheRoot, defaultConfig, downloader, externals, fs, initializers, logger, profilers, projectRoot, }: ProjectOptions);
|
|
124
158
|
private setInitPromise;
|
|
125
159
|
private setReadyPromise;
|
|
160
|
+
/**
|
|
161
|
+
* Load the config file and initialize parsers and processors.
|
|
162
|
+
*/
|
|
126
163
|
init(): Promise<this>;
|
|
164
|
+
/**
|
|
165
|
+
* Finish the initial run of parsing, binding, and checking the entire project.
|
|
166
|
+
*/
|
|
127
167
|
ready(): Promise<this>;
|
|
128
168
|
/**
|
|
129
169
|
* Behavior of the `Project` instance is undefined after this function has settled.
|
|
130
170
|
*/
|
|
131
171
|
close(): Promise<void>;
|
|
132
172
|
restart(): Promise<void>;
|
|
133
|
-
resetCache(): void
|
|
173
|
+
resetCache(): Promise<void>;
|
|
134
174
|
normalizeUri(uri: string): string;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
private getLanguageID;
|
|
139
|
-
/**
|
|
140
|
-
* @returns The cached `TextDocument` and `AstNode` for the URI, or `undefined` when such data isn't available in cache.
|
|
141
|
-
*/
|
|
142
|
-
get(uri: string): DocAndNode | undefined;
|
|
143
|
-
/**
|
|
144
|
-
* @throws FS-related errors
|
|
145
|
-
*/
|
|
146
|
-
ensureParsed(uri: string): Promise<DocAndNode | undefined>;
|
|
147
|
-
private parseAndCache;
|
|
175
|
+
private static readonly TextDocumentCacheMaxLength;
|
|
176
|
+
private removeCachedTextDocument;
|
|
177
|
+
private read;
|
|
148
178
|
private parse;
|
|
149
|
-
private
|
|
179
|
+
private bind;
|
|
150
180
|
private check;
|
|
151
|
-
ensureChecked(doc: TextDocument, node: FileNode<AstNode>): Promise<void>;
|
|
152
181
|
private lint;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
ensureParsedAndCheckedOnlyWhenReady(uri: string): Promise<DocAndNode | undefined>;
|
|
156
|
-
private bind;
|
|
182
|
+
ensureBindingStarted(uri: string): Promise<void>;
|
|
183
|
+
private bindUri;
|
|
157
184
|
/**
|
|
158
185
|
* Notify that a new document was opened in the editor.
|
|
159
186
|
*/
|
|
160
|
-
onDidOpen(uri: string, languageID: string, version: number, content: string): void
|
|
187
|
+
onDidOpen(uri: string, languageID: string, version: number, content: string): Promise<void>;
|
|
161
188
|
/**
|
|
162
189
|
* Notify that an existing document was changed in the editor.
|
|
163
190
|
* @throws If there is no `TextDocument` corresponding to the URI.
|
|
164
191
|
*/
|
|
165
|
-
onDidChange(uri: string, changes: TextDocumentContentChangeEvent[], version: number): void
|
|
192
|
+
onDidChange(uri: string, changes: TextDocumentContentChangeEvent[], version: number): Promise<void>;
|
|
166
193
|
/**
|
|
167
194
|
* Notify that an existing document was closed in the editor.
|
|
168
195
|
*/
|
|
169
196
|
onDidClose(uri: string): void;
|
|
197
|
+
ensureClientManagedChecked(uri: string): Promise<DocAndNode | undefined>;
|
|
198
|
+
getClientManaged(uri: string): DocAndNode | undefined;
|
|
170
199
|
showCacheRoot(): Promise<void>;
|
|
171
200
|
private tryClearingCache;
|
|
172
201
|
private shouldRemove;
|