@abaplint/core 2.101.8 → 2.101.9

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.
@@ -423,6 +423,7 @@ declare namespace BasicTypes {
423
423
  GenericObjectReferenceType,
424
424
  HexType,
425
425
  IntegerType,
426
+ Integer8Type,
426
427
  NumericGenericType,
427
428
  NumericType,
428
429
  ObjectReferenceType,
@@ -3332,6 +3333,14 @@ declare class Integer extends Expression {
3332
3333
  getRunnable(): IStatementRunnable;
3333
3334
  }
3334
3335
 
3336
+ declare class Integer8Type extends AbstractType {
3337
+ toText(): string;
3338
+ isGeneric(): boolean;
3339
+ toABAP(): string;
3340
+ containsVoid(): boolean;
3341
+ toCDS(): string;
3342
+ }
3343
+
3335
3344
  declare class IntegerType extends AbstractType {
3336
3345
  toText(): string;
3337
3346
  isGeneric(): boolean;
@@ -3628,6 +3637,7 @@ export declare interface ISpaghettiScopeNode {
3628
3637
  end: Position;
3629
3638
  };
3630
3639
  findClassDefinition(name: string): IClassDefinition | undefined;
3640
+ listClassDefinitions(): IClassDefinition[];
3631
3641
  findFormDefinition(name: string): IFormDefinition | undefined;
3632
3642
  listFormDefinitions(): IFormDefinition[];
3633
3643
  findInterfaceDefinition(name: string): IInterfaceDefinition | undefined;
@@ -5285,6 +5295,7 @@ export declare class SpaghettiScopeNode extends ScopeData implements ISpaghettiS
5285
5295
  setEnd(end: Position): void;
5286
5296
  findDeferred(name: string): Identifier | undefined;
5287
5297
  findClassDefinition(name: string): IClassDefinition | undefined;
5298
+ listClassDefinitions(): IClassDefinition[];
5288
5299
  findFormDefinition(name: string): IFormDefinition | undefined;
5289
5300
  listFormDefinitions(): IFormDefinition[];
5290
5301
  findInterfaceDefinition(name: string): IInterfaceDefinition | undefined;
@@ -266,6 +266,11 @@ class TypeUtils {
266
266
  }
267
267
  return true;
268
268
  }
269
+ else if (source instanceof basic_1.Integer8Type) {
270
+ if (target instanceof basic_1.IntegerType || target instanceof basic_1.StringType) {
271
+ return false;
272
+ }
273
+ }
269
274
  return this.isAssignable(source, target);
270
275
  }
271
276
  isAssignable(source, target) {
@@ -77,6 +77,15 @@ class SpaghettiScopeNode extends ScopeData {
77
77
  }
78
78
  return undefined;
79
79
  }
