@abaplint/cli 2.115.1 → 2.115.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 (2) hide show
  1. package/build/cli.js +158 -16
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -32881,13 +32881,18 @@ class InsertInternal {
32881
32881
  }
32882
32882
  }
32883
32883
  if (node.findDirectTokenByText("INITIAL") === undefined) {
32884
- if (new _type_utils_1.TypeUtils(input.scope).isAssignableStrict(sourceType, targetType) === false) {
32885
- const message = "Types not compatible";
32886
- input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32887
- return;
32884
+ let error = false;
32885
+ if (sourceType instanceof basic_1.IntegerType && targetType instanceof basic_1.Integer8Type) {
32886
+ error = true;
32887
+ }
32888
+ else if (new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType, targetType) === false) {
32889
+ error = true;
32888
32890
  }
32889
32891
  else if (sourceType instanceof basic_1.CharacterType && targetType instanceof basic_1.StringType) {
32890
32892
  // yea, well, INSERT doesnt convert the values automatically, like everything else?
32893
+ error = true;
32894
+ }
32895
+ if (error === true) {
32891
32896
  const message = "Types not compatible";
32892
32897
  input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
32893
32898
  return;
@@ -52125,7 +52130,10 @@ exports.Program = Program;
52125
52130
 
52126
52131
  Object.defineProperty(exports, "__esModule", ({ value: true }));
52127
52132
  exports.ProxyObject = void 0;
52133
+ const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
52128
52134
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
52135
+ const interface_1 = __webpack_require__(/*! ./interface */ "./node_modules/@abaplint/core/build/src/objects/interface.js");
52136
+ const memory_file_1 = __webpack_require__(/*! ../files/memory_file */ "./node_modules/@abaplint/core/build/src/files/memory_file.js");
52129
52137
  class ProxyObject extends _abstract_object_1.AbstractObject {
52130
52138
  getType() {
52131
52139
  return "SPRX";
@@ -52137,8 +52145,83 @@ class ProxyObject extends _abstract_object_1.AbstractObject {
52137
52145
  };
52138
52146
  }
52139
52147
  getDescription() {
52140
- // todo
52141
- return undefined;
52148
+ var _a;
52149
+ this.parse();
52150
+ const intfItem = (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.proxyData.find(i => i.R3_TYPE === "INTF");
52151
+ return intfItem === null || intfItem === void 0 ? void 0 : intfItem.R3_TEXT;
52152
+ }
52153
+ setDirty() {
52154
+ this.parsedXML = undefined;
52155
+ super.setDirty();
52156
+ }
52157
+ parse(_version, _globalMacros, reg) {
52158
+ if (this.parsedXML) {
52159
+ return { updated: false, runtime: 0 };
52160
+ }
52161
+ const start = Date.now();
52162
+ this.parsedXML = this.parseXML();
52163
+ const end = Date.now();
52164
+ const objects = this.generateABAPObjects();
52165
+ for (const obj of objects) {
52166
+ reg === null || reg === void 0 ? void 0 : reg.addDependencies(obj.getFiles());
52167
+ }
52168
+ return { updated: true, runtime: end - start };
52169
+ }
52170
+ parseXML() {
52171
+ var _a, _b;
52172
+ const result = { proxyData: [] };
52173
+ const parsed = super.parseRaw2();
52174
+ if (parsed === undefined
52175
+ || parsed.abapGit === undefined
52176
+ || ((_a = parsed.abapGit["asx:abap"]) === null || _a === void 0 ? void 0 : _a["asx:values"]) === undefined) {
52177
+ return result;
52178
+ }
52179
+ const values = parsed.abapGit["asx:abap"]["asx:values"];
52180
+ result.proxyData = (0, xml_utils_1.xmlToArray)((_b = values.PROXY_DATA) === null || _b === void 0 ? void 0 : _b.item);
52181
+ return result;
52182
+ }
52183
+ generateABAPObjects() {
52184
+ var _a, _b, _c;
52185
+ this.parse();
52186
+ const result = [];
52187
+ if (!this.parsedXML) {
52188
+ return result;
52189
+ }
52190
+ // Find interface definition
52191
+ const intfItem = this.parsedXML.proxyData.find(i => i.R3_TYPE === "INTF");
52192
+ if (!intfItem || !intfItem.R3_NAME) {
52193
+ return result;
52194
+ }
52195
+ const intfName = intfItem.R3_NAME.toLowerCase();
52196
+ // Find methods
52197
+ const methods = this.parsedXML.proxyData.filter(i => i.R3_TYPE === "METH");
52198
+ // Build interface code
52199
+ let code = `INTERFACE ${intfName} PUBLIC.\n`;
52200
+ for (const method of methods) {
52201
+ const methodName = (_a = method.R3_NAME) === null || _a === void 0 ? void 0 : _a.toLowerCase();
52202
+ if (!methodName) {
52203
+ continue;
52204
+ }
52205
+ // Find parameters for this method
52206
+ const params = this.parsedXML.proxyData.filter(i => i.R3_TYPE === "PAIM" && i.OBJ_NAME1 === method.OBJ_NAME1);
52207
+ code += ` METHODS ${methodName}\n`;
52208
+ if (params.length > 0) {
52209
+ code += ` IMPORTING\n`;
52210
+ for (let i = 0; i < params.length; i++) {
52211
+ const param = params[i];
52212
+ const paramName = (_b = param.OBJ_NAME2) === null || _b === void 0 ? void 0 : _b.toLowerCase();
52213
+ const paramType = (_c = param.OBJ_NAME_R) === null || _c === void 0 ? void 0 : _c.toLowerCase();
52214
+ const isLast = i === params.length - 1;
52215
+ code += ` ${paramName} TYPE ${paramType}${isLast ? "." : ""}\n`;
52216
+ }
52217
+ }
52218
+ }
52219
+ code += `ENDINTERFACE.`;
52220
+ // Create the interface object
52221
+ const intf = new interface_1.Interface(intfName.toUpperCase());
52222
+ intf.addFile(new memory_file_1.MemoryFile(`${intfName}.intf.abap`, code));
52223
+ result.push(intf);
52224
+ return result;
52142
52225
  }
52143
52226
  }
52144
52227
  exports.ProxyObject = ProxyObject;
@@ -52421,14 +52504,39 @@ class RenameICFService {
52421
52504
  this.reg = reg;
52422
52505
  }
52423
52506
  buildEdits(obj, oldName, newName) {
52507
+ var _a, _b, _c, _d;
52424
52508
  if (!(obj instanceof __1.ICFService)) {
52425
52509
  throw new Error("RenameICFService, not a ICF Service");
52426
52510
  }
52511
+ // Preserve GUID suffix from the stored object/file name for the filename rename
52512
+ // SICF files follow pattern: servicename.sicf or servicename {GUID}.sicf
52513
+ const fileNewName = (() => {
52514
+ // Look for pattern: space + GUID (32 hex chars in braces) + optional extension
52515
+ const guidPattern = / \{[0-9A-Fa-f]{16,32}\}/;
52516
+ const match = oldName.match(guidPattern);
52517
+ if (match) {
52518
+ // Extract everything from the GUID onwards (includes .sicf extension if present)
52519
+ const guidIndex = match.index;
52520
+ const suffix = oldName.substring(guidIndex);
52521
+ // Only append suffix if newName doesn't already contain it
52522
+ return newName.includes(suffix) ? newName : newName + suffix;
52523
+ }
52524
+ // Fallback: preserve any suffix after first space (legacy behavior)
52525
+ const space = oldName.indexOf(" ");
52526
+ if (space > -1) {
52527
+ const suffix = oldName.substring(space);
52528
+ return newName.includes(suffix) ? newName : newName + suffix;
52529
+ }
52530
+ return newName;
52531
+ })();
52532
+ const cleanOldName = (_b = (_a = oldName.match(/^[^ ]+/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : oldName;
52533
+ const cleanNewName = (_d = (_c = newName.match(/^[^ ]+/)) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : newName;
52427
52534
  let changes = [];
52428
52535
  const helper = new renamer_helper_1.RenamerHelper(this.reg);
52429
- changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME", oldName, newName));
52430
- changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", oldName, newName));
52431
- changes = changes.concat(helper.renameFiles(obj, oldName, newName));
52536
+ changes = changes.concat(helper.buildURLFileEdits(obj, cleanOldName, cleanNewName));
52537
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME", cleanOldName, cleanNewName));
52538
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", cleanOldName, cleanNewName, true));
52539
+ changes = changes.concat(helper.renameFiles(obj, oldName, fileNewName));
52432
52540
  return {
52433
52541
  documentChanges: changes,
52434
52542
  };
@@ -52605,7 +52713,10 @@ class Renamer {
52605
52713
  /** Builds edits, but does not apply to registry, used by LSP */
52606
52714
  buildEdits(type, oldName, newName) {
52607
52715
  this.reg.parse(); // the registry must be parsed to dermine references
52608
- const obj = this.reg.getObject(type, oldName);
52716
+ let obj = this.reg.getObject(type, oldName);
52717
+ if (obj === undefined && type === "SICF") {
52718
+ obj = Array.from(this.reg.getObjects()).find(o => o.getType() === "SICF" && o.getName().toUpperCase().startsWith(oldName.toUpperCase() + " "));
52719
+ }
52609
52720
  if (obj === undefined) {
52610
52721
  throw new Error("rename, object not found");
52611
52722
  }
@@ -52813,21 +52924,51 @@ class RenamerHelper {
52813
52924
  }
52814
52925
  return changes;
52815
52926
  }
52816
- buildXMLFileEdits(object, xmlTag, oldName, newName) {
52927
+ buildXMLFileEdits(object, xmlTag, oldName, newName, useLowerCase = false) {
52817
52928
  const changes = [];
52818
52929
  const xml = object.getXMLFile();
52819
52930
  if (xml === undefined) {
52820
52931
  return [];
52821
52932
  }
52933
+ const originalValue = useLowerCase ? oldName.toLowerCase() : oldName.toUpperCase();
52934
+ const replacementValue = useLowerCase ? newName.toLowerCase() : newName.toUpperCase();
52822
52935
  const tag = xmlTag.toUpperCase();
52823
- const search = "<" + tag + ">" + oldName.toUpperCase() + "</" + tag + ">";
52936
+ const search = "<" + tag + ">" + originalValue + "</" + tag + ">";
52824
52937
  const length = tag.length + 2;
52825
52938
  const rows = xml.getRawRows();
52826
52939
  for (let i = 0; i < rows.length; i++) {
52827
52940
  const index = rows[i].indexOf(search);
52828
52941
  if (index >= 0) {
52829
- const range = vscode_languageserver_types_1.Range.create(i, index + length, i, index + oldName.length + length);
52830
- changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, newName.toUpperCase())]));
52942
+ const range = vscode_languageserver_types_1.Range.create(i, index + length, i, index + originalValue.length + length);
52943
+ changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, replacementValue)]));
52944
+ }
52945
+ }
52946
+ return changes;
52947
+ }
52948
+ buildURLFileEdits(object, oldName, newName) {
52949
+ const changes = [];
52950
+ const xml = object.getXMLFile();
52951
+ if (xml === undefined) {
52952
+ return [];
52953
+ }
52954
+ const oldNameLower = oldName.toLowerCase();
52955
+ const newNameLower = newName.toLowerCase();
52956
+ const rows = xml.getRawRows();
52957
+ for (let i = 0; i < rows.length; i++) {
52958
+ const row = rows[i];
52959
+ const urlTagStart = row.indexOf("<URL>");
52960
+ if (urlTagStart === -1) {
52961
+ continue;
52962
+ }
52963
+ const urlTagEnd = row.indexOf("</URL>");
52964
+ if (urlTagEnd === -1) {
52965
+ continue;
52966
+ }
52967
+ const urlContent = row.substring(urlTagStart + 5, urlTagEnd);
52968
+ const updatedUrl = urlContent.replace(oldNameLower, newNameLower);
52969
+ if (updatedUrl !== urlContent) {
52970
+ const range = vscode_languageserver_types_1.Range.create(i, urlTagStart + 5, i, urlTagEnd);
52971
+ changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, updatedUrl)]));
52831
52972
  }
