@abaplint/cli 2.115.2 → 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 +70 -10
  2. package/package.json +2 -2
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;
@@ -52499,15 +52504,39 @@ class RenameICFService {
52499
52504
  this.reg = reg;
52500
52505
  }
52501
52506
  buildEdits(obj, oldName, newName) {
52507
+ var _a, _b, _c, _d;
52502
52508
  if (!(obj instanceof __1.ICFService)) {
52503
52509
  throw new Error("RenameICFService, not a ICF Service");
52504
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;
52505
52534
  let changes = [];
52506
52535
  const helper = new renamer_helper_1.RenamerHelper(this.reg);
52507
- changes = changes.concat(helper.buildXMLFileEdits(obj, "URL", oldName, newName, true));
52508
- changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME", oldName, newName));
52509
- changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", oldName, newName, true));
52510
- 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));
52511
52540
  return {
52512
52541
  documentChanges: changes,
52513
52542
  };
@@ -52684,7 +52713,10 @@ class Renamer {
52684
52713
  /** Builds edits, but does not apply to registry, used by LSP */
52685
52714
  buildEdits(type, oldName, newName) {
52686
52715
  this.reg.parse(); // the registry must be parsed to dermine references
52687
- 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
+ }
52688
52720
  if (obj === undefined) {
52689
52721
  throw new Error("rename, object not found");
52690
52722
  }
@@ -52913,6 +52945,34 @@ class RenamerHelper {
52913
52945
  }
52914
52946
  return changes;
52915
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)]));
52972
+ }
52973
+ }
52974
+ return changes;
52975
+ }
52916
52976
  renameFiles(obj, oldName, name) {
52917
52977
  const list = [];
52918
52978
  const newName = name.toLowerCase().replace(/\//g, "#");
@@ -55155,7 +55215,7 @@ class Registry {
55155
55215
  }
55156
55216
  static abaplintVersion() {
55157
55217
  // magic, see build script "version.sh"
55158
- return "2.115.2";
55218
+ return "2.115.3";
55159
55219
  }
55160
55220
  getDDICReferences() {
55161
55221
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/cli",
3
- "version": "2.115.2",
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.2",
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",