@abaplint/core 2.100.0 → 2.100.2

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.
@@ -3732,6 +3732,7 @@ export declare class LanguageServer {
3732
3732
  references(params: ITextDocumentPositionParams): LServer.Location[];
3733
3733
  static semanticTokensLegend(): LServer.SemanticTokensLegend;
3734
3734
  semanticTokensRange(range: ITextDocumentRange): LServer.SemanticTokens;
3735
+ codeLens(textDocument: LServer.TextDocumentIdentifier): LServer.CodeLens[];
3735
3736
  help(textDocument: LServer.TextDocumentIdentifier, position: LServer.Position): string;
3736
3737
  listDefinitionPositions(textDocument: LServer.TextDocumentIdentifier): LServer.Range[];
3737
3738
  listReadPositions(textDocument: LServer.TextDocumentIdentifier): LServer.Range[];
@@ -11,7 +11,7 @@ const raise_with_1 = require("../expressions/raise_with");
11
11
  class Raise {
12
12
  runSyntax(node, scope, filename) {
13
13
  // todo
14
- var _a;
14
+ var _a, _b, _c;
15
15
  const classTok = (_a = node.findDirectExpression(Expressions.ClassName)) === null || _a === void 0 ? void 0 : _a.getFirstToken();
16
16
  const classNam = classTok === null || classTok === void 0 ? void 0 : classTok.getStr();
17
17
  if (classNam) {
@@ -60,6 +60,12 @@ class Raise {
60
60
  for (const s of node.findDirectExpressions(Expressions.MessageSource)) {
61
61
  new message_source_1.MessageSource().runSyntax(s, scope, filename);
62
62
  }
63
+ const id = (_b = node.findExpressionAfterToken("ID")) === null || _b === void 0 ? void 0 : _b.concatTokens();
64
+ const number = (_c = node.findDirectExpression(Expressions.MessageNumber)) === null || _c === void 0 ? void 0 : _c.concatTokens();
65
+ if ((id === null || id === void 0 ? void 0 : id.startsWith("'")) && number) {
66
+ const messageClass = id.substring(1, id.length - 1).toUpperCase();
67
+ scope.getMSAGReferences().addUsing(filename, node.getFirstToken(), messageClass, number);
68
+ }
63
69
  }
64
70
  }
65
71
  exports.Raise = Raise;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CodeLens = void 0;
4
+ const LServer = require("vscode-languageserver-types");
5
+ const _lsp_utils_1 = require("./_lsp_utils");
6
+ const syntax_1 = require("../abap/5_syntax/syntax");
7
+ const _abap_object_1 = require("../objects/_abap_object");
8
+ class CodeLens {
9
+ constructor(reg) {
10
+ this.reg = reg;
11
+ }
12
+ list(textDocument) {
13
+ var _a;
14
+ const file = _lsp_utils_1.LSPUtils.getABAPFile(this.reg, textDocument.uri);
15
+ if (file === undefined) {
16
+ return [];
17
+ }
18
+ const obj = this.reg.findObjectForFile(file);
19
+ if (obj === undefined || !(obj instanceof _abap_object_1.ABAPObject)) {
20
+ return [];
21
+ }
22
+ new syntax_1.SyntaxLogic(this.reg, obj).run();
23
+ const ret = [];
24
+ const list = this.reg.getMSAGReferences().listByFilename(file.getFilename());
25
+ for (const l of list) {
26
+ const msag = this.reg.getObject("MSAG", l.messageClass);
27
+ if (msag === undefined) {
28
+ continue;
29
+ }
30
+ const text = (_a = msag.getByNumber(l.number)) === null || _a === void 0 ? void 0 : _a.getMessage();
31
+ ret.push(LServer.CodeLens.create(_lsp_utils_1.LSPUtils.tokenToRange(l.token), text));
32
+ }
33
+ return ret;
34
+ }
35
+ }
36
+ exports.CodeLens = CodeLens;
37
+ //# sourceMappingURL=code_lens.js.map
@@ -16,6 +16,7 @@ const references_1 = require("./references");
16
16
  const implementation_1 = require("./implementation");
17
17
  const semantic_1 = require("./semantic");
18
18
  const statement_flow_1 = require("../abap/flow/statement_flow");
19
+ const code_lens_1 = require("./code_lens");
19
20
  // note Ranges are zero based in LSP,
20
21
  // https://github.com/microsoft/language-server-protocol/blob/main/versions/protocol-2-x.md#range
21
22
  // but 1 based in abaplint
@@ -96,6 +97,10 @@ class LanguageServer {
96
97
  semanticTokensRange(range) {
97
98
  return new semantic_1.SemanticHighlighting(this.reg).semanticTokensRange(range);
98
99
  }
100
+ // https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_codeLens
101
+ codeLens(textDocument) {
102
+ return new code_lens_1.CodeLens(this.reg).list(textDocument);
103
+ }
99
104
  ////////////////////////////////////////
100
105
  // ______ _
101
106
  // | ____| | |
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.100.0";
68
+ return "2.100.2";
69
69
  }
70
70
  getDDICReferences() {
71
71
  return this.ddicReferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abaplint/core",
3
- "version": "2.100.0",
3
+ "version": "2.100.2",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",