@abaplint/cli 2.115.1 → 2.115.2

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 +91 -9
  2. package/package.json +3 -3
package/build/cli.js CHANGED
@@ -52125,7 +52125,10 @@ exports.Program = Program;
52125
52125
 
52126
52126
  Object.defineProperty(exports, "__esModule", ({ value: true }));
52127
52127
  exports.ProxyObject = void 0;
52128
+ const xml_utils_1 = __webpack_require__(/*! ../xml_utils */ "./node_modules/@abaplint/core/build/src/xml_utils.js");
52128
52129
  const _abstract_object_1 = __webpack_require__(/*! ./_abstract_object */ "./node_modules/@abaplint/core/build/src/objects/_abstract_object.js");
52130
+ const interface_1 = __webpack_require__(/*! ./interface */ "./node_modules/@abaplint/core/build/src/objects/interface.js");
52131
+ const memory_file_1 = __webpack_require__(/*! ../files/memory_file */ "./node_modules/@abaplint/core/build/src/files/memory_file.js");
52129
52132
  class ProxyObject extends _abstract_object_1.AbstractObject {
52130
52133
  getType() {
52131
52134
  return "SPRX";
@@ -52137,8 +52140,83 @@ class ProxyObject extends _abstract_object_1.AbstractObject {
52137
52140
  };
52138
52141
  }
52139
52142
  getDescription() {
52140
- // todo
52141
- return undefined;
52143
+ var _a;
52144
+ this.parse();
52145
+ const intfItem = (_a = this.parsedXML) === null || _a === void 0 ? void 0 : _a.proxyData.find(i => i.R3_TYPE === "INTF");
52146
+ return intfItem === null || intfItem === void 0 ? void 0 : intfItem.R3_TEXT;
52147
+ }
52148
+ setDirty() {
52149
+ this.parsedXML = undefined;
52150
+ super.setDirty();
52151
+ }
52152
+ parse(_version, _globalMacros, reg) {
52153
+ if (this.parsedXML) {
52154
+ return { updated: false, runtime: 0 };
52155
+ }
52156
+ const start = Date.now();
52157
+ this.parsedXML = this.parseXML();
52158
+ const end = Date.now();
52159
+ const objects = this.generateABAPObjects();
52160
+ for (const obj of objects) {
52161
+ reg === null || reg === void 0 ? void 0 : reg.addDependencies(obj.getFiles());
52162
+ }
52163
+ return { updated: true, runtime: end - start };
52164
+ }
52165
+ parseXML() {
52166
+ var _a, _b;
52167
+ const result = { proxyData: [] };
52168
+ const parsed = super.parseRaw2();
52169
+ if (parsed === undefined
52170
+ || parsed.abapGit === undefined
52171
+ || ((_a = parsed.abapGit["asx:abap"]) === null || _a === void 0 ? void 0 : _a["asx:values"]) === undefined) {
52172
+ return result;
52173
+ }
52174
+ const values = parsed.abapGit["asx:abap"]["asx:values"];
52175
+ result.proxyData = (0, xml_utils_1.xmlToArray)((_b = values.PROXY_DATA) === null || _b === void 0 ? void 0 : _b.item);
52176
+ return result;
52177
+ }
52178
+ generateABAPObjects() {
52179
+ var _a, _b, _c;
52180
+ this.parse();
52181
+ const result = [];
52182
+ if (!this.parsedXML) {
52183
+ return result;
52184
+ }
52185
+ // Find interface definition
52186
+ const intfItem = this.parsedXML.proxyData.find(i => i.R3_TYPE === "INTF");
52187
+ if (!intfItem || !intfItem.R3_NAME) {
52188
+ return result;
52189
+ }
52190
+ const intfName = intfItem.R3_NAME.toLowerCase();
52191
+ // Find methods
52192
+ const methods = this.parsedXML.proxyData.filter(i => i.R3_TYPE === "METH");
52193
+ // Build interface code
52194
+ let code = `INTERFACE ${intfName} PUBLIC.\n`;
52195
+ for (const method of methods) {
52196
+ const methodName = (_a = method.R3_NAME) === null || _a === void 0 ? void 0 : _a.toLowerCase();
52197
+ if (!methodName) {
52198
+ continue;
52199
+ }
52200
+ // Find parameters for this method
52201
+ const params = this.parsedXML.proxyData.filter(i => i.R3_TYPE === "PAIM" && i.OBJ_NAME1 === method.OBJ_NAME1);
52202
+ code += ` METHODS ${methodName}\n`;
52203
+ if (params.length > 0) {
52204
+ code += ` IMPORTING\n`;
52205
+ for (let i = 0; i < params.length; i++) {
52206
+ const param = params[i];
52207
+ const paramName = (_b = param.OBJ_NAME2) === null || _b === void 0 ? void 0 : _b.toLowerCase();
52208
+ const paramType = (_c = param.OBJ_NAME_R) === null || _c === void 0 ? void 0 : _c.toLowerCase();
52209
+ const isLast = i === params.length - 1;
52210
+ code += ` ${paramName} TYPE ${paramType}${isLast ? "." : ""}\n`;
52211
+ }
52212
+ }
52213
+ }
52214
+ code += `ENDINTERFACE.`;
52215
+ // Create the interface object
52216
+ const intf = new interface_1.Interface(intfName.toUpperCase());
52217
+ intf.addFile(new memory_file_1.MemoryFile(`${intfName}.intf.abap`, code));
52218
+ result.push(intf);
52219
+ return result;
52142
52220
  }
52143
52221
  }
