@abaplint/cli 2.101.12 → 2.101.14

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 (2) hide show
  1. package/build/cli.js +127 -22
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -25529,27 +25529,36 @@ class Source {
25529
25529
  {
25530
25530
  const foundType = this.determineType(node, scope, filename, targetType);
25531
25531
  const bodyType = new reduce_body_1.ReduceBody().runSyntax(node.findDirectExpression(Expressions.ReduceBody), scope, filename, foundType);
25532
- if (foundType === undefined || foundType.isGeneric() === true) {
25532
+ if (foundType === undefined || foundType.isGeneric()) {
25533
25533
  this.addIfInferred(node, scope, filename, bodyType);
25534
25534
  }
25535
+ else {
25536
+ this.addIfInferred(node, scope, filename, foundType);
25537
+ }
25535
25538
  return foundType ? foundType : bodyType;
25536
25539
  }
25537
25540
  case "SWITCH":
25538
25541
  {
25539
25542
  const foundType = this.determineType(node, scope, filename, targetType);
25540
25543
  const bodyType = new switch_body_1.SwitchBody().runSyntax(node.findDirectExpression(Expressions.SwitchBody), scope, filename);
25541
- if (foundType === undefined || foundType.isGeneric() === true) {
25544
+ if (foundType === undefined || foundType.isGeneric()) {
25542
25545
  this.addIfInferred(node, scope, filename, bodyType);
25543
25546
  }
25547
+ else {
25548
+ this.addIfInferred(node, scope, filename, foundType);
25549
+ }
25544
25550
  return foundType ? foundType : bodyType;
25545
25551
  }
25546
25552
  case "COND":
25547
25553
  {
25548
25554
  const foundType = this.determineType(node, scope, filename, targetType);
25549
25555
  const bodyType = new cond_body_1.CondBody().runSyntax(node.findDirectExpression(Expressions.CondBody), scope, filename);
25550
- if (foundType === undefined || foundType.isGeneric() === true) {
25556
+ if (foundType === undefined || foundType.isGeneric()) {
25551
25557
  this.addIfInferred(node, scope, filename, bodyType);
25552
25558
  }
25559
+ else {
25560
+ this.addIfInferred(node, scope, filename, foundType);
25561
+ }
25553
25562
  return foundType ? foundType : bodyType;
25554
25563
  }
25555
25564
  case "CONV":
@@ -25590,7 +25599,9 @@ class Source {
25590
25599
  case "CORRESPONDING":
25591
25600
  {
25592
25601
  const foundType = this.determineType(node, scope, filename, targetType);
25593
- return new corresponding_body_1.CorrespondingBody().runSyntax(node.findDirectExpression(Expressions.CorrespondingBody), scope, filename, foundType);
25602
+ new corresponding_body_1.CorrespondingBody().runSyntax(node.findDirectExpression(Expressions.CorrespondingBody), scope, filename, foundType);
25603
+ this.addIfInferred(node, scope, filename, foundType);
25604
+ return foundType;
25594
25605
  }
25595
25606
  case "EXACT":
25596
25607
  return this.determineType(node, scope, filename, targetType);
@@ -25686,10 +25697,12 @@ class Source {
25686
25697
  throw new Error("determineType, child TypeNameOrInfer not found");
25687
25698
  }
25688
25699
  else if (typeName === "#" && targetType) {
25689
- const found = basic.lookupQualifiedName(targetType.getQualifiedName());
25700
+ // const found = basic.lookupQualifiedName(targetType.getQualifiedName());
25701
+ /*
25690
25702
  if (found) {
25691
- scope.addReference(typeToken, found, _reference_1.ReferenceType.InferredType, filename);
25703
+ scope.addReference(typeToken, found, ReferenceType.InferredType, filename);
25692
25704
  }
25705
+ */
25693
25706
  return targetType;
25694
25707
  }
25695
25708
  if (typeName !== "#" && typeToken) {
@@ -26359,6 +26372,7 @@ class ValueBody {
26359
26372
  }
26360
26373
  for (const l of foo.findDirectExpressions(Expressions.ValueBodyLines)) {
26361
26374
  for (const s of l.findDirectExpressions(Expressions.Source)) {
26375
+ // LINES OF ?? todo, pass type,
26362
26376
  new source_1.Source().runSyntax(s, scope, filename);
26363
26377
  }
26364
26378
  }
@@ -26366,7 +26380,7 @@ class ValueBody {
26366
26380
  new field_assignment_1.FieldAssignment().runSyntax(s, scope, filename, rowType);
26367
26381
  }
26368
26382
  for (const s of foo.findDirectExpressions(Expressions.Source)) {
26369
- new source_1.Source().runSyntax(s, scope, filename);
26383
+ new source_1.Source().runSyntax(s, scope, filename, rowType);
26370
26384
  }
26371
26385
  }
26372
26386
  if (letScoped === true) {
@@ -29110,9 +29124,9 @@ class InsertInternal {
29110
29124
  }
29111
29125
  }
29112
29126
  for (const s of node.findDirectExpressions(Expressions.Source)) {
29113
- new source_1.Source().runSyntax(s, scope, filename, targetType);
29114
- }
29115
- for (const s of node.findDirectExpressions(Expressions.SimpleSource4)) {
29127
+ if (s === source) {
29128
+ continue;
29129
+ }
29116
29130
  new source_1.Source().runSyntax(s, scope, filename, targetType);
29117
29131
  }
29118
29132
  }
@@ -40007,6 +40021,9 @@ class LSPUtils {
40007
40021
  static tokenToRange(token) {
40008
40022
  return LServer.Range.create(token.getStart().getRow() - 1, token.getStart().getCol() - 1, token.getEnd().getRow() - 1, token.getEnd().getCol() - 1);
40009
40023
  }
40024
+ static positionToLS(pos) {
40025
+ return LServer.Position.create(pos.getRow() - 1, pos.getCol() - 1);
40026
+ }
40010
40027
  static identiferToLocation(identifier) {
40011
40028
  return {
40012
40029
  uri: identifier.getFilename(),
@@ -40166,7 +40183,7 @@ class CodeLens {
40166
40183
  constructor(reg) {
40167
40184
  this.reg = reg;
40168
40185
  }
40169
- list(textDocument) {
40186
+ list(textDocument, settings = { messageText: true }) {
40170
40187
  var _a;
40171
40188
  const file = _lsp_utils_1.LSPUtils.getABAPFile(this.reg, textDocument.uri);
40172
40189
  if (file === undefined) {
@@ -40178,14 +40195,22 @@ class CodeLens {
40178
40195
  }
40179
40196
  new syntax_1.SyntaxLogic(this.reg, obj).run();
40180
40197
  const ret = [];
40181
- const list = this.reg.getMSAGReferences().listByFilename(file.getFilename());
40182
- for (const l of list) {
40183
- const msag = this.reg.getObject("MSAG", l.messageClass);
40184
- if (msag === undefined) {
40185
- continue;
40198
+ if (settings.messageText === true) {
40199
+ const list = this.reg.getMSAGReferences().listByFilename(file.getFilename());
40200
+ for (const l of list) {
40201
+ const msag = this.reg.getObject("MSAG", l.messageClass);
40202
+ if (msag === undefined) {
40203
+ continue;
40204
+ }
40205
+ const text = (_a = msag.getByNumber(l.number)) === null || _a === void 0 ? void 0 : _a.getMessage();
40206
+ if (text === undefined) {
40207
+ continue;
40208
+ }
40209
+ ret.push({
40210
+ range: _lsp_utils_1.LSPUtils.tokenToRange(l.token),
40211
+ command: LServer.Command.create(text, ""),
40212
+ });
40186
40213
  }
40187
- const text = (_a = msag.getByNumber(l.number)) === null || _a === void 0 ? void 0 : _a.getMessage();
40188
- ret.push(LServer.CodeLens.create(_lsp_utils_1.LSPUtils.tokenToRange(l.token), text));
40189
40214
  }
40190
40215
  return ret;
40191
40216
  }
@@ -40867,6 +40892,81 @@ exports.Implementation = Implementation;
40867
40892
 
40868
40893
  /***/ }),
40869
40894
 
40895
+ /***/ "./node_modules/@abaplint/core/build/src/lsp/inlay_hints.js":
40896
+ /*!******************************************************************!*\
40897
+ !*** ./node_modules/@abaplint/core/build/src/lsp/inlay_hints.js ***!
40898
+ \******************************************************************/
40899
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
40900
+
40901
+ "use strict";
40902
+
40903
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
40904
+ exports.InlayHints = void 0;
40905
+ const LServer = __webpack_require__(/*! vscode-languageserver-types */ "./node_modules/vscode-languageserver-types/lib/esm/main.js");
40906
+ const _lsp_utils_1 = __webpack_require__(/*! ./_lsp_utils */ "./node_modules/@abaplint/core/build/src/lsp/_lsp_utils.js");
40907
+ const syntax_1 = __webpack_require__(/*! ../abap/5_syntax/syntax */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/syntax.js");
40908
+ const _abap_object_1 = __webpack_require__(/*! ../objects/_abap_object */ "./node_modules/@abaplint/core/build/src/objects/_abap_object.js");
40909
+ const _reference_1 = __webpack_require__(/*! ../abap/5_syntax/_reference */ "./node_modules/@abaplint/core/build/src/abap/5_syntax/_reference.js");
40910
+ const _typed_identifier_1 = __webpack_require__(/*! ../abap/types/_typed_identifier */ "./node_modules/@abaplint/core/build/src/abap/types/_typed_identifier.js");
40911
+ const types_1 = __webpack_require__(/*! ../abap/types */ "./node_modules/@abaplint/core/build/src/abap/types/index.js");
40912
+ class InlayHints {
40913
+ constructor(reg) {
40914
+ this.reg = reg;
40915
+ }
40916
+ list(textDocument, settings = { inferredTypes: true }) {
40917
+ const file = _lsp_utils_1.LSPUtils.getABAPFile(this.reg, textDocument.uri);
40918
+ if (file === undefined) {
40919
+ return [];
40920
+ }
40921
+ const obj = this.reg.findObjectForFile(file);
40922
+ if (obj === undefined || !(obj instanceof _abap_object_1.ABAPObject)) {
40923
+ return [];
40924
+ }
40925
+ const top = new syntax_1.SyntaxLogic(this.reg, obj).run().spaghetti.getTop();
40926
+ const ret = [];
40927
+ if (settings.inferredTypes === true) {
40928
+ const implicit = this.findImplicitReferences(top);
40929
+ for (const i of implicit) {
40930
+ let label = undefined;
40931
+ if (i.resolved instanceof _typed_identifier_1.TypedIdentifier) {
40932
+ label = "TYPE " + i.resolved.getType().toABAP();
40933
+ }
40934
+ else if (i.resolved instanceof types_1.ClassDefinition) {
40935
+ label = "TYPE REF TO " + i.resolved.getName();
40936
+ }
40937
+ if (label === undefined) {
40938
+ continue;
40939
+ }
40940
+ ret.push({
40941
+ label: label,
40942
+ tooltip: "Inferred type",
40943
+ kind: LServer.InlayHintKind.Type,
40944
+ paddingLeft: true,
40945
+ paddingRight: true,
40946
+ position: _lsp_utils_1.LSPUtils.positionToLS(i.position.getEnd()),
40947
+ });
40948
+ }
40949
+ }
40950
+ return ret;
40951
+ }
40952
+ findImplicitReferences(node) {
40953
+ const ret = [];
40954
+ for (const r of node.getData().references) {
40955
+ if (r.referenceType === _reference_1.ReferenceType.InferredType) {
40956
+ ret.push(r);
40957
+ }
40958
+ }
40959
+ for (const c of node.getChildren()) {
40960
+ ret.push(...this.findImplicitReferences(c));
40961
+ }
40962
+ return ret;
40963
+ }
40964
+ }
40965
+ exports.InlayHints = InlayHints;
40966
+ //# sourceMappingURL=inlay_hints.js.map
40967
+
40968
+ /***/ }),
40969
+
40870
40970
  /***/ "./node_modules/@abaplint/core/build/src/lsp/language_server.js":
40871
40971
  /*!**********************************************************************!*\
40872
40972
  !*** ./node_modules/@abaplint/core/build/src/lsp/language_server.js ***!
@@ -40893,6 +40993,7 @@ const implementation_1 = __webpack_require__(/*! ./implementation */ "./node_mod
40893
40993
  const semantic_1 = __webpack_require__(/*! ./semantic */ "./node_modules/@abaplint/core/build/src/lsp/semantic.js");
40894
40994
  const statement_flow_1 = __webpack_require__(/*! ../abap/flow/statement_flow */ "./node_modules/@abaplint/core/build/src/abap/flow/statement_flow.js");
40895
40995
  const code_lens_1 = __webpack_require__(/*! ./code_lens */ "./node_modules/@abaplint/core/build/src/lsp/code_lens.js");
40996
+ const inlay_hints_1 = __webpack_require__(/*! ./inlay_hints */ "./node_modules/@abaplint/core/build/src/lsp/inlay_hints.js");
40896
40997
  // note Ranges are zero based in LSP,
40897
40998
  // https://github.com/microsoft/language-server-protocol/blob/main/versions/protocol-2-x.md#range
40898
40999
  // but 1 based in abaplint
@@ -40974,8 +41075,12 @@ class LanguageServer {
40974
41075
  return new semantic_1.SemanticHighlighting(this.reg).semanticTokensRange(range);
40975
41076
  }
40976
41077
  // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeLens
40977
- codeLens(textDocument) {
40978
- return new code_lens_1.CodeLens(this.reg).list(textDocument);
41078
+ codeLens(textDocument, settings) {
41079
+ return new code_lens_1.CodeLens(this.reg).list(textDocument, settings);
41080
+ }
41081
+ // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_inlayHint
41082
+ inlayHints(textDocument, settings) {
41083
+ return new inlay_hints_1.InlayHints(this.reg).list(textDocument, settings);
40979
41084
  }
40980
41085
  ////////////////////////////////////////
40981
41086
  // ______ _
@@ -48184,7 +48289,7 @@ class Registry {
48184
48289
  }
48185
48290
  static abaplintVersion() {
48186
48291
  // magic, see build script "version.sh"
48187
- return "2.101.12";
48292
+ return "2.101.14";
48188
48293
  }
48189
48294
  getDDICReferences() {
48190
48295
  return this.ddicReferences;
@@ -70813,7 +70918,7 @@ function isNotation(xmlData, i){
70813
70918
 
70814
70919
  //an entity name should not contains special characters that may be used in regex
70815
70920
  //Eg !?\\\/[]$%{}^&*()<>
70816
- const specialChar = "!?\\\/[]$%{}^&*()<>";
70921
+ const specialChar = "!?\\\/[]$%{}^&*()<>|+";
70817
70922
 
70818
70923
  function validateEntityName(name){
70819
70924
  for (let i = 0; i < specialChar.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.101.12",
3
+ "version": "2.101.14",
4
4
  "description": "abaplint - Command Line Interface",
5
5
  "funding": "https://github.com/sponsors/larshp",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://abaplint.org",
40
40
  "devDependencies": {
41
- "@abaplint/core": "^2.101.12",
41
+ "@abaplint/core": "^2.101.14",
42
42
  "@types/chai": "^4.3.5",
43
43
  "@types/glob": "^7.2.0",
44
44
  "@types/minimist": "^1.2.2",
@@ -55,7 +55,7 @@
55
55
  "mocha": "^10.2.0",
56
56
  "progress": "^2.0.3",
57
57
  "typescript": "^5.1.3",
58
- "webpack": "^5.85.0",
58
+ "webpack": "^5.85.1",
59
59
  "webpack-cli": "^5.1.3",
60
60
  "xml-js": "^1.6.11"
61
61
  },