@abaplint/core 2.115.17 → 2.115.19
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/abaplint.d.ts +12 -2
- package/build/src/abap/2_statements/expressions/sql_field.js +2 -1
- package/build/src/abap/5_syntax/statements/assign.js +5 -4
- package/build/src/abap/types/message.js +8 -1
- package/build/src/lsp/_lookup.js +23 -1
- package/build/src/objects/message_class.js +21 -10
- package/build/src/registry.js +1 -1
- package/build/src/rules/msag_consistency.js +13 -0
- package/package.json +4 -4
package/build/abaplint.d.ts
CHANGED
|
@@ -4430,7 +4430,9 @@ export declare class MemoryFile extends AbstractFile {
|
|
|
4430
4430
|
declare class Message {
|
|
4431
4431
|
private readonly number;
|
|
4432
4432
|
private readonly message;
|
|
4433
|
-
|
|
4433
|
+
private readonly className;
|
|
4434
|
+
constructor(number: string, message: string, className: string);
|
|
4435
|
+
getMessageClass(): string;
|
|
4434
4436
|
getNumber(): string;
|
|
4435
4437
|
getMessage(): string;
|
|
4436
4438
|
getPlaceholderCount(): number;
|
|
@@ -4441,13 +4443,14 @@ declare class Message_2 implements IStatement {
|
|
|
4441
4443
|
}
|
|
4442
4444
|
|
|
4443
4445
|
declare class MessageClass extends AbstractObject {
|
|
4444
|
-
private
|
|
4446
|
+
private xml;
|
|
4445
4447
|
getType(): string;
|
|
4446
4448
|
getDescription(): string | undefined;
|
|
4447
4449
|
getAllowedNaming(): {
|
|
4448
4450
|
maxLength: number;
|
|
4449
4451
|
allowNamespace: boolean;
|
|
4450
4452
|
};
|
|
4453
|
+
getParsed(): parsedMessageClass | undefined;
|
|
4451
4454
|
setDirty(): void;
|
|
4452
4455
|
getMessages(): readonly Message[];
|
|
4453
4456
|
getByNumber(num: string): Message | undefined;
|
|
@@ -5118,6 +5121,7 @@ declare namespace Objects {
|
|
|
5118
5121
|
KnowledgeTransferDocument,
|
|
5119
5122
|
LockObject,
|
|
5120
5123
|
MaintenanceAndTransportObject,
|
|
5124
|
+
parsedMessageClass,
|
|
5121
5125
|
MessageClass,
|
|
5122
5126
|
MessagingChannel,
|
|
5123
5127
|
MIMEObject,
|
|
@@ -5359,6 +5363,12 @@ declare type ParsedDataDefinition = {
|
|
|
5359
5363
|
tree: ExpressionNode | undefined;
|
|
5360
5364
|
};
|
|
5361
5365
|
|
|
5366
|
+
declare type parsedMessageClass = {
|
|
5367
|
+
topName: string | undefined;
|
|
5368
|
+
description: string | undefined;
|
|
5369
|
+
parsedMessages: Message[] | undefined;
|
|
5370
|
+
};
|
|
5371
|
+
|
|
5362
5372
|
declare type ParsedMetadataExtension = {
|
|
5363
5373
|
tree: ExpressionNode | undefined;
|
|
5364
5374
|
};
|
|
@@ -9,7 +9,8 @@ const sql_function_1 = require("./sql_function");
|
|
|
9
9
|
const sql_path_1 = require("./sql_path");
|
|
10
10
|
class SQLField extends combi_1.Expression {
|
|
11
11
|
getRunnable() {
|
|
12
|
-
const
|
|
12
|
+
const atParen = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.ParenLeftW), _1.SimpleFieldChain2, (0, combi_1.tok)(tokens_1.WParenRightW));
|
|
13
|
+
const abap = (0, combi_1.ver)(version_1.Version.v740sp05, (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WAt), (0, combi_1.altPrio)(_1.SimpleFieldChain2, atParen)), version_1.Version.OpenABAP);
|
|
13
14
|
const as = (0, combi_1.seq)("AS", _1.SQLAsName);
|
|
14
15
|
const parenFieldName = (0, combi_1.seq)((0, combi_1.tok)(tokens_1.WParenLeftW), _1.SQLFieldName, (0, combi_1.altPrio)((0, combi_1.tok)(tokens_1.WParenRightW), (0, combi_1.tok)(tokens_1.WParenRight)));
|
|
15
16
|
const field = (0, combi_1.altPrio)(_1.SQLAggregation, _1.SQLCase, sql_function_1.SQLFunction, sql_path_1.SQLPath, _1.SQLFieldName, abap, _1.Constant, parenFieldName);
|
|
@@ -10,8 +10,9 @@ const _type_utils_1 = require("../_type_utils");
|
|
|
10
10
|
const _syntax_input_1 = require("../_syntax_input");
|
|
11
11
|
class Assign {
|
|
12
12
|
runSyntax(node, input) {
|
|
13
|
-
var _a
|
|
13
|
+
var _a;
|
|
14
14
|
const assignSource = node.findDirectExpression(Expressions.AssignSource);
|
|
15
|
+
const isComponent = ((_a = assignSource === null || assignSource === void 0 ? void 0 : assignSource.getFirstChild()) === null || _a === void 0 ? void 0 : _a.concatTokens().toUpperCase()) === "COMPONENT";
|
|
15
16
|
const sources = (assignSource === null || assignSource === void 0 ? void 0 : assignSource.findDirectExpressionsMulti([Expressions.Source, Expressions.SimpleSource3])) || [];
|
|
16
17
|
const theSource = sources[sources.length - 1];
|
|
17
18
|
let sourceType = undefined;
|
|
@@ -29,10 +30,10 @@ class Assign {
|
|
|
29
30
|
sourceType = basic_1.VoidType.get("Dynamic");
|
|
30
31
|
}
|
|
31
32
|
else {
|
|
32
|
-
sourceType = source_1.Source.runSyntax(theSource, input, undefined, false,
|
|
33
|
+
sourceType = source_1.Source.runSyntax(theSource, input, undefined, false, isComponent === false);
|
|
33
34
|
}
|
|
34
35
|
if ((assignSource === null || assignSource === void 0 ? void 0 : assignSource.getChildren().length) === 5
|
|
35
|
-
&&
|
|
36
|
+
&& isComponent) {
|
|
36
37
|
const componentSource = sources[sources.length - 2];
|
|
37
38
|
const componentType = source_1.Source.runSyntax(componentSource, input);
|
|
38
39
|
if (new _type_utils_1.TypeUtils(input.scope).isAssignable(componentType, new basic_1.CharacterType(30)) === false) {
|
|
@@ -49,7 +50,7 @@ class Assign {
|
|
|
49
50
|
}
|
|
50
51
|
const target = node.findDirectExpression(Expressions.FSTarget);
|
|
51
52
|
if (target) {
|
|
52
|
-
if (
|
|
53
|
+
if (isComponent) {
|
|
53
54
|
fstarget_1.FSTarget.runSyntax(target, input, basic_1.AnyType.get());
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Message = void 0;
|
|
4
4
|
class Message {
|
|
5
|
-
constructor(number, message) {
|
|
5
|
+
constructor(number, message, className) {
|
|
6
6
|
this.number = number;
|
|
7
7
|
if (this.number === undefined) {
|
|
8
8
|
this.number = "";
|
|
@@ -11,6 +11,13 @@ class Message {
|
|
|
11
11
|
if (this.message === undefined) {
|
|
12
12
|
this.message = "";
|
|
13
13
|
}
|
|
14
|
+
this.className = className;
|
|
15
|
+
if (this.className === undefined) {
|
|
16
|
+
this.className = "";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
getMessageClass() {
|
|
20
|
+
return this.className;
|
|
14
21
|
}
|
|
15
22
|
getNumber() {
|
|
16
23
|
return this.number;
|
package/build/src/lsp/_lookup.js
CHANGED
|
@@ -15,6 +15,7 @@ const objects_1 = require("../objects");
|
|
|
15
15
|
const types_1 = require("../abap/types");
|
|
16
16
|
const _statement_1 = require("../abap/2_statements/statements/_statement");
|
|
17
17
|
const include_graph_1 = require("../utils/include_graph");
|
|
18
|
+
const visibility_1 = require("../abap/4_file_information/visibility");
|
|
18
19
|
class LSPLookup {
|
|
19
20
|
static lookup(cursor, reg, obj) {
|
|
20
21
|
var _a, _b;
|
|
@@ -72,7 +73,11 @@ class LSPLookup {
|
|
|
72
73
|
const method = this.findMethodDefinition(cursor, bottomScope.getParent());
|
|
73
74
|
if (method !== undefined && method.getStart().equals(cursor.token.getStart())) {
|
|
74
75
|
const found = _lsp_utils_1.LSPUtils.identiferToLocation(method);
|
|
75
|
-
|
|
76
|
+
let hover = "Method Definition \"" + method.getName() + "\"";
|
|
77
|
+
// Method definitions have getVisibility()
|
|
78
|
+
const methodDef = method;
|
|
79
|
+
const visibilityStr = this.visibilityToString(methodDef.getVisibility());
|
|
80
|
+
hover += "\n\n" + visibilityStr;
|
|
76
81
|
return { hover, definition: found, definitionId: method, scope: bottomScope };
|
|
77
82
|
}
|
|
78
83
|
let hoverValue = "";
|
|
@@ -238,8 +243,25 @@ class LSPLookup {
|
|
|
238
243
|
}
|
|
239
244
|
return this.methodParameters(methodDef);
|
|
240
245
|
}
|
|
246
|
+
static visibilityToString(visibility) {
|
|
247
|
+
switch (visibility) {
|
|
248
|
+
case visibility_1.Visibility.Public:
|
|
249
|
+
return "PUBLIC";
|
|
250
|
+
case visibility_1.Visibility.Protected:
|
|
251
|
+
return "PROTECTED";
|
|
252
|
+
case visibility_1.Visibility.Private:
|
|
253
|
+
return "PRIVATE";
|
|
254
|
+
default:
|
|
255
|
+
return "";
|
|
256
|
+
}
|
|
257
|
+
}
|
|
241
258
|
static methodParameters(methodDef) {
|
|
242
259
|
let ret = "";
|
|
260
|
+
// Add visibility information
|
|
261
|
+
const visibilityStr = this.visibilityToString(methodDef.getVisibility());
|
|
262
|
+
if (visibilityStr) {
|
|
263
|
+
ret += visibilityStr + "\n\n";
|
|
264
|
+
}
|
|
243
265
|
const parameters = methodDef.getParameters();
|
|
244
266
|
const importing = parameters.getImporting();
|
|
245
267
|
if (importing.length > 0) {
|
|
@@ -7,15 +7,15 @@ const xml_utils_1 = require("../xml_utils");
|
|
|
7
7
|
class MessageClass extends _abstract_object_1.AbstractObject {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
|
-
this.
|
|
10
|
+
this.xml = undefined;
|
|
11
11
|
}
|
|
12
12
|
getType() {
|
|
13
13
|
return "MSAG";
|
|
14
14
|
}
|
|
15
15
|
getDescription() {
|
|
16
|
+
var _a;
|
|
16
17
|
this.parseXML();
|
|
17
|
-
|
|
18
|
-
return undefined;
|
|
18
|
+
return (_a = this.xml) === null || _a === void 0 ? void 0 : _a.description;
|
|
19
19
|
}
|
|
20
20
|
getAllowedNaming() {
|
|
21
21
|
return {
|
|
@@ -23,13 +23,18 @@ class MessageClass extends _abstract_object_1.AbstractObject {
|
|
|
23
23
|
allowNamespace: true,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
+
getParsed() {
|
|
27
|
+
this.parseXML();
|
|
28
|
+
return this.xml;
|
|
29
|
+
}
|
|
26
30
|
setDirty() {
|
|
27
|
-
this.
|
|
31
|
+
this.xml = undefined;
|
|
28
32
|
super.setDirty();
|
|
29
33
|
}
|
|
30
34
|
getMessages() {
|
|
35
|
+
var _a;
|
|
31
36
|
this.parseXML();
|
|
32
|
-
const msg = this.parsedMessages;
|
|
37
|
+
const msg = (_a = this.xml) === null || _a === void 0 ? void 0 : _a.parsedMessages;
|
|
33
38
|
return msg ? msg : [];
|
|
34
39
|
}
|
|
35
40
|
getByNumber(num) {
|
|
@@ -44,21 +49,27 @@ class MessageClass extends _abstract_object_1.AbstractObject {
|
|
|
44
49
|
}
|
|
45
50
|
/////////////////////////////////
|
|
46
51
|
parseXML() {
|
|
47
|
-
var _a, _b;
|
|
48
|
-
if (this.
|
|
52
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
53
|
+
if (this.xml !== undefined) {
|
|
49
54
|
return;
|
|
50
55
|
}
|
|
51
|
-
this.
|
|
56
|
+
this.xml = {
|
|
57
|
+
topName: undefined,
|
|
58
|
+
description: undefined,
|
|
59
|
+
parsedMessages: [],
|
|
60
|
+
};
|
|
52
61
|
const parsed = super.parseRaw2();
|
|
53
62
|
if (parsed === undefined) {
|
|
54
63
|
return;
|
|
55
64
|
}
|
|
56
|
-
|
|
65
|
+
this.xml.topName = (_c = (_b = (_a = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _a === void 0 ? void 0 : _a["asx:abap"]["asx:values"]) === null || _b === void 0 ? void 0 : _b.T100A) === null || _c === void 0 ? void 0 : _c.ARBGB;
|
|
66
|
+
this.xml.description = (_f = (_e = (_d = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _d === void 0 ? void 0 : _d["asx:abap"]["asx:values"]) === null || _e === void 0 ? void 0 : _e.T100A) === null || _f === void 0 ? void 0 : _f.STEXT;
|
|
67
|
+
const t100 = (_h = (_g = parsed === null || parsed === void 0 ? void 0 : parsed.abapGit) === null || _g === void 0 ? void 0 : _g["asx:abap"]["asx:values"]) === null || _h === void 0 ? void 0 : _h.T100;
|
|
57
68
|
if (t100 === undefined) {
|
|
58
69
|
return;
|
|
59
70
|
}
|
|
60
71
|
for (const msg of (0, xml_utils_1.xmlToArray)(t100.T100)) {
|
|
61
|
-
this.parsedMessages.push(new message_1.Message(msg.MSGNR, (0, xml_utils_1.unescape)(msg.TEXT)));
|
|
72
|
+
this.xml.parsedMessages.push(new message_1.Message(msg.MSGNR, (0, xml_utils_1.unescape)(msg.TEXT), msg.ARBGB));
|
|
62
73
|
}
|
|
63
74
|
}
|
|
64
75
|
}
|
package/build/src/registry.js
CHANGED
|
@@ -38,6 +38,7 @@ class MSAGConsistency {
|
|
|
38
38
|
return this;
|
|
39
39
|
}
|
|
40
40
|
run(obj) {
|
|
41
|
+
var _a, _b;
|
|
41
42
|
const issues = [];
|
|
42
43
|
if (!(obj instanceof objects_1.MessageClass)) {
|
|
43
44
|
return [];
|
|
@@ -86,6 +87,18 @@ class MSAGConsistency {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
}
|
|
90
|
+
if (message.getMessageClass() !== obj.getName()) {
|
|
91
|
+
const text = `Message class "${message.getMessageClass()}" does not match filename "${obj.getName()}" for message ${message.getNumber()}`;
|
|
92
|
+
const position = new position_1.Position(1, 1);
|
|
93
|
+
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
94
|
+
issues.push(issue);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (((_a = obj.getParsed()) === null || _a === void 0 ? void 0 : _a.topName) !== obj.getName()) {
|
|
98
|
+
const text = `Message class name "${(_b = obj.getParsed()) === null || _b === void 0 ? void 0 : _b.topName}" does not match filename "${obj.getName()}"`;
|
|
99
|
+
const position = new position_1.Position(1, 1);
|
|
100
|
+
const issue = issue_1.Issue.atPosition(obj.getFiles()[0], position, text, this.getMetadata().key, this.conf.severity);
|
|
101
|
+
issues.push(issue);
|
|
89
102
|
}
|
|
90
103
|
return issues;
|
|
91
104
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abaplint/core",
|
|
3
|
-
"version": "2.115.
|
|
3
|
+
"version": "2.115.19",
|
|
4
4
|
"description": "abaplint - Core API",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"typings": "build/abaplint.d.ts",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://abaplint.org",
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@microsoft/api-extractor": "^7.
|
|
53
|
+
"@microsoft/api-extractor": "^7.56.0",
|
|
54
54
|
"@types/chai": "^4.3.20",
|
|
55
55
|
"@types/mocha": "^10.0.10",
|
|
56
|
-
"@types/node": "^24.10.
|
|
56
|
+
"@types/node": "^24.10.10",
|
|
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.4",
|
|
67
67
|
"json5": "^2.2.3",
|
|
68
68
|
"vscode-languageserver-types": "^3.17.5"
|
|
69
69
|
}
|