brighterscript-xml-plugin 0.2.0 → 0.3.0

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/dist/index.js CHANGED
@@ -3,16 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BscXmlPlugin = void 0;
4
4
  const brighterscript_1 = require("brighterscript");
5
5
  const SGXmlCompletionProvider_1 = require("./SGXmlCompletionProvider");
6
- const crypto_1 = require("crypto");
6
+ const SGXmlValidator_1 = require("./SGXmlValidator");
7
7
  class BscXmlPlugin {
8
8
  constructor() {
9
9
  this.name = 'bsc-xml-plugin';
10
- this.id = (0, crypto_1.randomUUID)();
11
- // console.log('creating bsc xml plugin');
12
10
  }
13
- provideCompletions(completionEvent) {
14
- if ((0, brighterscript_1.isXmlFile)(completionEvent.file)) {
15
- return new SGXmlCompletionProvider_1.SGXmlCompletionProvider(completionEvent.program).process(completionEvent);
11
+ getValidator(validateEvent) {
12
+ if (!this.validator) {
13
+ this.validator = new SGXmlValidator_1.SGXmlValidator(validateEvent.program);
14
+ }
15
+ return this.validator;
16
+ }
17
+ getProvider(program) {
18
+ if (!this.provider) {
19
+ this.provider = new SGXmlCompletionProvider_1.SGXmlCompletionProvider(program);
20
+ }
21
+ return this.provider;
22
+ }
23
+ beforeProvideCompletions(event) {
24
+ if ((0, brighterscript_1.isXmlFile)(event.file)) {
25
+ console.log(event.completions);
26
+ this.getProvider(event.program).process(event);
27
+ }
28
+ }
29
+ onFileValidate(event) {
30
+ if ((0, brighterscript_1.isXmlFile)(event.file)) {
31
+ this.getValidator(event).validateXmlFile(event);
16
32
  }
17
33
  }
18
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brighterscript-xml-plugin",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "BrighterScript plugin for SceneGraph XML completions",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  "vscode-languageserver-types": "^3.17.3"
48
48
  },
49
49
  "peerDependencies": {
50
- "brighterscript": "0.65.x"
50
+ "brighterscript": ">= 0.65.0 < 1"
51
51
  },
52
52
  "peerDependenciesMeta": {
53
53
  "brighterscript": {
@@ -1,59 +0,0 @@
1
- "use strict";
2
- /**
3
- * unused, just an export of all types for eventual validation
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SGFieldTypes = void 0;
7
- class SGFieldTypes {
8
- constructor() {
9
- this.typeMap = {
10
- Time: true,
11
- string: true,
12
- float: true,
13
- boolean: true,
14
- 'option string': true,
15
- time: true,
16
- Boolean: true,
17
- integer: true,
18
- 'array of floats': true,
19
- ContentNode: true,
20
- color: true,
21
- uri: true,
22
- rect2d: true,
23
- Float: true,
24
- vector2d: true,
25
- font: true,
26
- 'N/A': true,
27
- 'array of strings': true,
28
- 'Poster node': true,
29
- Font: true,
30
- 'array of Boolean': true,
31
- 'array of colors': true,
32
- ButtonGroup: true,
33
- Event: true,
34
- 'array of integers': true,
35
- 'RSGPalette node': true,
36
- "array of float's": true,
37
- Node: true,
38
- 'option as string': true,
39
- 'array of float': true,
40
- 'URI string': true,
41
- BusySpinner: true,
42
- 'color (string containing hex value e.g. RGBA)': true,
43
- 'array of integer': true,
44
- 'array of vector2d': true,
45
- 'associative array': true,
46
- assocarray: true,
47
- bool: true,
48
- 'associative array of associative arrays': true,
49
- URL: true,
50
- TargetSet: true,
51
- int: true,
52
- 'array of TargetSet nodes': true,
53
- Color: true,
54
- 'array of rectangles': true,
55
- 'roArray of roAssociativeArrays': true,
56
- };
57
- }
58
- }
59
- exports.SGFieldTypes = SGFieldTypes;