@abaplint/core 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.
- package/build/src/abap/5_syntax/statements/insert_internal.js +9 -4
- package/build/src/objects/rename/rename_icf_service.js +28 -4
- package/build/src/objects/rename/renamer.js +4 -1
- package/build/src/objects/rename/renamer_helper.js +28 -0
- package/build/src/registry.js +1 -1
- package/package.json +1 -1
|
@@ -55,13 +55,18 @@ class InsertInternal {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
if (node.findDirectTokenByText("INITIAL") === undefined) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
let error = false;
|
|
59
|
+
if (sourceType instanceof basic_1.IntegerType && targetType instanceof basic_1.Integer8Type) {
|
|
60
|
+
error = true;
|
|
61
|
+
}
|
|
62
|
+
else if (new _type_utils_1.TypeUtils(input.scope).isAssignable(sourceType, targetType) === false) {
|
|
63
|
+
error = true;
|
|
62
64
|
}
|
|
63
65
|
else if (sourceType instanceof basic_1.CharacterType && targetType instanceof basic_1.StringType) {
|
|
64
66
|
// yea, well, INSERT doesnt convert the values automatically, like everything else?
|
|
67
|
+
error = true;
|
|
68
|
+
}
|
|
69
|
+
if (error === true) {
|
|
65
70
|
const message = "Types not compatible";
|
|
66
71
|
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, node.getFirstToken(), message));
|
|
67
72
|
return;
|
|
@@ -8,15 +8,39 @@ class RenameICFService {
|
|
|
8
8
|
this.reg = reg;
|
|
9
9
|
}
|
|
10
10
|
buildEdits(obj, oldName, newName) {
|
|
11
|
+
var _a, _b, _c, _d;
|
|
11
12
|
if (!(obj instanceof __1.ICFService)) {
|
|
12
13
|
throw new Error("RenameICFService, not a ICF Service");
|
|
13
14
|
}
|
|
15
|
+
// Preserve GUID suffix from the stored object/file name for the filename rename
|
|
16
|
+
// SICF files follow pattern: servicename.sicf or servicename {GUID}.sicf
|
|
17
|
+
const fileNewName = (() => {
|
|
18
|
+
// Look for pattern: space + GUID (32 hex chars in braces) + optional extension
|
|
19
|
+
const guidPattern = / \{[0-9A-Fa-f]{16,32}\}/;
|
|
20
|
+
const match = oldName.match(guidPattern);
|
|
21
|
+
if (match) {
|
|
22
|
+
// Extract everything from the GUID onwards (includes .sicf extension if present)
|
|
23
|
+
const guidIndex = match.index;
|
|
24
|
+
const suffix = oldName.substring(guidIndex);
|
|
25
|
+
// Only append suffix if newName doesn't already contain it
|
|
26
|
+
return newName.includes(suffix) ? newName : newName + suffix;
|
|
27
|
+
}
|
|
28
|
+
// Fallback: preserve any suffix after first space (legacy behavior)
|
|
29
|
+
const space = oldName.indexOf(" ");
|
|
30
|
+
if (space > -1) {
|
|
31
|
+
const suffix = oldName.substring(space);
|
|
32
|
+
return newName.includes(suffix) ? newName : newName + suffix;
|
|
33
|
+
}
|
|
34
|
+
return newName;
|
|
35
|
+
})();
|
|
36
|
+
const cleanOldName = (_b = (_a = oldName.match(/^[^ ]+/)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : oldName;
|
|
37
|
+
const cleanNewName = (_d = (_c = newName.match(/^[^ ]+/)) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : newName;
|
|
14
38
|
let changes = [];
|
|
15
39
|
const helper = new renamer_helper_1.RenamerHelper(this.reg);
|
|
16
|
-
changes = changes.concat(helper.
|
|
17
|
-
changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME",
|
|
18
|
-
changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME",
|
|
19
|
-
changes = changes.concat(helper.renameFiles(obj, oldName,
|
|
40
|
+
changes = changes.concat(helper.buildURLFileEdits(obj, cleanOldName, cleanNewName));
|
|
41
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "ICF_NAME", cleanOldName, cleanNewName));
|
|
42
|
+
changes = changes.concat(helper.buildXMLFileEdits(obj, "ORIG_NAME", cleanOldName, cleanNewName, true));
|
|
43
|
+
changes = changes.concat(helper.renameFiles(obj, oldName, fileNewName));
|
|
20
44
|
return {
|
|
21
45
|
documentChanges: changes,
|
|
22
46
|
};
|
|
@@ -32,7 +32,10 @@ class Renamer {
|
|
|
32
32
|
/** Builds edits, but does not apply to registry, used by LSP */
|
|
33
33
|
buildEdits(type, oldName, newName) {
|
|
34
34
|
this.reg.parse(); // the registry must be parsed to dermine references
|
|
35
|
-
|
|
35
|
+
let obj = this.reg.getObject(type, oldName);
|
|
36
|
+
if (obj === undefined && type === "SICF") {
|
|
37
|
+
obj = Array.from(this.reg.getObjects()).find(o => o.getType() === "SICF" && o.getName().toUpperCase().startsWith(oldName.toUpperCase() + " "));
|
|
38
|
+
}
|
|
36
39
|
if (obj === undefined) {
|
|
37
40
|
throw new Error("rename, object not found");
|
|
38
41
|
}
|
|
@@ -123,6 +123,34 @@ class RenamerHelper {
|
|
|
123
123
|
}
|
|
124
124
|
return changes;
|
|
125
125
|
}
|
|
126
|
+
buildURLFileEdits(object, oldName, newName) {
|
|
127
|
+
const changes = [];
|
|
128
|
+
const xml = object.getXMLFile();
|
|
129
|
+
if (xml === undefined) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
const oldNameLower = oldName.toLowerCase();
|
|
133
|
+
const newNameLower = newName.toLowerCase();
|
|
134
|
+
const rows = xml.getRawRows();
|
|
135
|
+
for (let i = 0; i < rows.length; i++) {
|
|
136
|
+
const row = rows[i];
|
|
137
|
+
const urlTagStart = row.indexOf("<URL>");
|
|
138
|
+
if (urlTagStart === -1) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const urlTagEnd = row.indexOf("</URL>");
|
|
142
|
+
if (urlTagEnd === -1) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const urlContent = row.substring(urlTagStart + 5, urlTagEnd);
|
|
146
|
+
const updatedUrl = urlContent.replace(oldNameLower, newNameLower);
|
|
147
|
+
if (updatedUrl !== urlContent) {
|
|
148
|
+
const range = vscode_languageserver_types_1.Range.create(i, urlTagStart + 5, i, urlTagEnd);
|
|
149
|
+
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: xml.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, updatedUrl)]));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return changes;
|
|
153
|
+
}
|
|
126
154
|
renameFiles(obj, oldName, name) {
|
|
127
155
|
const list = [];
|
|
128
156
|
const newName = name.toLowerCase().replace(/\//g, "#");
|
package/build/src/registry.js
CHANGED