@spyglassmc/core 0.1.0 → 0.2.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/TwoWayMap.d.ts +21 -0
- package/lib/common/TwoWayMap.js +69 -0
- 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 +151 -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 +2 -1
- package/lib/common/index.js +2 -13
- package/lib/common/util.d.ts +17 -34
- package/lib/common/util.js +32 -113
- package/lib/index.d.ts +7 -7
- package/lib/index.js +7 -19
- package/lib/node/AstNode.d.ts +3 -3
- 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 +1 -1
- package/lib/node/CommentNode.js +2 -5
- package/lib/node/ErrorNode.d.ts +1 -1
- package/lib/node/ErrorNode.js +2 -5
- package/lib/node/FileNode.d.ts +3 -3
- package/lib/node/FileNode.js +2 -5
- package/lib/node/FloatNode.d.ts +2 -2
- package/lib/node/FloatNode.js +4 -7
- package/lib/node/IntegerNode.d.ts +2 -2
- 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 +5 -8
- package/lib/node/LongNode.d.ts +2 -2
- 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 +6 -8
- package/lib/node/ResourceLocationNode.js +9 -12
- package/lib/node/Sequence.d.ts +4 -3
- package/lib/node/Sequence.js +4 -6
- 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 +5 -8
- package/lib/node/index.d.ts +15 -15
- package/lib/node/index.js +15 -27
- 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 -34
- 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 +14 -18
- package/lib/parser/string.d.ts +7 -7
- package/lib/parser/string.js +40 -44
- package/lib/parser/symbol.d.ts +3 -3
- package/lib/parser/symbol.js +3 -7
- package/lib/parser/util.d.ts +30 -12
- package/lib/parser/util.js +78 -63
- package/lib/processor/ColorInfoProvider.d.ts +1 -1
- package/lib/processor/ColorInfoProvider.js +6 -9
- package/lib/processor/InlayHintProvider.d.ts +2 -2
- package/lib/processor/InlayHintProvider.js +1 -2
- package/lib/processor/SignatureHelpProvider.d.ts +2 -2
- package/lib/processor/SignatureHelpProvider.js +1 -2
- package/lib/processor/checker/Checker.d.ts +2 -2
- package/lib/processor/checker/Checker.js +1 -5
- package/lib/processor/checker/builtin.d.ts +5 -4
- package/lib/processor/checker/builtin.js +26 -28
- package/lib/processor/checker/index.d.ts +2 -2
- package/lib/processor/checker/index.js +2 -27
- package/lib/processor/colorizer/Colorizer.d.ts +4 -4
- package/lib/processor/colorizer/Colorizer.js +8 -11
- package/lib/processor/colorizer/builtin.d.ts +3 -3
- package/lib/processor/colorizer/builtin.js +33 -46
- package/lib/processor/colorizer/index.d.ts +2 -2
- package/lib/processor/colorizer/index.js +2 -27
- package/lib/processor/completer/Completer.d.ts +4 -4
- package/lib/processor/completer/Completer.js +14 -33
- package/lib/processor/completer/builtin.d.ts +7 -7
- package/lib/processor/completer/builtin.js +58 -74
- package/lib/processor/completer/index.d.ts +2 -2
- package/lib/processor/completer/index.js +2 -27
- package/lib/processor/formatter/Formatter.d.ts +2 -2
- 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 -27
- package/lib/processor/index.d.ts +9 -9
- package/lib/processor/index.js +9 -21
- package/lib/processor/linter/Linter.d.ts +2 -2
- 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 +23 -27
- package/lib/processor/linter/builtin.d.ts +3 -3
- package/lib/processor/linter/builtin.js +19 -31
- package/lib/processor/linter/index.d.ts +2 -2
- package/lib/processor/linter/index.js +2 -27
- package/lib/processor/util.d.ts +2 -2
- package/lib/processor/util.js +4 -9
- package/lib/service/CacheService.d.ts +6 -6
- package/lib/service/CacheService.js +38 -48
- package/lib/service/Config.d.ts +17 -16
- package/lib/service/Config.js +56 -51
- package/lib/service/Context.d.ts +14 -14
- package/lib/service/Context.js +30 -32
- package/lib/service/Dependency.js +2 -5
- package/lib/service/Downloader.d.ts +10 -39
- package/lib/service/Downloader.js +37 -106
- package/lib/service/ErrorReporter.d.ts +2 -2
- package/lib/service/ErrorReporter.js +11 -15
- package/lib/service/FileService.d.ts +41 -14
- package/lib/service/FileService.js +107 -81
- package/lib/service/Hover.d.ts +2 -2
- package/lib/service/Hover.js +4 -7
- package/lib/service/Logger.js +2 -5
- package/lib/service/MetaRegistry.d.ts +12 -12
- package/lib/service/MetaRegistry.js +62 -73
- package/lib/service/Operations.js +3 -9
- package/lib/service/Profiler.d.ts +1 -1
- package/lib/service/Profiler.js +25 -41
- package/lib/service/Project.d.ts +50 -51
- package/lib/service/Project.js +240 -238
- package/lib/service/Service.d.ts +19 -29
- package/lib/service/Service.js +57 -53
- 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/fileUtil.d.ts +21 -41
- package/lib/service/fileUtil.js +59 -129
- package/lib/service/index.d.ts +17 -17
- package/lib/service/index.js +17 -31
- package/lib/source/IndexMap.d.ts +1 -1
- package/lib/source/IndexMap.js +7 -10
- package/lib/source/LanguageError.d.ts +2 -2
- package/lib/source/LanguageError.js +3 -6
- 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 +2 -2
- package/lib/source/PositionRange.js +14 -17
- package/lib/source/Range.d.ts +1 -1
- package/lib/source/Range.js +7 -10
- package/lib/source/Source.d.ts +12 -4
- package/lib/source/Source.js +84 -29
- package/lib/source/index.d.ts +8 -8
- package/lib/source/index.js +8 -20
- package/lib/symbol/Symbol.d.ts +15 -15
- package/lib/symbol/Symbol.js +53 -68
- package/lib/symbol/SymbolUtil.d.ts +23 -33
- package/lib/symbol/SymbolUtil.js +162 -163
- package/lib/symbol/UriBinder.d.ts +1 -1
- package/lib/symbol/UriBinder.js +1 -2
- package/lib/symbol/index.d.ts +3 -3
- package/lib/symbol/index.js +3 -15
- package/package.json +7 -4
- package/lib/common/Heap.d.ts +0 -1
- package/lib/common/Heap.js +0 -2
- package/lib/node/TableNode.d.ts +0 -17
- package/lib/node/TableNode.js +0 -11
- package/lib/parser/table.d.ts +0 -22
- package/lib/parser/table.js +0 -97
- package/lib/service/CommandExecutor.d.ts +0 -3
- package/lib/service/CommandExecutor.js +0 -7
package/lib/service/Project.js
CHANGED
|
@@ -1,163 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const events_1 = __importDefault(require("events"));
|
|
27
|
-
const p_limit_1 = __importDefault(require("p-limit"));
|
|
28
|
-
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
29
|
-
const _1 = require(".");
|
|
30
|
-
const common_1 = require("../common");
|
|
31
|
-
const node_1 = require("../node");
|
|
32
|
-
const parser_1 = require("../parser");
|
|
33
|
-
const processor_1 = require("../processor");
|
|
34
|
-
const source_1 = require("../source");
|
|
35
|
-
const symbol_1 = require("../symbol");
|
|
36
|
-
const CacheService_1 = require("./CacheService");
|
|
37
|
-
const Config_1 = require("./Config");
|
|
38
|
-
const Context_1 = require("./Context");
|
|
39
|
-
const Dependency_1 = require("./Dependency");
|
|
40
|
-
const Downloader_1 = require("./Downloader");
|
|
41
|
-
const ErrorReporter_1 = require("./ErrorReporter");
|
|
42
|
-
const FileService_1 = require("./FileService");
|
|
43
|
-
const fileUtil_1 = require("./fileUtil");
|
|
44
|
-
const Logger_1 = require("./Logger");
|
|
45
|
-
const MetaRegistry_1 = require("./MetaRegistry");
|
|
46
|
-
const Profiler_1 = require("./Profiler");
|
|
7
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
8
|
+
import { bufferToString, CachePromise } from '../common/index.js';
|
|
9
|
+
import { FileNode } from '../node/index.js';
|
|
10
|
+
import { file } from '../parser/index.js';
|
|
11
|
+
import { traversePreOrder } from '../processor/index.js';
|
|
12
|
+
import { Source } from '../source/index.js';
|
|
13
|
+
import { SymbolUtil } from '../symbol/index.js';
|
|
14
|
+
import { CacheService } from './CacheService.js';
|
|
15
|
+
import { ConfigService, LinterConfigValue } from './Config.js';
|
|
16
|
+
import { CheckerContext, LinterContext, ParserContext, UriBinderContext } from './Context.js';
|
|
17
|
+
import { DependencyKey } from './Dependency.js';
|
|
18
|
+
import { Downloader } from './Downloader.js';
|
|
19
|
+
import { LinterErrorReporter } from './ErrorReporter.js';
|
|
20
|
+
import { ArchiveUriSupporter, FileService, FileUriSupporter } from './FileService.js';
|
|
21
|
+
import { fileUtil } from './fileUtil.js';
|
|
22
|
+
import { Logger } from './Logger.js';
|
|
23
|
+
import { MetaRegistry } from './MetaRegistry.js';
|
|
24
|
+
import { ProfilerFactory } from './Profiler.js';
|
|
47
25
|
const CacheAutoSaveInterval = 600000; // 10 Minutes.
|
|
48
|
-
var ProjectData;
|
|
49
|
-
(function (ProjectData) {
|
|
50
|
-
function mock(data = {}) {
|
|
51
|
-
const cacheRoot = data.cacheRoot ?? '/some/random/garbage/path/that/definitely/does/not/exist';
|
|
52
|
-
const logger = data.logger ?? Logger_1.Logger.create();
|
|
53
|
-
const downloader = data.downloader ?? new Downloader_1.Downloader(cacheRoot, logger, _1.LowLevelDownloader.mock({ fixtures: {} }));
|
|
54
|
-
return {
|
|
55
|
-
cacheRoot,
|
|
56
|
-
config: data.config ?? Config_1.VanillaConfig,
|
|
57
|
-
ctx: data.ctx ?? {},
|
|
58
|
-
downloader,
|
|
59
|
-
ensureParsedAndChecked: data.ensureParsedAndChecked,
|
|
60
|
-
fs: data.fs ?? FileService_1.FileService.create(),
|
|
61
|
-
get: data.get ?? (() => undefined),
|
|
62
|
-
logger,
|
|
63
|
-
meta: data.meta ?? new MetaRegistry_1.MetaRegistry(),
|
|
64
|
-
profilers: data.profilers ?? Profiler_1.ProfilerFactory.noop(),
|
|
65
|
-
projectRoot: data.projectRoot ?? 'file:///',
|
|
66
|
-
roots: data.roots ?? [],
|
|
67
|
-
symbols: data.symbols ?? new symbol_1.SymbolUtil({}),
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
ProjectData.mock = mock;
|
|
71
|
-
})(ProjectData = exports.ProjectData || (exports.ProjectData = {}));
|
|
72
26
|
/* istanbul ignore next */
|
|
73
27
|
/**
|
|
74
28
|
* Manage all tracked documents and errors.
|
|
75
29
|
*/
|
|
76
|
-
class Project
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
this.cacheService = new CacheService_1.CacheService(cacheRoot, this);
|
|
110
|
-
__classPrivateFieldSet(this, _Project_configService, new Config_1.ConfigService(this), "f");
|
|
111
|
-
this.downloader = downloader ?? new Downloader_1.Downloader(cacheRoot, logger);
|
|
112
|
-
this.fs = fs;
|
|
113
|
-
__classPrivateFieldSet(this, _Project_initializers, initializers, "f");
|
|
114
|
-
this.logger = logger;
|
|
115
|
-
this.profilers = profilers;
|
|
116
|
-
this.projectPath = projectPath;
|
|
117
|
-
this.projectRoot = fileUtil_1.fileUtil.ensureEndingSlash(fileUtil_1.fileUtil.pathToFileUri(projectPath));
|
|
118
|
-
this.symbols = new symbol_1.SymbolUtil({});
|
|
119
|
-
__classPrivateFieldSet(this, _Project_ctx, {}, "f");
|
|
120
|
-
this.logger.info(`[Project] [init] cacheRoot = “${cacheRoot}”`);
|
|
121
|
-
__classPrivateFieldGet(this, _Project_configService, "f")
|
|
122
|
-
.on('changed', ({ config }) => {
|
|
123
|
-
this.config = config;
|
|
124
|
-
this.logger.info('[Project] [Config] Changed');
|
|
125
|
-
})
|
|
126
|
-
.on('error', ({ error, uri }) => this.logger.error(`[Project] [Config] Failed loading “${uri}”`, error));
|
|
127
|
-
this.setInitPromise();
|
|
128
|
-
this.setReadyPromise();
|
|
129
|
-
__classPrivateFieldSet(this, _Project_cacheSaverIntervalId, setInterval(() => this.cacheService.save(), CacheAutoSaveInterval), "f");
|
|
130
|
-
this
|
|
131
|
-
.on('documentUpdated', ({ doc, node }) => {
|
|
132
|
-
this.emit('documentErrorred', {
|
|
133
|
-
doc,
|
|
134
|
-
errors: node_1.FileNode.getErrors(node),
|
|
135
|
-
node,
|
|
136
|
-
});
|
|
137
|
-
})
|
|
138
|
-
.on('fileCreated', async ({ uri }) => {
|
|
139
|
-
__classPrivateFieldGet(this, _Project_watchedFiles, "f").add(uri);
|
|
140
|
-
if (uri.endsWith(Project.RootSuffix)) {
|
|
141
|
-
this.updateRoots();
|
|
142
|
-
}
|
|
143
|
-
this.bind(uri);
|
|
144
|
-
return this.ensureParsedAndChecked(uri);
|
|
145
|
-
})
|
|
146
|
-
.on('fileModified', async ({ uri }) => {
|
|
147
|
-
if (this.isOnlyWatched(uri)) {
|
|
148
|
-
__classPrivateFieldGet(this, _Project_docAndNodes, "f").delete(uri);
|
|
149
|
-
await this.ensureParsedAndChecked(uri);
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
.on('fileDeleted', ({ uri }) => {
|
|
153
|
-
__classPrivateFieldGet(this, _Project_watchedFiles, "f").delete(uri);
|
|
154
|
-
if (uri.endsWith(Project.RootSuffix)) {
|
|
155
|
-
this.updateRoots();
|
|
156
|
-
}
|
|
157
|
-
this.symbols.clear({ uri });
|
|
158
|
-
this.tryClearingCache(uri);
|
|
159
|
-
});
|
|
160
|
-
}
|
|
30
|
+
export class Project {
|
|
31
|
+
static RootSuffix = '/pack.mcmeta';
|
|
32
|
+
#cacheSaverIntervalId;
|
|
33
|
+
cacheService;
|
|
34
|
+
/**
|
|
35
|
+
* URI of files that are currently managed by the language client.
|
|
36
|
+
*/
|
|
37
|
+
#clientManagedUris = new Set();
|
|
38
|
+
#configService;
|
|
39
|
+
#docAndNodes = new Map();
|
|
40
|
+
#eventEmitter;
|
|
41
|
+
#initializers;
|
|
42
|
+
#initPromise;
|
|
43
|
+
#readyPromise;
|
|
44
|
+
#watchedFiles = new Set();
|
|
45
|
+
#watcher;
|
|
46
|
+
#watcherReady = false;
|
|
47
|
+
#isReady = false;
|
|
48
|
+
get isReady() {
|
|
49
|
+
return this.#isReady;
|
|
50
|
+
}
|
|
51
|
+
config;
|
|
52
|
+
downloader;
|
|
53
|
+
externals;
|
|
54
|
+
fs;
|
|
55
|
+
logger;
|
|
56
|
+
meta = new MetaRegistry();
|
|
57
|
+
profilers;
|
|
58
|
+
projectRoot;
|
|
59
|
+
symbols;
|
|
60
|
+
#dependencyRoots;
|
|
61
|
+
#dependencyFiles;
|
|
62
|
+
#roots = [];
|
|
161
63
|
/**
|
|
162
64
|
* All tracked root URIs. Each URI in this array is guaranteed to end with a slash (`/`).
|
|
163
65
|
*
|
|
@@ -168,22 +70,24 @@ class Project extends events_1.default {
|
|
|
168
70
|
* before the shallower ones (e.g. `file:///foo/bar/` will come before `file:///foo/`).
|
|
169
71
|
*/
|
|
170
72
|
get roots() {
|
|
171
|
-
return
|
|
73
|
+
return this.#roots;
|
|
172
74
|
}
|
|
75
|
+
#ctx;
|
|
173
76
|
/**
|
|
174
77
|
* Arbitrary information that will be included in the `project` property of all `Context`s.
|
|
175
78
|
*/
|
|
176
79
|
get ctx() {
|
|
177
|
-
return
|
|
80
|
+
return this.#ctx;
|
|
178
81
|
}
|
|
82
|
+
#cacheRoot;
|
|
179
83
|
/**
|
|
180
|
-
* File
|
|
84
|
+
* File URI to a directory where all cache files of Spyglass should be stored.
|
|
181
85
|
*/
|
|
182
86
|
get cacheRoot() {
|
|
183
|
-
return
|
|
87
|
+
return this.#cacheRoot;
|
|
184
88
|
}
|
|
185
89
|
updateRoots() {
|
|
186
|
-
const rawRoots = [...
|
|
90
|
+
const rawRoots = [...this.#dependencyRoots, this.projectRoot];
|
|
187
91
|
const ans = new Set(rawRoots);
|
|
188
92
|
// Identify roots indicated by `pack.mcmeta`.
|
|
189
93
|
for (const file of this.getTrackedFiles()) {
|
|
@@ -191,8 +95,19 @@ class Project extends events_1.default {
|
|
|
191
95
|
ans.add(file.slice(0, 1 - Project.RootSuffix.length));
|
|
192
96
|
}
|
|
193
97
|
}
|
|
194
|
-
|
|
195
|
-
this.emit('rootsUpdated', { roots:
|
|
98
|
+
this.#roots = [...ans].sort((a, b) => b.length - a.length);
|
|
99
|
+
this.emit('rootsUpdated', { roots: this.#roots });
|
|
100
|
+
}
|
|
101
|
+
on(event, callbackFn) {
|
|
102
|
+
this.#eventEmitter.on(event, callbackFn);
|
|
103
|
+
return this;
|
|
104
|
+
}
|
|
105
|
+
once(event, callbackFn) {
|
|
106
|
+
this.#eventEmitter.once(event, callbackFn);
|
|
107
|
+
return this;
|
|
108
|
+
}
|
|
109
|
+
emit(event, ...args) {
|
|
110
|
+
return this.#eventEmitter.emit(event, ...args);
|
|
196
111
|
}
|
|
197
112
|
/**
|
|
198
113
|
* Get all files that are tracked and supported.
|
|
@@ -202,38 +117,107 @@ class Project extends events_1.default {
|
|
|
202
117
|
*/
|
|
203
118
|
getTrackedFiles() {
|
|
204
119
|
const extensions = this.meta.getSupportedFileExtensions();
|
|
205
|
-
return [...
|
|
206
|
-
.filter(file => extensions.includes(
|
|
120
|
+
return [...this.#dependencyFiles, ...this.#watchedFiles]
|
|
121
|
+
.filter(file => extensions.includes(fileUtil.extname(file) ?? ''));
|
|
122
|
+
}
|
|
123
|
+
constructor({ cacheRoot, defaultConfig, downloader, externals, fs = FileService.create(externals, cacheRoot), initializers = [], logger = Logger.create(), profilers = ProfilerFactory.noop(), projectRoot, }) {
|
|
124
|
+
this.#cacheRoot = cacheRoot;
|
|
125
|
+
this.#eventEmitter = new externals.event.EventEmitter();
|
|
126
|
+
this.externals = externals;
|
|
127
|
+
this.fs = fs;
|
|
128
|
+
this.#initializers = initializers;
|
|
129
|
+
this.logger = logger;
|
|
130
|
+
this.profilers = profilers;
|
|
131
|
+
this.projectRoot = projectRoot;
|
|
132
|
+
this.cacheService = new CacheService(cacheRoot, this);
|
|
133
|
+
this.#configService = new ConfigService(this, defaultConfig);
|
|
134
|
+
this.downloader = downloader ?? new Downloader(cacheRoot, externals, logger);
|
|
135
|
+
this.symbols = new SymbolUtil({}, externals.event.EventEmitter);
|
|
136
|
+
this.#ctx = {};
|
|
137
|
+
this.logger.info(`[Project] [init] cacheRoot = “${cacheRoot}”`);
|
|
138
|
+
this.#configService
|
|
139
|
+
.on('changed', ({ config }) => {
|
|
140
|
+
this.config = config;
|
|
141
|
+
this.logger.info('[Project] [Config] Changed');
|
|
142
|
+
})
|
|
143
|
+
.on('error', ({ error, uri }) => this.logger.error(`[Project] [Config] Failed loading “${uri}”`, error));
|
|
144
|
+
this.setInitPromise();
|
|
145
|
+
this.setReadyPromise();
|
|
146
|
+
this.#cacheSaverIntervalId = setInterval(() => this.cacheService.save(), CacheAutoSaveInterval);
|
|
147
|
+
this
|
|
148
|
+
.on('documentUpdated', ({ doc, node }) => {
|
|
149
|
+
if (!this.#isReady) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this.emit('documentErrorred', {
|
|
153
|
+
doc,
|
|
154
|
+
errors: FileNode.getErrors(node),
|
|
155
|
+
node,
|
|
156
|
+
});
|
|
157
|
+
})
|
|
158
|
+
.on('fileCreated', async ({ uri }) => {
|
|
159
|
+
if (uri.endsWith(Project.RootSuffix)) {
|
|
160
|
+
this.updateRoots();
|
|
161
|
+
}
|
|
162
|
+
this.bind(uri);
|
|
163
|
+
return this.ensureParsedAndChecked(uri);
|
|
164
|
+
})
|
|
165
|
+
.on('fileModified', async ({ uri }) => {
|
|
166
|
+
if (this.isOnlyWatched(uri)) {
|
|
167
|
+
this.#docAndNodes.delete(uri);
|
|
168
|
+
await this.ensureParsedAndChecked(uri);
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
.on('fileDeleted', ({ uri }) => {
|
|
172
|
+
if (uri.endsWith(Project.RootSuffix)) {
|
|
173
|
+
this.updateRoots();
|
|
174
|
+
}
|
|
175
|
+
this.symbols.clear({ uri });
|
|
176
|
+
this.tryClearingCache(uri);
|
|
177
|
+
})
|
|
178
|
+
.on('ready', () => {
|
|
179
|
+
this.#isReady = true;
|
|
180
|
+
// Recheck client managed files.
|
|
181
|
+
const promises = [];
|
|
182
|
+
for (const uri of this.#clientManagedUris) {
|
|
183
|
+
const result = this.#docAndNodes.get(uri);
|
|
184
|
+
if (result) {
|
|
185
|
+
promises.push(this.check(result.doc, result.node));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
Promise.all(promises).catch(e => this.logger.error('[Project#ready] Error occurred when rechecking client managed files after ready', e));
|
|
189
|
+
});
|
|
207
190
|
}
|
|
208
191
|
setInitPromise() {
|
|
209
192
|
const loadConfig = async () => {
|
|
210
|
-
this.config = await
|
|
193
|
+
this.config = await this.#configService.load();
|
|
211
194
|
};
|
|
212
195
|
const callIntializers = async () => {
|
|
213
196
|
const initCtx = {
|
|
214
197
|
cacheRoot: this.cacheRoot,
|
|
215
198
|
config: this.config,
|
|
216
199
|
downloader: this.downloader,
|
|
200
|
+
externals: this.externals,
|
|
217
201
|
logger: this.logger,
|
|
218
202
|
meta: this.meta,
|
|
219
203
|
projectRoot: this.projectRoot,
|
|
220
204
|
};
|
|
221
|
-
const results = await Promise.allSettled(
|
|
205
|
+
const results = await Promise.allSettled(this.#initializers.map(init => init(initCtx)));
|
|
222
206
|
let ctx = {};
|
|
223
207
|
results.forEach(async (r, i) => {
|
|
224
208
|
if (r.status === 'rejected') {
|
|
225
|
-
this.logger.error(`[Project] [callInitializers] [${i}] “${
|
|
209
|
+
this.logger.error(`[Project] [callInitializers] [${i}] “${this.#initializers[i].name}”`, r.reason);
|
|
226
210
|
}
|
|
227
211
|
else if (r.value) {
|
|
228
212
|
ctx = { ...ctx, ...r.value };
|
|
229
213
|
}
|
|
230
214
|
});
|
|
231
|
-
|
|
215
|
+
this.#ctx = ctx;
|
|
232
216
|
};
|
|
233
217
|
const init = async () => {
|
|
234
218
|
const __profiler = this.profilers.get('project#init');
|
|
235
219
|
const { symbols } = await this.cacheService.load();
|
|
236
|
-
this.symbols = new
|
|
220
|
+
this.symbols = new SymbolUtil(symbols, this.externals.event.EventEmitter);
|
|
237
221
|
this.symbols.buildCache();
|
|
238
222
|
__profiler.task('Load Cache');
|
|
239
223
|
await loadConfig();
|
|
@@ -241,13 +225,13 @@ class Project extends events_1.default {
|
|
|
241
225
|
await callIntializers();
|
|
242
226
|
__profiler.task('Initialize').finalize();
|
|
243
227
|
};
|
|
244
|
-
|
|
228
|
+
this.#initPromise = init();
|
|
245
229
|
}
|
|
246
230
|
setReadyPromise() {
|
|
247
231
|
const getDependencies = async () => {
|
|
248
232
|
const ans = [];
|
|
249
233
|
for (const dependency of this.config.env.dependencies) {
|
|
250
|
-
if (
|
|
234
|
+
if (DependencyKey.is(dependency)) {
|
|
251
235
|
const provider = this.meta.getDependencyProvider(dependency);
|
|
252
236
|
if (provider) {
|
|
253
237
|
try {
|
|
@@ -270,55 +254,51 @@ class Project extends events_1.default {
|
|
|
270
254
|
};
|
|
271
255
|
const listDependencyFiles = async () => {
|
|
272
256
|
const dependencies = await getDependencies();
|
|
273
|
-
const fileUriSupporter = await
|
|
274
|
-
const
|
|
257
|
+
const fileUriSupporter = await FileUriSupporter.create(dependencies, this.externals, this.logger);
|
|
258
|
+
const archiveUriSupporter = await ArchiveUriSupporter.create(dependencies, this.externals, this.logger, this.cacheService.checksums.roots);
|
|
275
259
|
this.fs.register('file:', fileUriSupporter, true);
|
|
276
|
-
this.fs.register(
|
|
260
|
+
this.fs.register(ArchiveUriSupporter.Protocol, archiveUriSupporter, true);
|
|
277
261
|
};
|
|
278
262
|
const listProjectFiles = () => new Promise(resolve => {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
.watch(this.
|
|
263
|
+
this.#watcherReady = false;
|
|
264
|
+
this.#watcher = this.externals.fs
|
|
265
|
+
.watch(this.projectRoot)
|
|
282
266
|
.once('ready', () => {
|
|
283
|
-
|
|
267
|
+
this.#watcherReady = true;
|
|
284
268
|
resolve();
|
|
285
269
|
})
|
|
286
|
-
.on('add',
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (__classPrivateFieldGet(this, _Project_watcherReady, "f")) {
|
|
270
|
+
.on('add', uri => {
|
|
271
|
+
this.#watchedFiles.add(uri);
|
|
272
|
+
if (this.#watcherReady) {
|
|
290
273
|
this.emit('fileCreated', { uri });
|
|
291
274
|
}
|
|
292
275
|
})
|
|
293
|
-
.on('change',
|
|
294
|
-
|
|
295
|
-
if (__classPrivateFieldGet(this, _Project_watcherReady, "f")) {
|
|
276
|
+
.on('change', uri => {
|
|
277
|
+
if (this.#watcherReady) {
|
|
296
278
|
this.emit('fileModified', { uri });
|
|
297
279
|
}
|
|
298
280
|
})
|
|
299
|
-
.on('unlink',
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
if (__classPrivateFieldGet(this, _Project_watcherReady, "f")) {
|
|
281
|
+
.on('unlink', uri => {
|
|
282
|
+
this.#watchedFiles.delete(uri);
|
|
283
|
+
if (this.#watcherReady) {
|
|
303
284
|
this.emit('fileDeleted', { uri });
|
|
304
285
|
}
|
|
305
286
|
})
|
|
306
287
|
.on('error', e => {
|
|
307
288
|
this.logger.error('[Project] [chokidar]', e);
|
|
308
|
-
})
|
|
289
|
+
});
|
|
309
290
|
});
|
|
310
291
|
const ready = async () => {
|
|
311
292
|
await this.init();
|
|
312
293
|
const __profiler = this.profilers.get('project#ready');
|
|
313
|
-
const limit = (0, p_limit_1.default)(8);
|
|
314
294
|
const ensureParsed = this.ensureParsed.bind(this);
|
|
315
295
|
const ensureChecked = this.ensureChecked.bind(this);
|
|
316
296
|
await Promise.all([
|
|
317
297
|
listDependencyFiles(),
|
|
318
298
|
listProjectFiles(),
|
|
319
299
|
]);
|
|
320
|
-
|
|
321
|
-
|
|
300
|
+
this.#dependencyFiles = new Set(this.fs.listFiles());
|
|
301
|
+
this.#dependencyRoots = new Set(this.fs.listRoots());
|
|
322
302
|
this.updateRoots();
|
|
323
303
|
__profiler.task('List Files');
|
|
324
304
|
for (const [id, { checksum, registrar }] of this.meta.symbolRegistrars) {
|
|
@@ -344,7 +324,7 @@ class Project extends events_1.default {
|
|
|
344
324
|
this.bind(addedFiles);
|
|
345
325
|
}
|
|
346
326
|
__profiler.task('Bind URIs');
|
|
347
|
-
const files = [...addedFiles, ...changedFiles]; // FIXME:
|
|
327
|
+
const files = [...addedFiles, ...changedFiles]; // FIXME: mcdoc files might need to be parsed and checked before others.
|
|
348
328
|
// const docAndNodes = (await Promise.all(files.map(uri => limit(ensureParsed, uri)))).filter((r): r is DocAndNode => !!r)
|
|
349
329
|
const docAndNodes = (await Promise.all(files.map(uri => ensureParsed(uri)))).filter((r) => !!r);
|
|
350
330
|
__profiler.task('Parse Files');
|
|
@@ -353,28 +333,27 @@ class Project extends events_1.default {
|
|
|
353
333
|
__profiler.task('Check Files').finalize();
|
|
354
334
|
this.emit('ready', {});
|
|
355
335
|
};
|
|
356
|
-
|
|
336
|
+
this.#readyPromise = ready();
|
|
357
337
|
}
|
|
358
338
|
async init() {
|
|
359
|
-
await
|
|
339
|
+
await this.#initPromise;
|
|
360
340
|
return this;
|
|
361
341
|
}
|
|
362
342
|
async ready() {
|
|
363
|
-
await
|
|
364
|
-
await __classPrivateFieldGet(this, _Project_readyPromise, "f");
|
|
343
|
+
await this.#readyPromise;
|
|
365
344
|
return this;
|
|
366
345
|
}
|
|
367
346
|
/**
|
|
368
347
|
* Behavior of the `Project` instance is undefined after this function has settled.
|
|
369
348
|
*/
|
|
370
349
|
async close() {
|
|
371
|
-
clearInterval(
|
|
372
|
-
await
|
|
350
|
+
clearInterval(this.#cacheSaverIntervalId);
|
|
351
|
+
await this.#watcher.close();
|
|
373
352
|
await this.cacheService.save();
|
|
374
353
|
}
|
|
375
354
|
async restart() {
|
|
376
355
|
try {
|
|
377
|
-
await
|
|
356
|
+
await this.#watcher.close();
|
|
378
357
|
this.setReadyPromise();
|
|
379
358
|
await this.ready();
|
|
380
359
|
}
|
|
@@ -385,36 +364,39 @@ class Project extends events_1.default {
|
|
|
385
364
|
resetCache() {
|
|
386
365
|
return this.cacheService.reset();
|
|
387
366
|
}
|
|
367
|
+
normalizeUri(uri) {
|
|
368
|
+
return this.fs.mapFromDisk(this.externals.uri.normalize(uri));
|
|
369
|
+
}
|
|
388
370
|
/**
|
|
389
371
|
* @returns The language ID of the file, or the file extension without the leading dot.
|
|
390
372
|
*/
|
|
391
373
|
getLanguageID(uri) {
|
|
392
|
-
uri =
|
|
393
|
-
const ext =
|
|
374
|
+
uri = this.normalizeUri(uri);
|
|
375
|
+
const ext = fileUtil.extname(uri) ?? '.plaintext';
|
|
394
376
|
return this.meta.getLanguageID(ext) ?? ext.slice(1);
|
|
395
377
|
}
|
|
396
378
|
/**
|
|
397
379
|
* @returns The cached `TextDocument` and `AstNode` for the URI, or `undefined` when such data isn't available in cache.
|
|
398
380
|
*/
|
|
399
381
|
get(uri) {
|
|
400
|
-
uri =
|
|
401
|
-
return
|
|
382
|
+
uri = this.normalizeUri(uri);
|
|
383
|
+
return this.#docAndNodes.get(uri);
|
|
402
384
|
}
|
|
403
385
|
/**
|
|
404
386
|
* @throws FS-related errors
|
|
405
387
|
*/
|
|
406
388
|
async ensureParsed(uri) {
|
|
407
|
-
uri =
|
|
408
|
-
if (
|
|
409
|
-
return
|
|
389
|
+
uri = this.normalizeUri(uri);
|
|
390
|
+
if (this.#docAndNodes.has(uri)) {
|
|
391
|
+
return this.#docAndNodes.get(uri);
|
|
410
392
|
}
|
|
411
393
|
const languageID = this.getLanguageID(uri);
|
|
412
394
|
if (!this.meta.isSupportedLanguage(languageID)) {
|
|
413
395
|
return undefined;
|
|
414
396
|
}
|
|
415
397
|
try {
|
|
416
|
-
const content =
|
|
417
|
-
const doc =
|
|
398
|
+
const content = bufferToString(await this.fs.readFile(uri));
|
|
399
|
+
const doc = TextDocument.create(uri, languageID, -1, content);
|
|
418
400
|
return this.parseAndCache(doc);
|
|
419
401
|
}
|
|
420
402
|
catch (e) {
|
|
@@ -427,22 +409,22 @@ class Project extends events_1.default {
|
|
|
427
409
|
return this.cache(doc, node);
|
|
428
410
|
}
|
|
429
411
|
parse(doc) {
|
|
430
|
-
const ctx =
|
|
431
|
-
const src = new
|
|
412
|
+
const ctx = ParserContext.create(this, { doc });
|
|
413
|
+
const src = new Source(doc.getText());
|
|
432
414
|
let ans;
|
|
433
415
|
ctx.symbols.clear({ contributor: 'parser', uri: doc.uri });
|
|
434
|
-
ctx.symbols.contributeAs('parser', () => ans =
|
|
416
|
+
ctx.symbols.contributeAs('parser', () => ans = file()(src, ctx));
|
|
435
417
|
return ans;
|
|
436
418
|
}
|
|
437
419
|
cache(doc, node) {
|
|
438
420
|
const data = { doc, node };
|
|
439
|
-
|
|
421
|
+
this.#docAndNodes.set(doc.uri, data);
|
|
440
422
|
this.emit('documentUpdated', data);
|
|
441
423
|
return data;
|
|
442
424
|
}
|
|
443
425
|
async check(doc, node) {
|
|
444
426
|
const checker = this.meta.getChecker(node.type);
|
|
445
|
-
const ctx =
|
|
427
|
+
const ctx = CheckerContext.create(this, { doc });
|
|
446
428
|
ctx.symbols.clear({ contributor: 'checker', uri: doc.uri });
|
|
447
429
|
await ctx.symbols.contributeAsAsync('checker', async () => {
|
|
448
430
|
await checker(node, ctx);
|
|
@@ -464,7 +446,7 @@ class Project extends events_1.default {
|
|
|
464
446
|
lint(doc, node) {
|
|
465
447
|
node.linterErrors = [];
|
|
466
448
|
for (const [ruleName, rawValue] of Object.entries(this.config.lint)) {
|
|
467
|
-
const result =
|
|
449
|
+
const result = LinterConfigValue.destruct(rawValue);
|
|
468
450
|
if (!result) {
|
|
469
451
|
// Rule is disabled (i.e. set to `null`) in the config.
|
|
470
452
|
continue;
|
|
@@ -475,13 +457,13 @@ class Project extends events_1.default {
|
|
|
475
457
|
// Config value is invalid.
|
|
476
458
|
continue;
|
|
477
459
|
}
|
|
478
|
-
const ctx =
|
|
460
|
+
const ctx = LinterContext.create(this, {
|
|
479
461
|
doc,
|
|
480
|
-
err: new
|
|
462
|
+
err: new LinterErrorReporter(ruleName, ruleSeverity),
|
|
481
463
|
ruleName,
|
|
482
464
|
ruleValue,
|
|
483
465
|
});
|
|
484
|
-
|
|
466
|
+
traversePreOrder(node, () => true, () => true, node => {
|
|
485
467
|
if (nodePredicate(node)) {
|
|
486
468
|
linter(node, ctx);
|
|
487
469
|
}
|
|
@@ -507,11 +489,18 @@ class Project extends events_1.default {
|
|
|
507
489
|
}
|
|
508
490
|
return result;
|
|
509
491
|
}
|
|
492
|
+
async ensureParsedAndCheckedOnlyWhenReady(uri) {
|
|
493
|
+
const result = await this.ensureParsed(uri);
|
|
494
|
+
if (this.#isReady && result) {
|
|
495
|
+
await this.ensureChecked(result.doc, result.node);
|
|
496
|
+
}
|
|
497
|
+
return result;
|
|
498
|
+
}
|
|
510
499
|
bind(param) {
|
|
511
|
-
const ctx =
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
500
|
+
const ctx = UriBinderContext.create(this);
|
|
501
|
+
if (typeof param === 'string') {
|
|
502
|
+
ctx.symbols.clear({ contributor: 'uri_binder', uri: param });
|
|
503
|
+
}
|
|
515
504
|
ctx.symbols.contributeAs('uri_binder', () => {
|
|
516
505
|
const uris = Array.isArray(param) ? param : [param];
|
|
517
506
|
for (const binder of this.meta.uriBinders) {
|
|
@@ -523,40 +512,53 @@ class Project extends events_1.default {
|
|
|
523
512
|
* Notify that a new document was opened in the editor.
|
|
524
513
|
*/
|
|
525
514
|
onDidOpen(uri, languageID, version, content) {
|
|
526
|
-
uri =
|
|
527
|
-
|
|
528
|
-
|
|
515
|
+
uri = this.normalizeUri(uri);
|
|
516
|
+
if (!fileUtil.isFileUri(uri)) {
|
|
517
|
+
return; // We only accept `file:` scheme for client-managed URIs.
|
|
518
|
+
}
|
|
519
|
+
this.#clientManagedUris.add(uri);
|
|
520
|
+
const doc = TextDocument.create(uri, languageID, version, content);
|
|
529
521
|
const { node } = this.parseAndCache(doc);
|
|
530
|
-
this
|
|
522
|
+
if (this.#isReady) {
|
|
523
|
+
this.check(doc, node);
|
|
524
|
+
}
|
|
531
525
|
}
|
|
532
526
|
/**
|
|
533
527
|
* Notify that an existing document was changed in the editor.
|
|
534
528
|
* @throws If there is no `TextDocument` corresponding to the URI.
|
|
535
529
|
*/
|
|
536
530
|
onDidChange(uri, changes, version) {
|
|
537
|
-
uri =
|
|
531
|
+
uri = this.normalizeUri(uri);
|
|
532
|
+
if (!fileUtil.isFileUri(uri)) {
|
|
533
|
+
return; // We only accept `file:` scheme for client-managed URIs.
|
|
534
|
+
}
|
|
538
535
|
const result = this.get(uri);
|
|
539
536
|
if (!result) {
|
|
540
537
|
throw new Error(`Document for “${uri}” is not cached. This should not happen. Did the language client send a didChange notification without sending a didOpen one?`);
|
|
541
538
|
}
|
|
542
|
-
|
|
539
|
+
TextDocument.update(result.doc, changes, version);
|
|
543
540
|
const { node } = this.parseAndCache(result.doc);
|
|
544
|
-
this
|
|
541
|
+
if (this.#isReady) {
|
|
542
|
+
this.check(result.doc, node);
|
|
543
|
+
}
|
|
545
544
|
}
|
|
546
545
|
/**
|
|
547
546
|
* Notify that an existing document was closed in the editor.
|
|
548
547
|
*/
|
|
549
548
|
onDidClose(uri) {
|
|
550
|
-
uri =
|
|
551
|
-
|
|
549
|
+
uri = this.normalizeUri(uri);
|
|
550
|
+
if (!fileUtil.isFileUri(uri)) {
|
|
551
|
+
return; // We only accept `file:` scheme for client-managed URIs.
|
|
552
|
+
}
|
|
553
|
+
this.#clientManagedUris.delete(uri);
|
|
552
554
|
this.tryClearingCache(uri);
|
|
553
555
|
}
|
|
554
556
|
async showCacheRoot() {
|
|
555
|
-
if (!
|
|
557
|
+
if (!this.#cacheRoot) {
|
|
556
558
|
return;
|
|
557
559
|
}
|
|
558
560
|
try {
|
|
559
|
-
await
|
|
561
|
+
await this.externals.fs.showFile(this.#cacheRoot);
|
|
560
562
|
}
|
|
561
563
|
catch (e) {
|
|
562
564
|
this.logger.error('[Service#showCacheRoot]', e);
|
|
@@ -564,30 +566,30 @@ class Project extends events_1.default {
|
|
|
564
566
|
}
|
|
565
567
|
tryClearingCache(uri) {
|
|
566
568
|
if (this.shouldRemove(uri)) {
|
|
567
|
-
|
|
569
|
+
this.#docAndNodes.delete(uri);
|
|
568
570
|
this.emit('documentRemoved', { uri });
|
|
569
571
|
}
|
|
570
572
|
}
|
|
571
573
|
shouldRemove(uri) {
|
|
572
|
-
return !
|
|
574
|
+
return !this.#clientManagedUris.has(uri) && !this.#dependencyFiles.has(uri) && !this.#watchedFiles.has(uri);
|
|
573
575
|
}
|
|
574
576
|
isOnlyWatched(uri) {
|
|
575
|
-
return
|
|
577
|
+
return this.#watchedFiles.has(uri) && !this.#clientManagedUris.has(uri) && !this.#dependencyFiles.has(uri);
|
|
576
578
|
}
|
|
577
579
|
}
|
|
578
|
-
_Project_cacheSaverIntervalId = new WeakMap(), _Project_clientManagedUris = new WeakMap(), _Project_configService = new WeakMap(), _Project_docAndNodes = new WeakMap(), _Project_initializers = new WeakMap(), _Project_initPromise = new WeakMap(), _Project_readyPromise = new WeakMap(), _Project_watchedFiles = new WeakMap(), _Project_watcher = new WeakMap(), _Project_watcherReady = new WeakMap(), _Project_dependencyRoots = new WeakMap(), _Project_dependencyFiles = new WeakMap(), _Project_roots = new WeakMap(), _Project_ctx = new WeakMap(), _Project_cacheRoot = new WeakMap();
|
|
579
|
-
Project.RootSuffix = '/pack.mcmeta';
|
|
580
580
|
__decorate([
|
|
581
|
-
|
|
581
|
+
CachePromise()
|
|
582
582
|
], Project.prototype, "ensureParsed", null);
|
|
583
583
|
__decorate([
|
|
584
|
-
|
|
584
|
+
CachePromise()
|
|
585
585
|
], Project.prototype, "check", null);
|
|
586
586
|
__decorate([
|
|
587
|
-
|
|
587
|
+
CachePromise()
|
|
588
588
|
], Project.prototype, "ensureChecked", null);
|
|
589
589
|
__decorate([
|
|
590
|
-
|
|
590
|
+
CachePromise()
|
|
591
591
|
], Project.prototype, "ensureParsedAndChecked", null);
|
|
592
|
-
|
|
592
|
+
__decorate([
|
|
593
|
+
CachePromise()
|
|
594
|
+
], Project.prototype, "ensureParsedAndCheckedOnlyWhenReady", null);
|
|
593
595
|
//# sourceMappingURL=Project.js.map
|