@lcap/nasl 2.21.0-beta.2 → 2.21.0-beta.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.
Files changed (188) hide show
  1. package/out/automate/engine/operators.d.ts +2 -2
  2. package/out/automate/engine/operators.js +14 -5
  3. package/out/automate/engine/operators.js.map +1 -1
  4. package/out/common/BaseNode.d.ts +6 -0
  5. package/out/common/BaseNode.js +45 -8
  6. package/out/common/BaseNode.js.map +1 -1
  7. package/out/concepts/Abort__.d.ts +1 -1
  8. package/out/concepts/Abort__.js +3 -3
  9. package/out/concepts/Abort__.js.map +1 -1
  10. package/out/concepts/App__.d.ts +0 -2
  11. package/out/concepts/App__.js +0 -42
  12. package/out/concepts/App__.js.map +1 -1
  13. package/out/concepts/BindAttribute__.js +18 -0
  14. package/out/concepts/BindAttribute__.js.map +1 -1
  15. package/out/concepts/BindEvent__.js +21 -22
  16. package/out/concepts/BindEvent__.js.map +1 -1
  17. package/out/concepts/CallFunction__.js.map +1 -1
  18. package/out/concepts/CallQueryComponent__.js +16 -16
  19. package/out/concepts/CallQueryComponent__.js.map +1 -1
  20. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  21. package/out/concepts/DataSource__.d.ts +0 -1
  22. package/out/concepts/DataSource__.js +0 -3
  23. package/out/concepts/DataSource__.js.map +1 -1
  24. package/out/concepts/EntityProperty__.d.ts +0 -23
  25. package/out/concepts/EntityProperty__.js +0 -121
  26. package/out/concepts/EntityProperty__.js.map +1 -1
  27. package/out/concepts/InterfaceParam__.d.ts +0 -3
  28. package/out/concepts/InterfaceParam__.js +0 -64
  29. package/out/concepts/InterfaceParam__.js.map +1 -1
  30. package/out/concepts/Interface__.d.ts +0 -3
  31. package/out/concepts/Interface__.js +4 -8
  32. package/out/concepts/Interface__.js.map +1 -1
  33. package/out/concepts/Logic__.d.ts +1 -1
  34. package/out/concepts/Logic__.js +22 -42
  35. package/out/concepts/Logic__.js.map +1 -1
  36. package/out/concepts/MatchCase__.js +1 -1
  37. package/out/concepts/MatchCase__.js.map +1 -1
  38. package/out/concepts/MemberExpression__.js +1 -1
  39. package/out/concepts/MemberExpression__.js.map +1 -1
  40. package/out/concepts/Module__.d.ts +0 -12
  41. package/out/concepts/Module__.js +0 -7
  42. package/out/concepts/Module__.js.map +1 -1
  43. package/out/concepts/NewMap__.js +5 -1
  44. package/out/concepts/NewMap__.js.map +1 -1
  45. package/out/concepts/NumericLiteral__.js +9 -3
  46. package/out/concepts/NumericLiteral__.js.map +1 -1
  47. package/out/concepts/OqlQueryComponent__.d.ts +0 -1
  48. package/out/concepts/OqlQueryComponent__.js +0 -46
  49. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  50. package/out/concepts/Param__.d.ts +0 -3
  51. package/out/concepts/Param__.js +1 -67
  52. package/out/concepts/Param__.js.map +1 -1
  53. package/out/concepts/Rect__.js.map +1 -1
  54. package/out/concepts/Return__.d.ts +0 -3
  55. package/out/concepts/Return__.js +1 -67
  56. package/out/concepts/Return__.js.map +1 -1
  57. package/out/concepts/SqlQueryComponent__.d.ts +0 -1
  58. package/out/concepts/SqlQueryComponent__.js +0 -46
  59. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  60. package/out/concepts/StructureProperty__.d.ts +0 -3
  61. package/out/concepts/StructureProperty__.js +0 -65
  62. package/out/concepts/StructureProperty__.js.map +1 -1
  63. package/out/concepts/TypeAnnotation__.d.ts +1 -3
  64. package/out/concepts/TypeAnnotation__.js +12 -31
  65. package/out/concepts/TypeAnnotation__.js.map +1 -1
  66. package/out/concepts/Variable__.d.ts +0 -3
  67. package/out/concepts/Variable__.js +1 -67
  68. package/out/concepts/Variable__.js.map +1 -1
  69. package/out/concepts/ViewComponent__.d.ts +7 -0
  70. package/out/concepts/ViewComponent__.js +7 -0
  71. package/out/concepts/ViewComponent__.js.map +1 -1
  72. package/out/concepts/ViewElement__.js +1 -1
  73. package/out/concepts/ViewElement__.js.map +1 -1
  74. package/out/concepts/basics/stdlib/nasl.collection.js +2 -2
  75. package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
  76. package/out/concepts/basics/stdlib/nasl.core.js +3 -3
  77. package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
  78. package/out/concepts/basics/stdlib/nasl.interface.js +1 -1
  79. package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
  80. package/out/concepts/basics/stdlib/nasl.process.js +6 -6
  81. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  82. package/out/concepts/basics/stdlib/nasl.ui.js +43 -43
  83. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  84. package/out/concepts/basics/stdlib/nasl.util.js +19 -46
  85. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  86. package/out/concepts/basics/stdlib/nasl.validation.js +13 -13
  87. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  88. package/out/concepts/basics/types/coreTypeList.js +5 -1
  89. package/out/concepts/basics/types/coreTypeList.js.map +1 -1
  90. package/out/concepts/index__.d.ts +0 -1
  91. package/out/concepts/index__.js +0 -1
  92. package/out/concepts/index__.js.map +1 -1
  93. package/out/generator/genReleaseBody.js +0 -3
  94. package/out/generator/genReleaseBody.js.map +1 -1
  95. package/out/sentry/index.d.ts +28 -0
  96. package/out/sentry/index.js +104 -0
  97. package/out/sentry/index.js.map +1 -0
  98. package/out/server/entity2LogicNamespace.js +1 -1
  99. package/out/server/entity2LogicNamespace.js.map +1 -1
  100. package/out/server/extendBaseNode.js +65 -0
  101. package/out/server/extendBaseNode.js.map +1 -1
  102. package/out/server/formatTsUtils.js +5 -5
  103. package/out/server/formatTsUtils.js.map +1 -1
  104. package/out/server/getLogics.js +9 -7
  105. package/out/server/getLogics.js.map +1 -1
  106. package/out/server/naslServer.d.ts +2 -2
  107. package/out/server/naslServer.js +120 -51
  108. package/out/server/naslServer.js.map +1 -1
  109. package/out/server/translator.js +3 -2
  110. package/out/server/translator.js.map +1 -1
  111. package/out/service/creator/errHandles.js +5 -0
  112. package/out/service/creator/errHandles.js.map +1 -1
  113. package/out/service/storage/init.js +6 -8
  114. package/out/service/storage/init.js.map +1 -1
  115. package/out/templator/genQueryComponent.js +2 -2
  116. package/out/templator/genQueryComponent.js.map +1 -1
  117. package/out/templator/genSelectBlock.js +9 -1
  118. package/out/templator/genSelectBlock.js.map +1 -1
  119. package/out/templator/utils.d.ts +32 -0
  120. package/out/templator/utils.js +7 -7
  121. package/out/templator/utils.js.map +1 -1
  122. package/package.json +2 -2
  123. package/sandbox/stdlib/nasl.auth.ts +3 -1
  124. package/sandbox/stdlib/nasl.browser.ts +1 -1
  125. package/sandbox/stdlib/nasl.collection.ts +9 -9
  126. package/sandbox/stdlib/nasl.core.ts +100 -38
  127. package/sandbox/stdlib/nasl.interface.ts +1 -1
  128. package/sandbox/stdlib/nasl.langUtil.ts +4 -4
  129. package/sandbox/stdlib/nasl.oql.ts +156 -156
  130. package/sandbox/stdlib/nasl.process.ts +6 -6
  131. package/sandbox/stdlib/nasl.ui.ts +42 -42
  132. package/sandbox/stdlib/nasl.util.ts +45 -44
  133. package/sandbox/stdlib/nasl.validation.ts +8 -8
  134. package/src/automate/engine/operators.js +13 -5
  135. package/src/automate/upgrader/2.20.js +1 -0
  136. package/src/common/BaseNode.ts +32 -1
  137. package/src/concepts/Abort__.ts +4 -3
  138. package/src/concepts/App__.ts +2 -38
  139. package/src/concepts/BindAttribute__.ts +17 -1
  140. package/src/concepts/BindEvent__.ts +21 -21
  141. package/src/concepts/CallFunction__.ts +0 -1
  142. package/src/concepts/CallQueryComponent__.ts +16 -74
  143. package/src/concepts/ConfigPropertyValue__.ts +0 -4
  144. package/src/concepts/DataSource__.ts +0 -4
  145. package/src/concepts/EntityProperty__.ts +0 -129
  146. package/src/concepts/InterfaceParam__.ts +0 -55
  147. package/src/concepts/Interface__.ts +4 -4
  148. package/src/concepts/Logic__.ts +31 -47
  149. package/src/concepts/MatchCase__.ts +1 -1
  150. package/src/concepts/MemberExpression__.ts +1 -1
  151. package/src/concepts/Module__.ts +0 -6
  152. package/src/concepts/NewMap__.ts +5 -1
  153. package/src/concepts/NumericLiteral__.ts +9 -4
  154. package/src/concepts/OqlQueryComponent__.ts +0 -40
  155. package/src/concepts/Param__.ts +3 -59
  156. package/src/concepts/Rect__.ts +0 -8
  157. package/src/concepts/Return__.ts +1 -58
  158. package/src/concepts/SqlQueryComponent__.ts +0 -40
  159. package/src/concepts/StructureProperty__.ts +0 -57
  160. package/src/concepts/TypeAnnotation__.ts +12 -72
  161. package/src/concepts/Variable__.ts +1 -58
  162. package/src/concepts/ViewComponent__.ts +6 -0
  163. package/src/concepts/ViewElement__.ts +7 -7
  164. package/src/concepts/basics/stdlib/nasl.collection.ts +2 -2
  165. package/src/concepts/basics/stdlib/nasl.core.ts +3 -3
  166. package/src/concepts/basics/stdlib/nasl.interface.ts +1 -1
  167. package/src/concepts/basics/stdlib/nasl.process.ts +6 -6
  168. package/src/concepts/basics/stdlib/nasl.ui.ts +43 -43
  169. package/src/concepts/basics/stdlib/nasl.util.ts +19 -46
  170. package/src/concepts/basics/stdlib/nasl.validation.ts +13 -13
  171. package/src/concepts/basics/types/coreTypeList.ts +5 -1
  172. package/src/concepts/index__.ts +0 -1
  173. package/src/generator/genReleaseBody.ts +0 -2
  174. package/src/sentry/index.ts +134 -0
  175. package/src/server/entity2LogicNamespace.ts +1 -1
  176. package/src/server/extendBaseNode.ts +61 -1
  177. package/src/server/formatTsUtils.ts +5 -5
  178. package/src/server/getLogics.ts +8 -7
  179. package/src/server/naslServer.ts +120 -53
  180. package/src/server/translator.ts +3 -2
  181. package/src/service/creator/errHandles.js +6 -0
  182. package/src/service/storage/init.ts +6 -8
  183. package/src/templator/genQueryComponent.ts +5 -5
  184. package/src/templator/genSelectBlock.ts +9 -1
  185. package/src/templator/utils.ts +7 -7
  186. package/ts-worker/lib/Messager.js +0 -3
  187. package/ts-worker/src/index.js +0 -1
  188. package/src/concepts/DatabaseTypeAnnotation__.ts +0 -88
