@lcap/nasl 3.14.0-rc.1 → 3.14.0-rc.3
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/out/server/naslServer.d.ts +14 -4
- package/out/server/naslServer.d.ts.map +1 -1
- package/out/server/naslServer.js +141 -101
- package/out/server/naslServer.js.map +1 -1
- package/out/service/storage/cache/index.d.ts.map +1 -1
- package/out/service/storage/cache/index.js +6 -3
- package/out/service/storage/cache/index.js.map +1 -1
- package/out/templator/block2nasl/viewMergeBlock.js +5 -6
- package/out/templator/block2nasl/viewMergeBlock.js.map +1 -1
- package/package.json +10 -10
|
@@ -67,7 +67,6 @@ declare class NaslServer {
|
|
|
67
67
|
diagnosticManager: DiagnosticManager;
|
|
68
68
|
embeddedTSEmitter: EventEmitter;
|
|
69
69
|
changeStackList: Array<NASLObject.EventPayload>;
|
|
70
|
-
tsFilesToCheck: Set<string>;
|
|
71
70
|
typerCheckFiles: Set<SyntaxNode>;
|
|
72
71
|
typerRemoveNodes: Set<SyntaxNode>;
|
|
73
72
|
typerCreateNodes: Set<SyntaxNode>;
|
|
@@ -136,6 +135,7 @@ declare class NaslServer {
|
|
|
136
135
|
getLatestVersionsOfSharedApp(): SharedAppVersion[];
|
|
137
136
|
getUpdatedSharedApp(app: App): Module;
|
|
138
137
|
fetchDtsFile(url: string): Promise<string>;
|
|
138
|
+
private firstScreenEndWork;
|
|
139
139
|
openApp(app: App, performance?: boolean, needRegisterCommand?: boolean): Promise<void>;
|
|
140
140
|
refreshApp(app: App, performance?: boolean): Promise<void>;
|
|
141
141
|
/**
|
|
@@ -356,9 +356,19 @@ declare class NaslServer {
|
|
|
356
356
|
* @param targetNode 当前操作的节点
|
|
357
357
|
*/
|
|
358
358
|
noFileRefCheck(fileNode: BaseNode, targetNode: BaseNode, action: string): boolean;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
private
|
|
359
|
+
private processAllEvents;
|
|
360
|
+
private processSingleChangeEvent;
|
|
361
|
+
private notifyStartWork;
|
|
362
|
+
private acquireLock;
|
|
363
|
+
private flushChangesForTypeChecking;
|
|
364
|
+
/**
|
|
365
|
+
* 根据入参准备并往 TS Server 写入需要校验的 ts 文件
|
|
366
|
+
* @param chkFiles 需要校验的文件
|
|
367
|
+
* @param removedNodes 需要删除的文件
|
|
368
|
+
* @param oqlRemoveNodesTsPath 需要删除的文件路径
|
|
369
|
+
* @returns 需要校验的文件名
|
|
370
|
+
*/
|
|
371
|
+
private prepareAndWriteTsFilesToCheck;
|
|
362
372
|
/**
|
|
363
373
|
* 获取 Connector 对应 Connector 的properties
|
|
364
374
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"naslServer.d.ts","sourceRoot":"","sources":["../../src/server/naslServer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAa,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAQ1C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,GAAG,EAEH,KAAK,EAEL,cAAc,EAed,KAAK,EAIL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,aAAa,EAKb,aAAa,EAkCb,SAAS,EAET,UAAU,EAmBV,UAAU,EAGV,YAAY,EAIZ,yBAAyB,EAI1B,MAAM,aAAa,CAAC;AAyBrB,OAAO,KAAK,KAAK,MAAM,UAAU,CAAC;AAKlC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAwD,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9F,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAIxF,KAA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BvE,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,wBAAwB;IAkDhC,OAAO,CAAC,eAAe;YAsBT,WAAW;YAWX,2BAA2B;IA2EzC;;;;;;OAMG;IACH,OAAO,CAAC,6BAA6B,CA8EpC;IAGD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,UAAU,GAAG,SAAS;IAcxD,OAAO,CAAC,WAAW;IAInB,mCAAmC,CAAC,IAAI,EAAE,UAAU;IAIpD,0BAA0B;IACpB,yBAAyB,CAAC,GAAG,EAAE,GAAG;IAYxC,0BAA0B;IACpB,wBAAwB,CAAC,GAAG,EAAE,GAAG;IAkBvC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC;IAKzB;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI,EAAE,QAAQ;;;;;;;;;;;;;IAoDtC;;;;;OAKG;IACH,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,GAAE,UAA8B;;;;IAkBxE;;;;;MAKE;IACF,qBAAqB,CAAC,IAAI,EAAE,UAAU;IAStC,eAAe;YACD,sBAAsB;IAyGpC,YAAY,OAAQ,QAAQ,gBAE3B;IAED,uBAAuB;CA2BxB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/out/server/naslServer.js
CHANGED
|
@@ -39,6 +39,7 @@ const nasl_sentry_1 = require("@lcap/nasl-sentry");
|
|
|
39
39
|
const Messager_1 = __importDefault(require("../common/Messager"));
|
|
40
40
|
const oql_cache_1 = require("./OQL/oql-cache");
|
|
41
41
|
const initial_1 = require("../service/initial");
|
|
42
|
+
const set_1 = require("mnemonist/set");
|
|
42
43
|
/// #if process.env.BUILD_TARGET === 'node'
|
|
43
44
|
const fs = __importStar(require("fs-extra"));
|
|
44
45
|
const path = __importStar(require("path"));
|
|
@@ -162,7 +163,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
162
163
|
this.openDebugEmbedded = true;
|
|
163
164
|
/// #endif
|
|
164
165
|
this.elementsLogic = {};
|
|
165
|
-
//
|
|
166
|
+
// 待处理的变化事件
|
|
166
167
|
this.changeStackList = [];
|
|
167
168
|
// 需要检查的文件节点
|
|
168
169
|
this.typerCheckFiles = new Set();
|
|
@@ -196,10 +197,17 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
196
197
|
};
|
|
197
198
|
// 检查共享数据是否有更新
|
|
198
199
|
this._latestVersionsOfSharedApp = [];
|
|
200
|
+
this.firstScreenEndWork = undefined;
|
|
199
201
|
// 用户点击"查找引用"
|
|
200
202
|
this.findReferenceAndRender = (nd) => (0, findReference_1.findReferenceAndRender)(this.semEnv, nd);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
+
/**
|
|
204
|
+
* 根据入参准备并往 TS Server 写入需要校验的 ts 文件
|
|
205
|
+
* @param chkFiles 需要校验的文件
|
|
206
|
+
* @param removedNodes 需要删除的文件
|
|
207
|
+
* @param oqlRemoveNodesTsPath 需要删除的文件路径
|
|
208
|
+
* @returns 需要校验的文件名
|
|
209
|
+
*/
|
|
210
|
+
this.prepareAndWriteTsFilesToCheck = async (oqlFiles, removedNodes, oqlRemoveNodesTsPath) => {
|
|
203
211
|
function getETSFilePath(fileNode) {
|
|
204
212
|
try {
|
|
205
213
|
return fileNode.getEmbeddedFilePath();
|
|
@@ -209,7 +217,6 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
209
217
|
}
|
|
210
218
|
}
|
|
211
219
|
async function removeETSFile(filePath) {
|
|
212
|
-
// const filePath = getETSFilePath(fileNode);
|
|
213
220
|
if (!filePath) {
|
|
214
221
|
return;
|
|
215
222
|
}
|
|
@@ -227,7 +234,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
227
234
|
for (const filePath of oqlRemoveNodesTsPath) {
|
|
228
235
|
await removeETSFile(filePath);
|
|
229
236
|
}
|
|
230
|
-
|
|
237
|
+
const tsFilePathsToCheck = new Set();
|
|
231
238
|
for (const fileNode of oqlFiles) {
|
|
232
239
|
this.semData.isFirstScreen = true; // getter 会看 naslServer.semData.isFirstScreen
|
|
233
240
|
this.semData.redirectSlowGetters(NaslServer_1.toRaw(this.getProxyApp()));
|
|
@@ -236,7 +243,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
236
243
|
tsFilePath = fileNode.getEmbeddedFilePath();
|
|
237
244
|
}
|
|
238
245
|
catch (err) {
|
|
239
|
-
|
|
246
|
+
this.logger.error(err);
|
|
240
247
|
// TODO wudengke 或许需要 continue
|
|
241
248
|
}
|
|
242
249
|
let tsFile;
|
|
@@ -249,7 +256,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
249
256
|
file: tsFile.filePath,
|
|
250
257
|
fileContent: tsFile.code,
|
|
251
258
|
}]);
|
|
252
|
-
|
|
259
|
+
tsFilePathsToCheck.add(tsFilePath);
|
|
253
260
|
// 如果当前没有生成tsFile
|
|
254
261
|
if (!tsFile?.sourceMap) {
|
|
255
262
|
continue;
|
|
@@ -263,7 +270,6 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
263
270
|
fileNode.sourceMap = tsFile.sourceMap;
|
|
264
271
|
// 麻了,查了半天是没 set 这里
|
|
265
272
|
this.file2NodeMap.set(tsFile.filePath, fileNode);
|
|
266
|
-
//
|
|
267
273
|
this.semData.recoverSlowGetters();
|
|
268
274
|
this.semData.clearSemanticData();
|
|
269
275
|
this.semData.isFirstScreen = false;
|
|
@@ -272,6 +278,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
272
278
|
console.info('TS 校验以下文件', Array.from(oqlFiles).map((item) => item.getEmbeddedFilePath()));
|
|
273
279
|
}
|
|
274
280
|
console.timeEnd('TS 文件变更');
|
|
281
|
+
return { tsFilePathsToCheck };
|
|
275
282
|
};
|
|
276
283
|
this.getProxyNode = (nd) => {
|
|
277
284
|
return this.getProxyApp()?.findNodeByPath(nd.nodePath);
|
|
@@ -307,7 +314,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
307
314
|
const instance = globalThis.window;
|
|
308
315
|
const baseIdePath = instance?.baseIdePath;
|
|
309
316
|
const hash = process.env.COMMIT_HASH || '';
|
|
310
|
-
const filename = instance?.electron
|
|
317
|
+
const filename = instance?.electron?.createWorker
|
|
311
318
|
? 'tsserver.electron.js'
|
|
312
319
|
: 'tsserver.js';
|
|
313
320
|
// @ts-ignore
|
|
@@ -320,10 +327,6 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
320
327
|
this.http = opt.http;
|
|
321
328
|
this.isAnnotationMode = opt?.isAnnotationMode ?? false;
|
|
322
329
|
this.logger = opt.logger ?? utils.internalLogger;
|
|
323
|
-
// 要Check的文件
|
|
324
|
-
this.tsFilesToCheck = new Set();
|
|
325
|
-
// 单个文件正在change,不允许同时两个文件一起change
|
|
326
|
-
this.singleFileChangeIng = false;
|
|
327
330
|
this.diagnosticManager = new diagnostic_1.DiagnosticManager();
|
|
328
331
|
this.messager = new SentryMessager({
|
|
329
332
|
protocol: 'ts-worker',
|
|
@@ -348,6 +351,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
348
351
|
// 已经和 NASL 节点配对的诊断信息
|
|
349
352
|
const isProfileMode = this.flags.profileMode;
|
|
350
353
|
if (this.isFirstScreen) {
|
|
354
|
+
console.time('\x1b[44m\x1b[97m 用户体感首屏检查耗时 \x1b[0m');
|
|
351
355
|
// 对OQL节点加载来自TS的错误
|
|
352
356
|
tsDiagnostics.forEach(({ node, message }) => {
|
|
353
357
|
if (node.errorsFromTSServer) {
|
|
@@ -412,24 +416,16 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
412
416
|
if (isProfileMode) {
|
|
413
417
|
console.profileEnd('diag');
|
|
414
418
|
}
|
|
419
|
+
console.timeEnd('\x1b[44m\x1b[97m 用户体感首屏检查耗时 \x1b[0m');
|
|
415
420
|
}
|
|
416
|
-
// TODO wudengke 这里调用了一次,下面又一次,是不必要的。
|
|
417
421
|
this.semData.recoverSlowGetters();
|
|
418
422
|
this.semData.clearSemanticData();
|
|
419
423
|
}
|
|
420
|
-
try {
|
|
421
|
-
// 结束诊断和标注
|
|
422
|
-
(0, common_1.invokeCommand)('naslServer:endWork');
|
|
423
|
-
(0, common_1.invokeCommand)('naslServer:nodeChange');
|
|
424
|
-
this.embeddedTSEmitter.emit('naslServer:endWork');
|
|
425
|
-
this.embeddedTSEmitter.emit('naslServer:nodeChange');
|
|
426
|
-
}
|
|
427
|
-
catch (e) {
|
|
428
|
-
console.log('error', e);
|
|
429
|
-
console.error('error', e);
|
|
430
|
-
this.logger.info('no "naslServer:nodeChange" event received');
|
|
431
|
-
}
|
|
432
424
|
this.notifyPublishDiagnosticsEnd(tsDiagnostics);
|
|
425
|
+
if (this.firstScreenEndWork) {
|
|
426
|
+
this.firstScreenEndWork();
|
|
427
|
+
this.firstScreenEndWork = undefined;
|
|
428
|
+
}
|
|
433
429
|
},
|
|
434
430
|
});
|
|
435
431
|
// 监听所有改变操作
|
|
@@ -469,7 +465,9 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
469
465
|
// FIXME: 验证完成后需要移除
|
|
470
466
|
const { fileNode: fileNode2 } = NaslServer_1.getCurrentSource(changeNode);
|
|
471
467
|
const fileNode = (0, service_1.getFileNode)(changeNode);
|
|
472
|
-
NaslServer_1.toRaw(fileNode) !== NaslServer_1.toRaw(fileNode2)
|
|
468
|
+
if (NaslServer_1.toRaw(fileNode) !== NaslServer_1.toRaw(fileNode2)) {
|
|
469
|
+
this.logger.error('\x1b[41m\x1b[97m ☁️ embeddedTSEmitter change 事件中计算不一致 \x1b[0m');
|
|
470
|
+
}
|
|
473
471
|
// 这个方法是 5.0 加入标准库的,但是这里 ts 版本是 4.x,ci 会挂,所以需要忽略
|
|
474
472
|
// @ts-ignore
|
|
475
473
|
const findLastIndex = this.changeStackList.findLastIndex((changeStackItem) => {
|
|
@@ -491,15 +489,16 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
491
489
|
}
|
|
492
490
|
catch (err) {
|
|
493
491
|
this.logger.info(err);
|
|
494
|
-
|
|
492
|
+
if (item.originEvent) {
|
|
493
|
+
this.changeStackList.push(item.originEvent);
|
|
494
|
+
}
|
|
495
495
|
}
|
|
496
496
|
});
|
|
497
|
-
//
|
|
497
|
+
// 如果有长度,那么触发类型检查
|
|
498
498
|
if (this.changeStackList.length) {
|
|
499
499
|
itemEventPtr.forEach(payload => {
|
|
500
500
|
// 增量更新 step 1:处理 create、delete、update 的局部符号
|
|
501
501
|
const startTime = performance.now();
|
|
502
|
-
// @ts-ignore
|
|
503
502
|
this.semEnv.refMgr.updateRefsInNaslFragment(this.semEnv, payload);
|
|
504
503
|
const endTime = performance.now();
|
|
505
504
|
const duration = endTime - startTime;
|
|
@@ -507,7 +506,9 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
507
506
|
console.log(`\x1b[44m\x1b[97m Reference manager: Update Nasl Fragment References took ${duration.toFixed(2)}ms \x1b[0m`);
|
|
508
507
|
}
|
|
509
508
|
});
|
|
510
|
-
this.
|
|
509
|
+
void this.flushChangesForTypeChecking().catch(err => {
|
|
510
|
+
this.logger.error('triggerTypeChecking error', err);
|
|
511
|
+
});
|
|
511
512
|
}
|
|
512
513
|
});
|
|
513
514
|
}
|
|
@@ -817,11 +818,13 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
817
818
|
this.semData.redirectSlowGetters(rawApp);
|
|
818
819
|
// @ts-ignore
|
|
819
820
|
this.semData.collectAllSemanticCtx(rawApp);
|
|
820
|
-
// semantics.printSemanticDataInfo();
|
|
821
821
|
this.logger.timeEnd('全量生成 TS——翻译——简单语义分析');
|
|
822
|
-
|
|
822
|
+
const { notifyEndWork } = this.notifyStartWork();
|
|
823
|
+
this.firstScreenEndWork = () => {
|
|
824
|
+
this.logger.info('firstScreenEndWork');
|
|
825
|
+
notifyEndWork();
|
|
826
|
+
};
|
|
823
827
|
const self = this;
|
|
824
|
-
this.performance = performance;
|
|
825
828
|
try {
|
|
826
829
|
await this.requestDatabaseConfigs(this.http, app);
|
|
827
830
|
}
|
|
@@ -1168,6 +1171,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
1168
1171
|
});
|
|
1169
1172
|
}
|
|
1170
1173
|
notifyPublishDiagnosticsEnd(tsDiagnostics) {
|
|
1174
|
+
this.logger.info('publishDiagnosticsEnd');
|
|
1171
1175
|
this.embeddedTSEmitter.emit('publishDiagnosticsEnd', tsDiagnostics);
|
|
1172
1176
|
}
|
|
1173
1177
|
getDiagnosticRecordsAndPushAll(fileNames) {
|
|
@@ -1944,7 +1948,7 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
1944
1948
|
// 如果修改的是dataSource属性
|
|
1945
1949
|
if (nd instanceof concepts_1.DataSource) {
|
|
1946
1950
|
const calcTypeNamespace = (typeNamespace) => {
|
|
1947
|
-
const dsNsp = (0,
|
|
1951
|
+
const dsNsp = typeNamespace.split('.').slice(0, -2).join('.');
|
|
1948
1952
|
// 新的完整的value
|
|
1949
1953
|
const newTextValue = `${dsNsp}.${newValue}.entities`;
|
|
1950
1954
|
minRange.newValue = newTextValue;
|
|
@@ -2467,6 +2471,10 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
2467
2471
|
try {
|
|
2468
2472
|
// 因为node可能是经过处理的TypeAnnotation
|
|
2469
2473
|
node.__isCorrectTypeAnnotation = true;
|
|
2474
|
+
if (node instanceof concepts_1.OqlQueryComponent) {
|
|
2475
|
+
// HACK 目前TS类型标注和节点上的错误信息清空是耦合的。之后需要下掉TS OQL检查
|
|
2476
|
+
node.errorsFromTSServer = undefined;
|
|
2477
|
+
}
|
|
2470
2478
|
if (ty) {
|
|
2471
2479
|
if (node instanceof concepts_1.OqlQueryComponent) {
|
|
2472
2480
|
// 自动推导情况
|
|
@@ -3179,21 +3187,21 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
3179
3187
|
}
|
|
3180
3188
|
return flag;
|
|
3181
3189
|
}
|
|
3182
|
-
|
|
3183
|
-
|
|
3190
|
+
processAllEvents(payloadList) {
|
|
3191
|
+
let changed = false;
|
|
3192
|
+
for (const payload of payloadList) {
|
|
3193
|
+
const res = this.processSingleChangeEvent(payload);
|
|
3194
|
+
changed = changed || res;
|
|
3195
|
+
}
|
|
3196
|
+
return { changed };
|
|
3197
|
+
}
|
|
3198
|
+
processSingleChangeEvent(payload) {
|
|
3199
|
+
const { action } = payload;
|
|
3184
3200
|
if (this.isAnnotationMode) {
|
|
3185
3201
|
utils.isDebugMode && this.logger.info('只读模式下不会触发文件变更');
|
|
3186
3202
|
return;
|
|
3187
3203
|
}
|
|
3188
|
-
|
|
3189
|
-
(0, common_1.invokeCommand)('naslServer:startWork');
|
|
3190
|
-
}
|
|
3191
|
-
this.logger.time('语言服务变更');
|
|
3192
|
-
this.singleFileChangeIng = true;
|
|
3193
|
-
this.lsRunEnd = new Promise((resolve) => {
|
|
3194
|
-
this._lsRunEndSwitch = resolve;
|
|
3195
|
-
});
|
|
3196
|
-
const targetNode = $event.target;
|
|
3204
|
+
const targetNode = payload.target;
|
|
3197
3205
|
utils.isDebugMode && this.logger.info(targetNode, 'targetNode');
|
|
3198
3206
|
if (targetNode instanceof concepts_1.I18nInfo) {
|
|
3199
3207
|
return;
|
|
@@ -3201,7 +3209,6 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
3201
3209
|
// FIXME: 验证完成后需要移除
|
|
3202
3210
|
const { fileNode: fileNode2 } = NaslServer_1.getCurrentSource(targetNode);
|
|
3203
3211
|
const fileNode = (0, service_1.getFileNode)(targetNode);
|
|
3204
|
-
// @ts-ignore
|
|
3205
3212
|
const fileNodeRaw = NaslServer_1.toRaw(fileNode);
|
|
3206
3213
|
fileNodeRaw !== NaslServer_1.toRaw(fileNode2) && console.log('\x1b[41m\x1b[97m☁️ handleAllChange 事件 fileNode 校验失败\x1b[0m');
|
|
3207
3214
|
const targetNodeRaw = NaslServer_1.toRaw(targetNode);
|
|
@@ -3209,8 +3216,8 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
3209
3216
|
let result = null;
|
|
3210
3217
|
if (nasl_language_server_core_1.ReferenceManager.defConcept.includes(targetNodeRaw.concept)) {
|
|
3211
3218
|
if (action === 'update') {
|
|
3212
|
-
if (
|
|
3213
|
-
const oldName =
|
|
3219
|
+
if (payload?.field === 'name') {
|
|
3220
|
+
const oldName = payload.oldObjNasl?.[0];
|
|
3214
3221
|
result = (0, nasl_language_server_core_1.preProcessDefRename)(this.semEnv, targetNodeRaw, oldName, this.currentRenameMode, this.oqlRemoveNodesTsPath);
|
|
3215
3222
|
this.currentRenameMode = null;
|
|
3216
3223
|
}
|
|
@@ -3232,62 +3239,95 @@ let NaslServer = NaslServer_1 = class NaslServer {
|
|
|
3232
3239
|
result.typerCheckFiles.forEach(file => this.typerCheckFiles.add(file));
|
|
3233
3240
|
result.typerRemoveNodes.forEach(node => this.typerRemoveNodes.add(node));
|
|
3234
3241
|
result.typerCreateNodes.forEach(node => this.typerCreateNodes.add(node));
|
|
3242
|
+
return true;
|
|
3235
3243
|
}
|
|
3236
3244
|
}
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3245
|
+
notifyStartWork() {
|
|
3246
|
+
this.logger.time('语言服务变更');
|
|
3247
|
+
this.logger.info('naslServer:startWork');
|
|
3248
|
+
(0, common_1.invokeCommand)('naslServer:startWork');
|
|
3249
|
+
const endWork = () => {
|
|
3250
|
+
try {
|
|
3251
|
+
this.logger.info('naslServer:endWork');
|
|
3252
|
+
// 结束诊断和标注
|
|
3253
|
+
(0, common_1.invokeCommand)('naslServer:endWork');
|
|
3254
|
+
(0, common_1.invokeCommand)('naslServer:nodeChange');
|
|
3255
|
+
this.embeddedTSEmitter.emit('naslServer:endWork');
|
|
3256
|
+
this.embeddedTSEmitter.emit('naslServer:nodeChange');
|
|
3257
|
+
this.logger.timeEnd('语言服务变更');
|
|
3258
|
+
}
|
|
3259
|
+
catch (e) {
|
|
3260
|
+
console.log('error', e);
|
|
3261
|
+
console.error('error', e);
|
|
3262
|
+
this.logger.info('no "naslServer:nodeChange" event received');
|
|
3263
|
+
}
|
|
3264
|
+
};
|
|
3265
|
+
return { notifyEndWork: endWork };
|
|
3266
|
+
}
|
|
3267
|
+
async acquireLock() {
|
|
3268
|
+
const old = this.lsRunEnd;
|
|
3269
|
+
let endChange;
|
|
3270
|
+
this.lsRunEnd = new Promise((resolve) => {
|
|
3271
|
+
endChange = resolve;
|
|
3272
|
+
});
|
|
3273
|
+
// 每个锁的获取依赖前一个锁的释放
|
|
3274
|
+
await old;
|
|
3275
|
+
return { release: endChange };
|
|
3276
|
+
}
|
|
3277
|
+
async flushChangesForTypeChecking() {
|
|
3278
|
+
// 获取锁。这可以保证当前没有类型检查在跑
|
|
3279
|
+
const { release } = await this.acquireLock();
|
|
3280
|
+
// 从 changeStackList 中取出所有积压的事件,并清空
|
|
3281
|
+
const events = this.changeStackList.slice();
|
|
3282
|
+
this.changeStackList.length = 0;
|
|
3283
|
+
const { notifyEndWork } = this.notifyStartWork();
|
|
3284
|
+
try {
|
|
3285
|
+
const { changed } = this.processAllEvents(events);
|
|
3286
|
+
if (changed) {
|
|
3287
|
+
this.logger.info('triggerTypeChecking 需要进行类型检查');
|
|
3288
|
+
const oqlCheckFiles = new Set((0, nasl_language_server_core_1.getOqlFiles)(this.semEnv, this.typerCheckFiles, this.typerRemoveNodes));
|
|
3289
|
+
const { tsFilePathsToCheck } = await this.prepareAndWriteTsFilesToCheck(oqlCheckFiles, this.typerRemoveNodes, this.oqlRemoveNodesTsPath);
|
|
3290
|
+
if (utils.isDebugMode) {
|
|
3291
|
+
console.log('Little Typer 可能校验以下直接引用文件', this.typerCheckFiles.size, Array.from(this.typerCheckFiles).map((item) => item.nodePath).join('\n'));
|
|
3292
|
+
console.log('Little Typer 删除以下节点', Array.from(this.typerRemoveNodes).map((item) => item.nodePath).join('\n'));
|
|
3293
|
+
}
|
|
3294
|
+
const tsDiagnostics = await this.getDiagnosticRecordsAndPushAllAndWaitPublishDiagnosticsEnd(Array.from(tsFilePathsToCheck));
|
|
3295
|
+
const diagRecs = await (0, nasl_language_server_core_1.checkUpdateRefsDiag)(this.semEnv, this.diagnosticManager, (0, set_1.union)(this.typerCheckFiles, oqlCheckFiles), this.typerRemoveNodes, this.typerCreateNodes, tsDiagnostics);
|
|
3296
|
+
// 刷新左侧事件逻辑树,这是额外的耗时、开销
|
|
3297
|
+
this.typerCheckFiles.forEach((nd) => {
|
|
3298
|
+
const isProcessV2 = nd.concept === 'ProcessV2';
|
|
3299
|
+
const isViewLike = nd.concept === 'View' || nd.concept === 'BusinessComponent' || isProcessV2;
|
|
3300
|
+
// 删除时,这些节点可能已经不在了,先用个 ?.
|
|
3301
|
+
isViewLike && this.getProxyNode(nd)?.getElementLogicRoot();
|
|
3263
3302
|
// 刷新左侧子逻辑 SubLogics,这是额外的耗时、开销
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
this.
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3303
|
+
const isLogicLike = nd.concept === 'Logic' || nd.concept === 'SubLogic' || nd.concept === 'View'
|
|
3304
|
+
|| nd.concept === 'ProcessElementV2' || isProcessV2
|
|
3305
|
+
|| nd.concept === 'Process' || nd.concept === 'ProcessElement';
|
|
3306
|
+
isLogicLike && this.getProxyNode(nd)?.getSubLogics();
|
|
3307
|
+
isProcessV2 && this.getProxyNode(nd)?.getVariablesRoot();
|
|
3308
|
+
});
|
|
3309
|
+
console.time('\x1b[44m\x1b[97m 6: push all diagnostic records \x1b[0m');
|
|
3310
|
+
await this.diagnosticManager.pushAll(diagRecs);
|
|
3311
|
+
this.typerCheckFiles.clear();
|
|
3312
|
+
this.typerRemoveNodes.clear();
|
|
3313
|
+
this.typerCreateNodes.clear();
|
|
3314
|
+
this.typerErrRecords.length = 0;
|
|
3315
|
+
this.oqlRemoveNodesTsPath.clear();
|
|
3316
|
+
this.semEnv.allocatedVEQNames.forEach(n => {
|
|
3317
|
+
this.semEnv.refMgr.qNameDefs.delete(n);
|
|
3318
|
+
});
|
|
3319
|
+
this.semEnv.allocatedVEQNames.length = 0;
|
|
3320
|
+
console.timeEnd('\x1b[44m\x1b[97m 6: push all diagnostic records \x1b[0m');
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
catch (err) {
|
|
3324
|
+
this.logger.error('flushChangesForTypeChecking 出错了', err);
|
|
3325
|
+
}
|
|
3326
|
+
finally {
|
|
3327
|
+
notifyEndWork();
|
|
3328
|
+
release();
|
|
3290
3329
|
}
|
|
3330
|
+
;
|
|
3291
3331
|
}
|
|
3292
3332
|
/**
|
|
3293
3333
|
* 获取 Connector 对应 Connector 的properties
|