@abaplint/core 2.107.2 → 2.107.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.
@@ -1709,6 +1709,15 @@ declare class Detail implements IStatement {
1709
1709
  getMatcher(): IStatementRunnable;
1710
1710
  }
1711
1711
 
1712
+ export declare class Diagnostics {
1713
+ private readonly reg;
1714
+ constructor(reg: IRegistry);
1715
+ findIssues(textDocument: LServer.TextDocumentIdentifier): readonly Issue[];
1716
+ static mapDiagnostic(issue: Issue): LServer.Diagnostic;
1717
+ find(textDocument: LServer.TextDocumentIdentifier): LServer.Diagnostic[];
1718
+ private static mapSeverity;
1719
+ }
1720
+
1712
1721
  declare class DialogModule extends AbstractObject {
1713
1722
  getType(): string;
1714
1723
  getAllowedNaming(): {
@@ -3165,7 +3174,12 @@ declare interface IIssueData {
3165
3174
  start: Position;
3166
3175
  end: Position;
3167
3176
  severity: Severity;
3168
- fix?: IEdit;
3177
+ /** The default fix for the issue, it always makes sense to apply this fix
3178
+ * These are applied by "abaplint --fix" and in the document formatter in vscode extension
3179
+ */
3180
+ defaultFix?: IEdit;
3181
+ /** Alternative quick fixes, the developer must choose which to apply */
3182
+ alternativeFixes?: IEdit[];
3169
3183
  }
3170
3184
 
3171
3185
  declare interface IKeyword {
@@ -3798,7 +3812,8 @@ export declare class Issue {
3798
3812
  getStart(): Position;
3799
3813
  getEnd(): Position;
3800
3814
  getFilename(): string;
3801
- getFix(): IEdit | undefined;
3815
+ getDefaultFix(): IEdit | undefined;
3816
+ getAlternativeFixes(): IEdit[] | undefined;
3802
3817
  getSeverity(): Severity;
3803
3818
  }
3804
3819
 
@@ -4019,6 +4034,12 @@ declare class LoopTarget extends Expression {
4019
4034
  getRunnable(): IStatementRunnable;
4020
4035
  }
4021
4036
 
4037
+ export declare class LSPEdit {
4038
+ static mapEdits(edits: IEdit[]): LServer.WorkspaceEdit;
4039
+ static mapEdit(edit: IEdit): LServer.WorkspaceEdit;
4040
+ private static mapText;
4041
+ }
4042
+
4022
4043
  declare class MacroName extends Expression {
4023
4044
  getRunnable(): IStatementRunnable;
4024
4045
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Visibility = exports.Info = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
4
- exports.RuleTag = exports.Severity = void 0;
3
+ exports.Info = exports.Diagnostics = exports.Rename = exports.PrettyPrinter = exports.Position = exports.CurrentScope = exports.ABAPFile = exports.RulesRunner = exports.SpaghettiScope = exports.SyntaxLogic = exports.ABAPObject = exports.Tokens = exports.ExpressionsCDS = exports.CDSParser = exports.LanguageServerTypes = exports.DDLParser = exports.applyEditList = exports.applyEditSingle = exports.SpaghettiScopeNode = exports.AbstractFile = exports.Token = exports.ScopeType = exports.BasicTypes = exports.TypedIdentifier = exports.AbstractType = exports.VirtualPosition = exports.Comment = exports.Unknown = exports.Empty = exports.Identifier = exports.Nodes = exports.Types = exports.Expressions = exports.Statements = exports.Structures = exports.SkipLogic = exports.Objects = exports.ArtifactsRules = exports.ArtifactsObjects = exports.ArtifactsABAP = exports.BuiltIn = exports.MethodLengthStats = exports.LanguageServer = exports.Registry = exports.CyclomaticComplexityStats = exports.ReferenceType = exports.Version = exports.Config = exports.Issue = exports.MemoryFile = void 0;
4
+ exports.LSPEdit = exports.RuleTag = exports.Severity = exports.Visibility = void 0;
5
5
  const issue_1 = require("./issue");
6
6
  Object.defineProperty(exports, "Issue", { enumerable: true, get: function () { return issue_1.Issue; } });
7
7
  const config_1 = require("./config");
@@ -102,4 +102,8 @@ const cyclomatic_complexity_stats_1 = require("./utils/cyclomatic_complexity_sta
102
102
  Object.defineProperty(exports, "CyclomaticComplexityStats", { enumerable: true, get: function () { return cyclomatic_complexity_stats_1.CyclomaticComplexityStats; } });
103
103
  const skip_logic_1 = require("./skip_logic");
104
104
  Object.defineProperty(exports, "SkipLogic", { enumerable: true, get: function () { return skip_logic_1.SkipLogic; } });
105
+ const diagnostics_1 = require("./lsp/diagnostics");
106
+ Object.defineProperty(exports, "Diagnostics", { enumerable: true, get: function () { return diagnostics_1.Diagnostics; } });
107
+ const _edit_1 = require("./lsp/_edit");
108
+ Object.defineProperty(exports, "LSPEdit", { enumerable: true, get: function () { return _edit_1.LSPEdit; } });
105
109
  //# sourceMappingURL=index.js.map
@@ -32,7 +32,7 @@ class Issue {
32
32
  key,
33
33
  start,
34
34
  end,
35
- fix,
35
+ defaultFix: fix,
36
36
  severity,
37
37
  });
38
38
  }
@@ -46,7 +46,7 @@ class Issue {
46
46
  key,
47
47
  start,
48
48
  end,
49
- fix,
49
+ defaultFix: fix,
50
50
  severity,
51
51
  });
52
52
  }
@@ -58,7 +58,7 @@ class Issue {
58
58
  key,
59
59
  start,
60
60
  end,
61
- fix,
61
+ defaultFix: fix,
62
62
  severity,
63
63
  });
