@abaplint/core 2.119.47 → 2.119.48
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.
|
@@ -5,7 +5,7 @@ exports.syntaxIssue = syntaxIssue;
|
|
|
5
5
|
const issue_1 = require("../../issue");
|
|
6
6
|
const severity_1 = require("../../severity");
|
|
7
7
|
exports.CheckSyntaxKey = "check_syntax";
|
|
8
|
-
function syntaxIssue(input, token, message) {
|
|
9
|
-
return issue_1.Issue.atTokenFilename(input.filename, token, message, exports.CheckSyntaxKey, severity_1.Severity.Error);
|
|
8
|
+
function syntaxIssue(input, token, message, fix) {
|
|
9
|
+
return issue_1.Issue.atTokenFilename(input.filename, token, message, exports.CheckSyntaxKey, severity_1.Severity.Error, fix);
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=_syntax_input.js.map
|
|
@@ -123,7 +123,7 @@ class Select {
|
|
|
123
123
|
&& from.getFirstToken().getStart().isBefore(up.getFirstToken().getStart())
|
|
124
124
|
&& up.getFirstToken().getStart().isBefore(intoExpression.getFirstToken().getStart())) {
|
|
125
125
|
const message = `The addition "UP TO n ROWS" must only be placed after the INTO/APPENDING clause.`;
|
|
126
|
-
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, up.getFirstToken(), message));
|
|
126
|
+
input.issues.push((0, _syntax_input_1.syntaxIssue)(input, up.getFirstToken(), message, this.buildUpToRowsFix(node, input, up, intoExpression)));
|
|
127
127
|
}
|
|
128
128
|
for (const s of up.findDirectExpressions(Expressions.SQLSource)) {
|
|
129
129
|
sql_source_1.SQLSource.runSyntax(s, input);
|
|
@@ -157,6 +157,25 @@ class Select {
|
|
|
157
157
|
input.scope.pop(node.getLastToken().getEnd());
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
+
static buildUpToRowsFix(node, input, up, intoExpression) {
|
|
161
|
+
const tokens = node.getTokens();
|
|
162
|
+
const upLast = up.getLastToken();
|
|
163
|
+
const next = tokens[tokens.findIndex(t => t === upLast) + 1];
|
|
164
|
+
const deleteEnd = (next === null || next === void 0 ? void 0 : next.getStart()) || upLast.getEnd();
|
|
165
|
+
const range = { start: up.getFirstToken().getStart(), end: deleteEnd };
|
|
166
|
+
return {
|
|
167
|
+
[input.filename]: [
|
|
168
|
+
{
|
|
169
|
+
range: { start: intoExpression.getLastToken().getEnd(), end: intoExpression.getLastToken().getEnd() },
|
|
170
|
+
newText: " " + up.concatTokens(),
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
range,
|
|
174
|
+
newText: "",
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
}
|
|
160
179
|
// there are multiple rules, but gotta start somewhere
|
|
161
180
|
static isStrictMode(node, input) {
|
|
162
181
|
// strict OpenSQL is always required in the cloud language version
|
package/build/src/registry.js
CHANGED