80
+ listClassDefinitions() {
81
+ let search = this;
82
+ const ret = [];
83
+ while (search !== undefined) {
84
+ ret.push(...Object.values(search.getData().cdefs));
85
+ search = search.getParent();
86
+ }
87
+ return ret;
88
+ }
80
89
  findFormDefinition(name) {
81
90
  let search = this;
82
91
  const upper = name.toUpperCase();
@@ -29,6 +29,7 @@ __exportStar(require("./floating_point_type"), exports);
29
29
  __exportStar(require("./generic_object_reference_type"), exports);
30
30
  __exportStar(require("./hex_type"), exports);
31
31
  __exportStar(require("./integer_type"), exports);
32
+ __exportStar(require("./integer8_type"), exports);
32
33
  __exportStar(require("./numeric_generic_type"), exports);
33
34
  __exportStar(require("./numeric_type"), exports);
34
35
  __exportStar(require("./object_reference_type"), exports);
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Integer8Type = void 0;
4
+ const _abstract_type_1 = require("./_abstract_type");
5
+ class Integer8Type extends _abstract_type_1.AbstractType {
6
+ toText() {
7
+ return "```int8```";
8
+ }
9
+ isGeneric() {
10
+ return false;
11
+ }
12
+ toABAP() {
13
+ return "int8";
14
+ }
15
+ containsVoid() {
16
+ return false;
17
+ }
18
+ toCDS() {
19
+ return "abap.int8";
20
+ }
21
+ }
22
+ exports.Integer8Type = Integer8Type;
23
+ //# sourceMappingURL=integer8_type.js.map
package/build/src/ddic.js CHANGED
@@ -80,8 +80,9 @@ class DDIC {
80
80
  case "CSEQUENCE":
81
81
  return new Types.CSequenceType({ qualifiedName: qualifiedName });
82
82
  case "I":
83
- case "INT8": // todo, take version into account
84
83
  return new Types.IntegerType({ qualifiedName: qualifiedName || name });
84
+ case "INT8": // todo, take version into account
85
+ return new Types.Integer8Type({ qualifiedName: qualifiedName || name });
85
86
  case "F":
86
87
  return new Types.FloatType({ qualifiedName: qualifiedName || name });
87
88
  case "P":
@@ -13,6 +13,7 @@ const _scope_type_1 = require("../abap/5_syntax/_scope_type");
13
13
  const types_1 = require("../abap/types");
14
14
  class LSPLookup {
15
15
  static lookup(cursor, reg, obj) {
16
+ var _a, _b;
16
17
  const inc = this.findInclude(cursor, reg);
17
18
  if (inc) {
18
19
  const found = this.ABAPFileResult(inc);
@@ -82,6 +83,22 @@ class LSPLookup {
82
83
  }
83
84
  return { hover: hoverValue, definition: location, implementation: location, definitionId: variable, scope: bottomScope };
84
85
  }
86
+ for (const c of bottomScope.listClassDefinitions()) {
87
+ for (const m of ((_a = c.getMethodDefinitions()) === null || _a === void 0 ? void 0 : _a.getAll()) || []) {
88
+ for (const p of ((_b = m.getParameters()) === null || _b === void 0 ? void 0 : _b.getAll()) || []) {
89
+ if (p.getStart().equals(cursor.token.getStart())) {
90
+ const found = _lsp_utils_1.LSPUtils.identiferToLocation(p);
91
+ return {
92
+ hover: "Method Parameter, " + cursor.token.getStr(),
93
+ definition: found,
94
+ definitionId: p,
95
+ implementation: undefined,
96
+ scope: bottomScope,
97
+ };
98
+ }
99
+ }
100
+ }
101
+ }
85
102
  const refs = this.searchReferences(bottomScope, cursor.token);
86
103
  if (refs.length > 0) {
87
104
  for (const ref of refs) {
@@ -9,11 +9,13 @@ const _typed_identifier_1 = require("../abap/types/_typed_identifier");
9
9
  const types_1 = require("../abap/types");
10
10
  const references_1 = require("./references");
11
11
  const renamer_1 = require("../objects/rename/renamer");
12
+ const definition_1 = require("./definition");
12
13
  var RenameType;
13
14
  (function (RenameType) {
14
15
  RenameType[RenameType["GlobalClass"] = 1] = "GlobalClass";
15
16
  RenameType[RenameType["Variable"] = 2] = "Variable";
16
17
  RenameType[RenameType["GlobalInterface"] = 3] = "GlobalInterface";
18
+ RenameType[RenameType["Method"] = 4] = "Method";
17
19
  })(RenameType = exports.RenameType || (exports.RenameType = {}));
18
20
  class Rename {
19
21
  constructor(reg) {
@@ -43,6 +45,9 @@ class Rename {
43
45
  else if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof types_1.InterfaceDefinition) {
44
46
  return { range, placeholder: cursor.token.getStr(), type: RenameType.GlobalInterface, file };
45
47
  }
48
+ else if ((lookup === null || lookup === void 0 ? void 0 : lookup.definitionId) instanceof types_1.MethodDefinition) {
49
+ return { range, placeholder: cursor.token.getStr(), type: RenameType.Method, file };
50
+ }
46
51
  return undefined;
47
52
  }
48
53
  rename(params) {
@@ -57,6 +62,8 @@ class Rename {
57
62
  return new renamer_1.Renamer(this.reg).buildEdits("INTF", prepare.placeholder, params.newName);
58
63
  case RenameType.Variable:
59
64
  return this.renameVariable(params);
65
+ case RenameType.Method:
66
+ return this.renameMethod(params);
60
67
  default:
61
68
  return undefined;
62
69
  }
@@ -73,6 +80,23 @@ class Rename {
73
80
  }
74
81
  return workspace;
75
82
  }
83
+ renameMethod(params) {
84
+ var _a, _b;
85
+ const workspace = { documentChanges: [] };
86
+ const refs = new references_1.References(this.reg).references(params);
87
+ for (const r of refs) {
88
+ const doc = { uri: r.uri, version: 1 };
89
+ const edit = LServer.TextDocumentEdit.create(doc, [LServer.TextEdit.replace(r.range, params.newName)]);
90
+ (_a = workspace.documentChanges) === null || _a === void 0 ? void 0 : _a.push(edit);
91
+ }
92
+ const def = new definition_1.Definition(this.reg).find(params.textDocument, params.position);
93
+ if (def) {
94
+ const doc = { uri: params.textDocument.uri, version: 1 };
95
+ const edit = LServer.TextDocumentEdit.create(doc, [LServer.TextEdit.replace(def === null || def === void 0 ? void 0 : def.range, params.newName)]);
96
+ (_b = workspace.documentChanges) === null || _b === void 0 ? void 0 : _b.push(edit);
97
+ }
98
+ return workspace;
99
+ }
76
100
  }
77
101
  exports.Rename = Rename;
78
102
  //# sourceMappingURL=rename.js.map
@@ -65,7 +65,7 @@ class Registry {
65
65
  }
66
66
  static abaplintVersion() {
67
67
  // magic, see build script "version.sh"
68
- return "2.101.8";
68
+ return "2.101.9";
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.101.8",
3
+ "version": "2.101.9",
4
4
  "description": "abaplint - Core API",
5
5
  "main": "build/src/index.js",
6
6
  "typings": "build/abaplint.d.ts",
@@ -48,14 +48,14 @@
48
48
  },
49
49
  "homepage": "https://abaplint.org",
50
50
  "devDependencies": {
51
- "@microsoft/api-extractor": "^7.35.0",
51
+ "@microsoft/api-extractor": "^7.35.1",
52
52
  "@types/chai": "^4.3.5",
53
53
  "@types/mocha": "^10.0.1",
54
54
  "@types/node": "^20.2.5",
55
55
  "chai": "^4.3.7",
56
56
  "eslint": "^8.41.0",
57
57
  "mocha": "^10.2.0",
58
- "c8": "^7.13.0",
58
+ "c8": "^7.14.0",
59
59
  "source-map-support": "^0.5.21",
60
60
  "ts-json-schema-generator": "^1.2.0",
61
61
  "typescript": "^5.0.4"