64
64
  }
@@ -71,7 +71,7 @@ class Issue {
71
71
  start: token.getStart(),
72
72
  end: token.getEnd(),
73
73
  severity,
74
- fix,
74
+ defaultFix: fix,
75
75
  });
76
76
  }
77
77
  static atIdentifier(identifier, message, key, severity, fix) {
@@ -83,14 +83,14 @@ class Issue {
83
83
  start: identifier.getStart(),
84
84
  end: identifier.getEnd(),
85
85
  severity,
86
- fix,
86
+ defaultFix: fix,
87
87
  });
88
88
  }
89
89
  constructor(data) {
90
90
  this.data = data;
91
91
  if (this.data.start instanceof virtual_position_1.VirtualPosition) {
92
92
  // no quick fixes inside macros
93
- this.data.fix = undefined;
93
+ this.data.defaultFix = undefined;
94
94
  }
95
95
  if (this.data.start.getCol() < 1) {
96
96
  throw new Error("issue, start col < 1");
@@ -117,8 +117,11 @@ class Issue {
117
117
  getFilename() {
118
118
  return this.data.filename;
119
119
  }
120
- getFix() {
121
- return this.data.fix;
120
+ getDefaultFix() {
121
+ return this.data.defaultFix;
122
+ }
123
+ getAlternativeFixes() {
124
+ return this.data.alternativeFixes;
122
125
  }
123
126
  getSeverity() {
124
127
  return this.data.severity;
@@ -15,22 +15,6 @@ class LSPEdit {
15
15
  }
16
16
  return workspace;
17
17
  }
18
- /*
19
- public static mapEditsDocument(edit: IEdit): LServer.WorkspaceEdit {
20
- const workspace: LServer.WorkspaceEdit = {documentChanges: []};
21
- for (const filename in edit) {
22
- const doc: LServer.VersionedTextDocumentIdentifier = {uri: filename, version: 1};
23
-
24
- const e = LServer.TextDocumentEdit.create(doc, this.mapText(edit[filename]));
25
- workspace.documentChanges?.push(e);
26
- }
27
- // @ts-ignore
28
- console.dir(workspace.documentChanges![0].edits[0]);
29
- // @ts-ignore
30
- console.dir(workspace.documentChanges![0].edits[1]);
31
- return workspace;
32
- }
33
- */
34
18
  static mapEdit(edit) {
35
19
  const workspace = { changes: {} };
36
20
  for (const filename in edit) {
@@ -16,7 +16,7 @@ class CodeActions {
16
16
  const shown = new Set();
17
17
  const ret = [];
18
18
  for (const i of issues) {
19
- const fix = i.getFix();
19
+ const fix = i.getDefaultFix();
20
20
  if (fix === undefined) {
21
21
  continue;
22
22
  }
@@ -51,7 +51,7 @@ class CodeActions {
51
51
  const diagnostics = [];
52
52
  const fixes = [];
53
53
  for (const i of issues) {
54
- const fix = i.getFix();
54
+ const fix = i.getDefaultFix();
55
55
  if (fix === undefined) {
56
56
  continue;
57
57
  }
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.107.2";
68
+ return "2.107.3";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
@@ -141,7 +141,7 @@ https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-US/abenchained_statement
141
141
  }
142
142
  let prevFix;
143
143
  if (previousRow === colon.getStart().getRow()) {
144
- prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getFix();
144
+ prevFix = (_a = issues.pop()) === null || _a === void 0 ? void 0 : _a.getDefaultFix();
145
145
  }
146
146
  const fix = this.getFix(file, statement, statementNode, prevFix);
147
147
  const message = "Chain mainly declarations";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.107.2",
3
+ "version": "2.107.3",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -51,7 +51,7 @@
51
51
  "homepage": "https://abaplint.org",
52
52
  "devDependencies": {
53
53
  "@microsoft/api-extractor": "^7.43.1",
54
- "@types/chai": "^4.3.15",
54
+ "@types/chai": "^4.3.16",
55
55
  "@types/mocha": "^10.0.6",
56
56
  "@types/node": "^20.12.8",
57
57
  "chai": "^4.4.1",