@@ -33,6 +33,7 @@ const path = __importStar(require("path"));
33
33
  const worker_threads_1 = require("worker_threads");
34
34
  /// #endif
35
35
  const config_1 = require("../config");
36
+ const sentry_1 = require("../sentry");
36
37
  const Messager_1 = __importDefault(require("../common/Messager"));
37
38
  const getMemberIdentifier_1 = require("../server/getMemberIdentifier");
38
39
  const concepts_1 = require("../concepts");
@@ -56,6 +57,7 @@ const EmbeddedTSFileOffsetMap = {
56
57
  Variable: 12,
57
58
  ConfigProperty: 12,
58
59
  };
60
+ const Messager = (0, sentry_1.sentryMonitorTSWorkerMessager)(Messager_1.default);
59
61
  let isChangeInterface = false; //判断是否导入接口
60
62
  let actionArr = []; //用于导入接口收集更改的节点
61
63
  let timer = null; //超时器用于收集导入接口相关
@@ -123,7 +125,7 @@ class NaslServer {
123
125
  // 单个文件正在change,不允许同时两个文件一起change
124
126
  this.singleFileChangeIng = false;
125
127
  this.diagnosticManager = new diagnostic_1.DiagnosticManager();
126
- this.messager = new Messager_1.default({
128
+ this.messager = new Messager({
127
129
  protocol: 'ts-worker',
128
130
  sender: 'ide',
129
131
  context: this,
@@ -800,24 +802,6 @@ class NaslServer {
800
802
  });
801
803
  }
802
804
  record.semanticDiagnostics = record.semanticDiagnostics
803
- /**
804
- * reduce 为去除重复的 'Duplicate identifier xxxx' 报错
805
- * 原属于 TS@4.x 的 bug,在 TS@5.0-dev 后修复,详见:https://github.com/microsoft/TypeScript/issues/51437
806
- * 触发场景:
807
- * OQL查询中写入SQL语句:'select * from Entity1 ee, Entity1 ee, Entity1 ee, Entity1 ee'
808
- * 翻译出的TS代码中,ee 被成功检查为重复变量,但 ee 报错的数量超过 ee 实际的出现数量,需对同一 token 的报错进行去重
809
- */
810
- .reduce((res, item) => {
811
- const hit = item.text.startsWith('Duplicate identifier') && res.some((r) => (r.text === item.text
812
- && r.start.line === item.start.line
813
- && r.start.offset === item.start.offset
814
- && r.end.line === item.end.line
815
- && r.end.offset === item.end.offset));
816
- if (!hit) {
817
- res.push(item);
818
- }
819
- return res;
820
- }, [])
821
805
  .map((diag) => this._resolveDiagnostic(diag, node, record))
822
806
  .filter((diag) => !!diag);
823
807
  record.semanticDiagnostics.push(...this._attachDiagnostics(node));
@@ -828,7 +812,7 @@ class NaslServer {
828
812
  if (diagnostic?.node) {
829
813
  let currentNode = diagnostic.node;
830
814
  // 数据源警告类型降级
831
- if (currentNode.concept === 'DataSource') {
815
+ if (currentNode.concept === 'DataSource' && diagnostic.originalDiagnostic?.text === 'DataSource connection error') {
832
816
  diagnostic.severity = 'warning';
833
817
  record.suggestionDiagnostics.push(diagnostic);
834
818
  return null;
@@ -1290,24 +1274,38 @@ class NaslServer {
1290
1274
  if ((bindAttr.model || bindAttr.sync) && bindAttr.expression) {
1291
1275
  const bindExpression = bindAttr.expression;
1292
1276
  let diagnostic;
1293
- if (bindExpression.concept !== 'Identifier' && bindExpression.concept !== 'MemberExpression') {
1294
- diagnostic = {
1295
- node: bindAttr,
1296
- severity: 'error',
1297
- message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
1298
- };
1299
- }
1300
- else {
1277
+ if (bindExpression.concept === 'MemberExpression') {
1278
+ let current = bindExpression;
1301
1279
  if (bindExpression.isEnum()) {
1302
1280
  diagnostic = {
1303
- node: bindAttr,
1281
+ node: bindExpression,
1304
1282
  severity: 'error',
1305
1283
  message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
1306
1284
  };
1307
1285
  }
1286
+ else {
1287
+ while (current.object) {
1288
+ if (current.object.concept !== 'MemberExpression' && current.object.concept !== 'Identifier') {
1289
+ diagnostic = {
1290
+ node: bindExpression,
1291
+ severity: 'error',
1292
+ message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
1293
+ };
1294
+ break;
1295
+ }
1296
+ current = current.object;
1297
+ }
1298
+ }
1299
+ }
1300
+ else if (bindExpression.concept !== 'Identifier') {
1301
+ diagnostic = {
1302
+ node: bindExpression,
1303
+ severity: 'error',
1304
+ message: '页面元素双向绑定:只允许绑定可赋值的变量和属性。',
1305
+ };
1308
1306
  }
1309
1307
  if (diagnostic) {
1310
- bindAttr.tsErrorDetail = diagnostic;
1308
+ bindExpression.tsErrorDetail = diagnostic;
1311
1309
  diagnostics.push(diagnostic);
1312
1310
  }
1313
1311
  }
@@ -1600,21 +1598,30 @@ class NaslServer {
1600
1598
  }
1601
1599
  });
1602
1600
  }
1601
+ Object.keys(typeMap).forEach((item) => {
1602
+ if (typeMap[item].length > 1) {
1603
+ typeMap[item].forEach((nodeItem) => {
1604
+ const diagnostic = {
1605
+ node: nodeItem,
1606
+ severity: 'error',
1607
+ message: '匹配:重复添加类型',
1608
+ titleTip: '重复添加此项',
1609
+ };
1610
+ nodeItem.tsErrorDetail = diagnostic;
1611
+ diagnostics.push(diagnostic);
1612
+ });
1613
+ }
1614
+ });
1615
+ }
1616
+ else if (node.expression) {
1617
+ const diagnostic = {
1618
+ node: node.expression,
1619
+ severity: 'error',
1620
+ message: '类型不匹配,传入类型:void',
1621
+ };
1622
+ node.expression.tsErrorDetail = diagnostic;
1623
+ diagnostics.push(diagnostic);
1603
1624
  }
1604
- Object.keys(typeMap).forEach((item) => {
1605
- if (typeMap[item].length > 1) {
1606
- typeMap[item].forEach((nodeItem) => {
1607
- const diagnostic = {
1608
- node: nodeItem,
1609
- severity: 'error',
1610
- message: '匹配:重复添加类型',
1611
- titleTip: '重复添加此项',
1612
- };
1613
- nodeItem.tsErrorDetail = diagnostic;
1614
- diagnostics.push(diagnostic);
1615
- });
1616
- }
1617
- });
1618
1625
  }
1619
1626
  if (node instanceof concepts_1.MatchCase && node.getAncestor('Match')?.isExpression && node.body.length === 0) {
1620
1627
  // 如果不是其他就标红
@@ -1749,8 +1756,10 @@ class NaslServer {
1749
1756
  if (!(node.right.tsErrorDetail) && leftType.sortedTypeKey !== rightType.sortedTypeKey) {
1750
1757
  const excludeList = [
1751
1758
  'nasl.collection.List<nasl.core.String>',
1759
+ 'nasl.collection.List<nasl.core.Text>',
1752
1760
  'nasl.collection.List<nasl.core.Email>',
1753
1761
  'nasl.collection.Map<nasl.core.String, nasl.core.String>',
1762
+ 'nasl.collection.Map<nasl.core.String, nasl.core.Text>',
1754
1763
  'nasl.collection.Map<nasl.core.String, nasl.core.Email>',
1755
1764
  ];
1756
1765
  const excludeList2 = [
@@ -2085,6 +2094,31 @@ class NaslServer {
2085
2094
  });
2086
2095
  }
2087
2096
  }
2097
+ if ((node instanceof concepts_1.Param || node instanceof concepts_1.Return) && node.parentNode instanceof concepts_1.Process) {
2098
+ const { currentSource } = this.getCurrentSource(node.parentNode);
2099
+ if (currentSource) {
2100
+ const code = currentSource.code;
2101
+ const prefix = '__ProcessIdentification__';
2102
+ const positions = [];
2103
+ let pos = code.indexOf(prefix);
2104
+ while (pos !== -1) {
2105
+ pos = code.indexOf(node.name, pos + prefix.length);
2106
+ positions.push(pos);
2107
+ pos = code.indexOf(prefix, pos + prefix.length);
2108
+ }
2109
+ positions.shift();
2110
+ // 拿到标识下定义的参数名字
2111
+ const promises = positions.map((item) => this.references({
2112
+ file: fileNode.getEmbeddedFilePath(),
2113
+ line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
2114
+ offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character + item),
2115
+ }));
2116
+ const results = await Promise.all(promises);
2117
+ results.forEach((constRefs) => {
2118
+ refsList = [...refsList, ...constRefs.refs];
2119
+ });
2120
+ }
2121
+ }
2088
2122
  if (node instanceof concepts_1.ProcessElement) {
2089
2123
  if (currentSource) {
2090
2124
  const code = currentSource.code;
@@ -2108,6 +2142,34 @@ class NaslServer {
2108
2142
  });
2109
2143
  }
2110
2144
  }
2145
+ if (node instanceof concepts_1.Return && node.parentNode instanceof concepts_1.ProcessElement) {
2146
+ const { currentSource } = this.getCurrentSource(node.parentNode);
2147
+ if (currentSource) {
2148
+ const code = currentSource.code;
2149
+ const prefix = '__ProcessIdentification__';
2150
+ const positions = [];
2151
+ let pos = code.indexOf(prefix);
2152
+ // 需要再次定位到processelement对象上,避免process上存在同名参数
2153
+ pos = code.indexOf(node.parentNode.name, pos + prefix.length);
2154
+ while (pos !== -1) {
2155
+ pos = code.indexOf(node.name, pos + prefix.length);
2156
+ positions.push(pos);
2157
+ pos = code.indexOf(prefix, pos + prefix.length);
2158
+ // 需要再次定位到processelement对象上,避免process上存在同名参数
2159
+ pos = code.indexOf(node.parentNode.name, pos + node.parentNode.name.length);
2160
+ }
2161
+ // 拿到标识下定义的参数名字
2162
+ const promises = positions.map((item) => this.references({
2163
+ file: fileNode.getEmbeddedFilePath(),
2164
+ line: (0, translator_1.lsp2tspNumber)(currentSource.range.start.line),
2165
+ offset: (0, translator_1.lsp2tspNumber)(currentSource.range.start.character + item),
2166
+ }));
2167
+ const results = await Promise.all(promises);
2168
+ results.forEach((constRefs) => {
2169
+ refsList = [...refsList, ...constRefs.refs];
2170
+ });
2171
+ }
2172
+ }
2111
2173
  // console.log(refsList, 'refsList');
2112
2174
  return refsList;
2113
2175
  }
@@ -2910,7 +2972,7 @@ class NaslServer {
2910
2972
  if (node instanceof concepts_1.Param) {
2911
2973
  // index在nasl foreach上有脏数据
2912
2974
  if (node.parentKey === 'index' && node.parentNode instanceof concepts_1.ForEachStatement) {
2913
- return concepts_1.TypeAnnotation.createPrimitive('Long');
2975
+ return concepts_1.TypeAnnotation.createPrimitive('Integer');
2914
2976
  }
2915
2977
  }
2916
2978
  if (node instanceof concepts_1.CallQueryComponent || node instanceof concepts_1.SqlQueryComponent || node instanceof concepts_1.OqlQueryComponent) {
@@ -2964,6 +3026,11 @@ class NaslServer {
2964
3026
  types.set(node, node.typeAnnotation);
2965
3027
  return;
2966
3028
  }
3029
+ // 如果 入参不是虚拟节点的,就不去请求类型
3030
+ // 只有虚拟节点的入参,才没有类型
3031
+ if (node.concept === 'Param' && node.parentKey !== 'virtualParams') {
3032
+ return;
3033
+ }
2967
3034
  if (![
2968
3035
  'Identifier',
2969
3036
  'UnaryExpression',
@@ -2981,6 +3048,7 @@ class NaslServer {
2981
3048
  'OqlQueryComponent',
2982
3049
  'QueryFieldExpression',
2983
3050
  'QueryGroupByExpression',
3051
+ 'Param',
2984
3052
  ].includes(node.concept))
2985
3053
  return;
2986
3054
  // 要去ls那边获取的
@@ -2990,6 +3058,7 @@ class NaslServer {
2990
3058
  line: (0, translator_1.lsp2tspNumber)(item.range.start.line),
2991
3059
  offset: (0, translator_1.lsp2tspNumber)(item.range.start.character),
2992
3060
  };
3061
+ // 位置计算偏移
2993
3062
  if (node.concept === 'BinaryExpression'
2994
3063
  || node.concept === 'CallLogic'
2995
3064
  || node.concept === 'CallFunction'
@@ -3063,8 +3132,8 @@ class NaslServer {
3063
3132
  // console.log('原始:', displayString);
3064
3133
  // console.log('方案2:', item?.[0]?.nodeType);
3065
3134
  const nodeTypeAnnotation = (0, formatTsUtils_1.type2TypeAnnotation)(item?.[0]?.nodeType);
3066
- console.log(newQuickInfoNodes[index].node, nodeTypeAnnotation, nodeTypeAnnotation?.typeKey);
3067
- types.set(newQuickInfoNodes[index].node, nodeTypeAnnotation);
3135
+ // console.log(newQuickInfoNodes[index].node, nodeTypeAnnotation, nodeTypeAnnotation?.typeKey);
3136
+ types.set(newQuickInfoNodes[index].node, Object.freeze(nodeTypeAnnotation));
3068
3137
  newQuickInfoNodes[index].node.__nodeType = Object.freeze(item?.[0]?.nodeType);
3069
3138
  // console.log('方案1:', displayString1);
3070
3139
  });
@@ -3110,10 +3179,10 @@ class NaslServer {
3110
3179
  }
3111
3180
  }
3112
3181
  if (value instanceof concepts_1.TypeAnnotation) {
3113
- node.__TypeAnnotation = Object.freeze(value);
3182
+ node.__TypeAnnotation = value;
3114
3183
  }
3115
3184
  else if (value.typeAnnotation) {
3116
- node.__TypeAnnotation = Object.freeze(value.typeAnnotation);
3185
+ node.__TypeAnnotation = value.typeAnnotation;
3117
3186
  }
3118
3187
  }
3119
3188
  else {
@@ -3280,7 +3349,7 @@ class NaslServer {
3280
3349
  concept: 'TypeAnnotation',
3281
3350
  typeKind: 'primitive',
3282
3351
  typeNamespace: 'nasl.core',
3283
- typeName: 'Long',
3352
+ typeName: 'Integer',
3284
3353
  typeArguments: null,
3285
3354
  inferred: null,
3286
3355
  },
@@ -3294,7 +3363,7 @@ class NaslServer {
3294
3363
  // index在nasl foreach上有脏数据
3295
3364
  if (node.parentKey === 'index' && node.parentNode instanceof concepts_1.ForEachStatement) {
3296
3365
  const jsonNode = jsoner.queryNodeByPath(json, node.getNodePath(false));
3297
- jsonNode.typeAnnotation = concepts_1.TypeAnnotation.createPrimitive('Long').toJSON();
3366
+ jsonNode.typeAnnotation = concepts_1.TypeAnnotation.createPrimitive('Integer').toJSON();
3298
3367
  }
3299
3368
  }
3300
3369
  if (node instanceof concepts_1.Match) {