52144
52222
  exports.ProxyObject = ProxyObject;
@@ -52426,8 +52504,9 @@ class RenameICFService {
52426
52504
  }
52427
52505
  let changes = [];
52428
52506
  const helper = new renamer_helper_1.RenamerHelper(this.reg);
52507
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "URL", oldName, newName, true));
52429
52508
  changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME", oldName, newName));
52430
- changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", oldName, newName));
52509
+ changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", oldName, newName, true));
52431
52510
  changes = changes.concat(helper.renameFiles(obj, oldName, newName));
52432
52511
  return {
52433
52512
  documentChanges: changes,
@@ -52813,21 +52892,23 @@ class RenamerHelper {
52813
52892
  }
52814
52893
  return changes;
52815
52894
  }
52816
- buildXMLFileEdits(object, xmlTag, oldName, newName) {
52895
+ buildXMLFileEdits(object, xmlTag, oldName, newName, useLowerCase = false) {
52817
52896
  const changes = [];
52818
52897
  const xml = object.getXMLFile();
52819
52898
  if (xml === undefined) {
52820
52899
  return [];
52821
52900
  }
52901
+ const originalValue = useLowerCase ? oldName.toLowerCase() : oldName.toUpperCase();
52902
+ const replacementValue = useLowerCase ? newName.toLowerCase() : newName.toUpperCase();
52822
52903
  const tag = xmlTag.toUpperCase();
52823
- const search = "<" + tag + ">" + oldName.toUpperCase() + "</" + tag + ">";
52904
+ const search = "<" + tag + ">" + originalValue + "</" + tag + ">";
52824
52905
  const length = tag.length + 2;
52825
52906
  const rows = xml.getRawRows();
52826
52907
  for (let i = 0; i < rows.length; i++) {
52827
52908
  const index = rows[i].indexOf(search);
52828
52909
  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())]));
52910
+ const range = vscode_languageserver_types_1.Range.create(i, index + length, i, index + originalValue.length + length);
52911
+ changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, replacementValue)]));
52831
52912
  }
52832
52913
  }
52833
52914
  return changes;
@@ -55074,7 +55155,7 @@ class Registry {
55074
55155
  }
55075
55156
  static abaplintVersion() {
55076
55157
  // magic, see build script "version.sh"
55077
- return "2.115.1";
55158
+ return "2.115.2";
55078
55159
  }
55079
55160
  getDDICReferences() {
55080
55161
  return this.ddicReferences;
@@ -65569,7 +65650,8 @@ lv_value = 5.`,
65569
65650
  const source = (_a = statement.findDirectExpression(Expressions.Source)) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase();
65570
65651
  const target = (_b = statement.findDirectExpression(Expressions.Target)) === null || _b === void 0 ? void 0 : _b.concatTokens().toUpperCase();
65571
65652
  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));
65653
+ const message = `Identical MOVE from "${source}" to "${target}"`;
65654
+ issues.push(issue_1.Issue.atStatement(file, statement, message, this.getMetadata().key, this.conf.severity));
65573
65655
  }
65574
65656
  }
65575
65657
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.115.1",
3
+ "version": "2.115.2",
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.2",
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",