@abaplint/core 2.115.23 → 2.115.25
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.
|
@@ -7,7 +7,9 @@ const cds_annotation_array_1 = require("./cds_annotation_array");
|
|
|
7
7
|
class CDSAnnotation extends combi_1.Expression {
|
|
8
8
|
getRunnable() {
|
|
9
9
|
const nameWithSlash = (0, combi_1.seq)((0, combi_1.regex)(/^\w+$/), (0, combi_1.star)((0, combi_1.seq)("/", (0, combi_1.regex)(/^\w+$/))));
|
|
10
|
-
|
|
10
|
+
// Support both "@Name" (single token) and "@ Name" (two tokens with space)
|
|
11
|
+
const annotationStart = (0, combi_1.alt)((0, combi_1.regex)(/^@\w+$/), (0, combi_1.seq)("@", (0, combi_1.regex)(/^\w+$/)));
|
|
12
|
+
return (0, combi_1.seq)(annotationStart, (0, combi_1.star)((0, combi_1.seq)(".", nameWithSlash)), (0, combi_1.opt)((0, combi_1.seq)(":", (0, combi_1.alt)(cds_annotation_array_1.CDSAnnotationArray, _1.CDSAnnotationObject, _1.CDSAnnotationSimple))));
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
exports.CDSAnnotation = CDSAnnotation;
|
|
@@ -9,11 +9,14 @@ class CDSArithmetics extends combi_1.Expression {
|
|
|
9
9
|
const name = (0, combi_1.seq)(_1.CDSName, (0, combi_1.optPrio)((0, combi_1.seq)(".", _1.CDSName)));
|
|
10
10
|
const val = (0, combi_1.altPrio)(cds_integer_1.CDSInteger, _1.CDSFunction, _1.CDSCase, _1.CDSCast, _1.CDSString, _1.CDSAggregate, name);
|
|
11
11
|
const operator = (0, combi_1.altPrio)("+", "-", "*", "/");
|
|
12
|
+
// Support unary operators (e.g., "- field" in CASE expressions)
|
|
13
|
+
const unary = (0, combi_1.altPrio)("-", "+");
|
|
14
|
+
const unaryExpression = (0, combi_1.seq)(unary, val);
|
|
12
15
|
const operatorValue = (0, combi_1.seq)(operator, val);
|
|
13
16
|
const paren = (0, combi_1.seq)("(", val, (0, combi_1.plusPrio)(operatorValue), ")");
|
|
14
17
|
const noParen = (0, combi_1.seq)(val, (0, combi_1.plusPrio)(operatorValue));
|
|
15
18
|
// todo: this is pretty bad, it needs a rewrite
|
|
16
|
-
return (0, combi_1.altPrio)((0, combi_1.seq)(paren, (0, combi_1.starPrio)(operatorValue)), noParen);
|
|
19
|
+
return (0, combi_1.altPrio)(unaryExpression, (0, combi_1.seq)(paren, (0, combi_1.starPrio)(operatorValue)), noParen);
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
exports.CDSArithmetics = CDSArithmetics;
|
|
@@ -25,7 +25,15 @@ class RenamerHelper {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
// start with the last reference in the file first, if there are multiple refs per line
|
|
28
|
-
|
|
28
|
+
// sort refs by position descending (row desc, then col desc) so edits don't corrupt positions
|
|
29
|
+
refs.sort((a, b) => {
|
|
30
|
+
const rowDiff = b.getStart().getRow() - a.getStart().getRow();
|
|
31
|
+
if (rowDiff !== 0) {
|
|
32
|
+
return rowDiff;
|
|
33
|
+
}
|
|
34
|
+
return b.getStart().getCol() - a.getStart().getCol();
|
|
35
|
+
});
|
|
36
|
+
return this.replaceRefs(refs, oldName, newName);
|
|
29
37
|
}
|
|
30
38
|
renameDDICCodeReferences(obj, oldName, newName) {
|
|
31
39
|
const changes = [];
|
|
@@ -165,8 +173,14 @@ class RenamerHelper {
|
|
|
165
173
|
////////////////////////
|
|
166
174
|
replaceRefs(refs, oldName, newName) {
|
|
167
175
|
const changes = [];
|
|
176
|
+
const seen = new Set();
|
|
168
177
|
// "zif_abapgit_auth~is_allowed" is a single token so only replace the first part of a token
|
|
169
178
|
for (const r of refs) {
|
|
179
|
+
const key = r.getFilename() + ":" + r.getStart().getRow() + ":" + r.getStart().getCol();
|
|
180
|
+
if (seen.has(key)) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
seen.add(key);
|
|
170
184
|
const range = vscode_languageserver_types_1.Range.create(r.getStart().getRow() - 1, r.getStart().getCol() - 1, r.getStart().getRow() - 1, r.getStart().getCol() - 1 + oldName.length);
|
|
171
185
|
changes.push(vscode_languageserver_types_1.TextDocumentEdit.create({ uri: r.getFilename(), version: 1 }, [vscode_languageserver_types_1.TextEdit.replace(range, newName.toLowerCase())]));
|
|
172
186
|
}
|
package/build/src/registry.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.115.
|
|
3
|
+
"version": "2.115.25",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@microsoft/api-extractor": "^7.56.3",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/node": "^24.10.
|
|
56
|
+
"@types/node": "^24.10.13",
|
|
57
57
|
"chai": "^4.5.0",
|
|
58
58
|
"eslint": "^9.39.2",
|
|
59
59
|
"mocha": "^11.7.5",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"typescript": "^5.9.3"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"fast-xml-parser": "^5.3.
|
|
66
|
+
"fast-xml-parser": "^5.3.5",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|