52832
52973
  }
52833
52974
  return changes;
@@ -55074,7 +55215,7 @@ class Registry {
55074
55215
  }
55075
55216
  static abaplintVersion() {
55076
55217
  // magic, see build script "version.sh"
55077
- return "2.115.1";
55218
+ return "2.115.3";
55078
55219
  }
55079
55220
  getDDICReferences() {
55080
55221
  return this.ddicReferences;
@@ -65569,7 +65710,8 @@ lv_value = 5.`,
65569
65710
  const source = (_a = statement.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
65570
65711
  const target = (_b = statement.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
65571
65712
  if (source === target && source !== undefined) {
65572
- issues.push(issue_1.Issue.atStatement(file, statement, "Comment between methods in global class implementation", this.getMetadata().key, this.conf.severity));
65713
+ const message = `Identical MOVE from "${source}" to "${target}"`;
65714
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
65573
65715
  }
65574
65716
  }
65575
65717
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.115.1",
3
+ "version": "2.115.3",
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.115.1",
41
+ "@abaplint/core": "^2.115.3",
42
42
  "@types/chai": "^4.3.20",
43
43
  "@types/minimist": "^1.2.5",
44
44
  "@types/mocha": "^10.0.10",
@@ -47,7 +47,7 @@
47
47
  "chai": "^4.5.0",
48
48
  "p-limit": "^3.1.0",
49
49
  "chalk": "^5.6.2",
50
- "eslint": "^9.39.1",
50
+ "eslint": "^9.39.2",
51
51
  "glob": "^11.0.3",
52
52
  "json5": "^2.2.3",
53
53
  "memfs": "^4.51.1",