brighterscript 1.0.0-alpha.22 → 1.0.0-alpha.24

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.
Files changed (132) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/dist/DiagnosticCollection.d.ts +3 -1
  3. package/dist/DiagnosticCollection.js +3 -5
  4. package/dist/DiagnosticCollection.js.map +1 -1
  5. package/dist/DiagnosticMessages.d.ts +24 -3
  6. package/dist/DiagnosticMessages.js +28 -7
  7. package/dist/DiagnosticMessages.js.map +1 -1
  8. package/dist/LanguageServer.d.ts +2 -1
  9. package/dist/LanguageServer.js +96 -31
  10. package/dist/LanguageServer.js.map +1 -1
  11. package/dist/Program.d.ts +14 -8
  12. package/dist/Program.js +125 -71
  13. package/dist/Program.js.map +1 -1
  14. package/dist/ProgramBuilder.js +2 -1
  15. package/dist/ProgramBuilder.js.map +1 -1
  16. package/dist/Scope.d.ts +23 -15
  17. package/dist/Scope.js +124 -122
  18. package/dist/Scope.js.map +1 -1
  19. package/dist/SymbolTable.d.ts +17 -6
  20. package/dist/SymbolTable.js +38 -9
  21. package/dist/SymbolTable.js.map +1 -1
  22. package/dist/XmlScope.js +3 -2
  23. package/dist/XmlScope.js.map +1 -1
  24. package/dist/astUtils/reflection.d.ts +5 -1
  25. package/dist/astUtils/reflection.js +15 -2
  26. package/dist/astUtils/reflection.js.map +1 -1
  27. package/dist/astUtils/visitors.d.ts +2 -1
  28. package/dist/astUtils/visitors.js.map +1 -1
  29. package/dist/bscPlugin/BscPlugin.d.ts +3 -1
  30. package/dist/bscPlugin/BscPlugin.js +8 -0
  31. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  32. package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +1 -1
  33. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +11 -5
  34. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  35. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +75 -1
  36. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  37. package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +6 -0
  38. package/dist/bscPlugin/completions/CompletionsProcessor.js +53 -0
  39. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
  40. package/dist/bscPlugin/hover/HoverProcessor.d.ts +17 -0
  41. package/dist/bscPlugin/hover/HoverProcessor.js +190 -0
  42. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
  43. package/dist/bscPlugin/hover/HoverProcessor.spec.d.ts +1 -0
  44. package/dist/bscPlugin/hover/HoverProcessor.spec.js +195 -0
  45. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -0
  46. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +8 -1
  47. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +64 -63
  48. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
  49. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +238 -23
  50. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
  51. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.d.ts +7 -1
  52. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +77 -30
  53. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -1
  54. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +14 -1
  55. package/dist/bscPlugin/validation/BrsFileValidator.js +104 -27
  56. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  57. package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +1 -0
  58. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +48 -0
  59. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -0
  60. package/dist/bscPlugin/validation/ScopeValidator.d.ts +24 -3
  61. package/dist/bscPlugin/validation/ScopeValidator.js +251 -44
  62. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
  63. package/dist/cli.js +18 -10
  64. package/dist/cli.js.map +1 -1
  65. package/dist/files/BrsFile.Class.spec.js +135 -38
  66. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  67. package/dist/files/BrsFile.d.ts +21 -10
  68. package/dist/files/BrsFile.js +158 -179
  69. package/dist/files/BrsFile.js.map +1 -1
  70. package/dist/files/BrsFile.spec.js +222 -126
  71. package/dist/files/BrsFile.spec.js.map +1 -1
  72. package/dist/files/XmlFile.d.ts +2 -2
  73. package/dist/files/XmlFile.js +1 -0
  74. package/dist/files/XmlFile.js.map +1 -1
  75. package/dist/files/tests/imports.spec.js +1 -1
  76. package/dist/files/tests/imports.spec.js.map +1 -1
  77. package/dist/files/tests/optionalChaning.spec.js +20 -16
  78. package/dist/files/tests/optionalChaning.spec.js.map +1 -1
  79. package/dist/globalCallables.js +3 -0
  80. package/dist/globalCallables.js.map +1 -1
  81. package/dist/index.d.ts +1 -1
  82. package/dist/index.js +3 -1
  83. package/dist/index.js.map +1 -1
  84. package/dist/interfaces.d.ts +77 -3
  85. package/dist/lexer/Lexer.spec.js +7 -0
  86. package/dist/lexer/Lexer.spec.js.map +1 -1
  87. package/dist/lexer/TokenKind.d.ts +1 -0
  88. package/dist/lexer/TokenKind.js +8 -3
  89. package/dist/lexer/TokenKind.js.map +1 -1
  90. package/dist/parser/Expression.d.ts +12 -3
  91. package/dist/parser/Expression.js +16 -4
  92. package/dist/parser/Expression.js.map +1 -1
  93. package/dist/parser/Parser.Class.spec.js +1 -1
  94. package/dist/parser/Parser.d.ts +14 -3
  95. package/dist/parser/Parser.js +138 -48
  96. package/dist/parser/Parser.js.map +1 -1
  97. package/dist/parser/Parser.spec.js +232 -115
  98. package/dist/parser/Parser.spec.js.map +1 -1
  99. package/dist/parser/Statement.d.ts +41 -7
  100. package/dist/parser/Statement.js +85 -12
  101. package/dist/parser/Statement.js.map +1 -1
  102. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +73 -31
  103. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  104. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +148 -47
  105. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  106. package/dist/parser/tests/expression/TernaryExpression.spec.js +219 -37
  107. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  108. package/dist/parser/tests/statement/ConstStatement.spec.d.ts +1 -0
  109. package/dist/parser/tests/statement/ConstStatement.spec.js +213 -0
  110. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -0
  111. package/dist/parser/tests/statement/Enum.spec.js +56 -8
  112. package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
  113. package/dist/parser/tests/statement/InterfaceStatement.spec.js +16 -2
  114. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
  115. package/dist/parser/tests/statement/PrintStatement.spec.js +72 -57
  116. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  117. package/dist/preprocessor/Manifest.js +2 -2
  118. package/dist/preprocessor/Manifest.js.map +1 -1
  119. package/dist/preprocessor/Preprocessor.js +10 -6
  120. package/dist/preprocessor/Preprocessor.js.map +1 -1
  121. package/dist/roku-types/data.json +1002 -788
  122. package/dist/roku-types/index.d.ts +64 -239
  123. package/dist/types/DynamicType.d.ts +1 -0
  124. package/dist/types/DynamicType.js +1 -0
  125. package/dist/types/DynamicType.js.map +1 -1
  126. package/dist/util.d.ts +57 -16
  127. package/dist/util.js +139 -30
  128. package/dist/util.js.map +1 -1
  129. package/dist/validators/ClassValidator.d.ts +4 -1
  130. package/dist/validators/ClassValidator.js +34 -25
  131. package/dist/validators/ClassValidator.js.map +1 -1
  132. package/package.json +5 -2
@@ -1463,6 +1463,7 @@ export declare const components: {
1463
1463
  roarray: {
1464
1464
  constructors: {
1465
1465
  params: {
1466
+ default: any;
1466
1467
  isRequired: boolean;
1467
1468
  name: string;
1468
1469
  type: string;
@@ -1553,14 +1554,22 @@ export declare const components: {
1553
1554
  url: string;
1554
1555
  };
1555
1556
  robitmap: {
1556
- constructors: {
1557
+ constructors: ({
1557
1558
  params: {
1559
+ default: any;
1558
1560
  isRequired: boolean;
1559
1561
  name: string;
1560
1562
  type: string;
1561
1563
  }[];
1562
1564
  returnType: string;
1563
- }[];
1565
+ } | {
1566
+ params: {
1567
+ isRequired: boolean;
1568
+ name: string;
1569
+ type: string;
1570
+ }[];
1571
+ returnType: string;
1572
+ })[];
1564
1573
  description: string;
1565
1574
  events: any[];
1566
1575
  interfaces: {
@@ -1799,14 +1808,22 @@ export declare const components: {
1799
1808
  url: string;
1800
1809
  };
1801
1810
  rofontmetrics: {
1802
- constructors: {
1811
+ constructors: ({
1803
1812
  params: {
1813
+ default: any;
1804
1814
  isRequired: boolean;
1805
1815
  name: string;
1806
1816
  type: string;
1807
1817
  }[];
1808
1818
  returnType: string;
1809
- }[];
1819
+ } | {
1820
+ params: {
1821
+ isRequired: boolean;
1822
+ name: string;
1823
+ type: string;
1824
+ }[];
1825
+ returnType: string;
1826
+ })[];
1810
1827
  deprecatedDescription: string;
1811
1828
  description: string;
1812
1829
  events: any[];
@@ -2214,6 +2231,7 @@ export declare const components: {
2214
2231
  roregion: {
2215
2232
  constructors: {
2216
2233
  params: {
2234
+ default: any;
2217
2235
  isRequired: boolean;
2218
2236
  name: string;
2219
2237
  type: string;
@@ -2244,14 +2262,22 @@ export declare const components: {
2244
2262
  url: string;
2245
2263
  };
2246
2264
  roregistrysection: {
2247
- constructors: {
2265
+ constructors: ({
2248
2266
  params: {
2267
+ default: any;
2249
2268
  isRequired: boolean;
2250
2269
  name: string;
2251
2270
  type: string;
2252
2271
  }[];
2253
2272
  returnType: string;
2254
- }[];
2273
+ } | {
2274
+ params: {
2275
+ isRequired: boolean;
2276
+ name: string;
2277
+ type: string;
2278
+ }[];
2279
+ returnType: string;
2280
+ })[];
2255
2281
  description: string;
2256
2282
  events: any[];
2257
2283
  interfaces: {
@@ -2807,12 +2833,7 @@ export declare const interfaces: {
2807
2833
  name: string;
2808
2834
  url: string;
2809
2835
  }[];
2810
- methods: ({
2811
- description: string;
2812
- name: string;
2813
- params: any[];
2814
- returnType: string;
2815
- } | {
2836
+ methods: {
2816
2837
  description: string;
2817
2838
  name: string;
2818
2839
  params: {
@@ -2822,8 +2843,8 @@ export declare const interfaces: {
2822
2843
  name: string;
2823
2844
  type: string;
2824
2845
  }[];
2825
- returnType?: undefined;
2826
- })[];
2846
+ returnType: string;
2847
+ }[];
2827
2848
  name: string;
2828
2849
  properties: any[];
2829
2850
  url: string;
@@ -2846,18 +2867,6 @@ export declare const interfaces: {
2846
2867
  }[];
2847
2868
  returnType: string;
2848
2869
  returnDescription?: undefined;
2849
- } | {
2850
- description: string;
2851
- name: string;
2852
- params: {
2853
- default: any;
2854
- description: string;
2855
- isRequired: boolean;
2856
- name: string;
2857
- type: string;
2858
- }[];
2859
- returnType?: undefined;
2860
- returnDescription?: undefined;
2861
2870
  } | {
2862
2871
  description: string;
2863
2872
  name: string;
@@ -2886,8 +2895,8 @@ export declare const interfaces: {
2886
2895
  description: string;
2887
2896
  name: string;
2888
2897
  params: any[];
2898
+ returnType: string;
2889
2899
  returnDescription?: undefined;
2890
- returnType?: undefined;
2891
2900
  } | {
2892
2901
  description: string;
2893
2902
  name: string;
@@ -2975,16 +2984,6 @@ export declare const interfaces: {
2975
2984
  }[];
2976
2985
  returnType: string;
2977
2986
  returnDescription?: undefined;
2978
- } | {
2979
- description: string;
2980
- name: string;
2981
- params: {
2982
- default: any;
2983
- isRequired: boolean;
2984
- name: string;
2985
- }[];
2986
- returnType?: undefined;
2987
- returnDescription?: undefined;
2988
2987
  })[];
2989
2988
  name: string;
2990
2989
  properties: any[];
@@ -3067,36 +3066,6 @@ export declare const interfaces: {
3067
3066
  }[];
3068
3067
  returnDescription: string;
3069
3068
  returnType: string;
3070
- } | {
3071
- description: string;
3072
- name: string;
3073
- params: ({
3074
- default: any;
3075
- description: string;
3076
- isRequired: boolean;
3077
- name: string;
3078
- type: string;
3079
- } | {
3080
- default: any;
3081
- isRequired: boolean;
3082
- name: string;
3083
- description?: undefined;
3084
- type?: undefined;
3085
- })[];
3086
- returnDescription: string;
3087
- returnType?: undefined;
3088
- } | {
3089
- description: string;
3090
- name: string;
3091
- params: {
3092
- default: any;
3093
- description: string;
3094
- isRequired: boolean;
3095
- name: string;
3096
- type: string;
3097
- }[];
3098
- returnDescription?: undefined;
3099
- returnType?: undefined;
3100
3069
  } | {
3101
3070
  description: string;
3102
3071
  name: string;
@@ -3109,16 +3078,6 @@ export declare const interfaces: {
3109
3078
  }[];
3110
3079
  returnType: string;
3111
3080
  returnDescription?: undefined;
3112
- } | {
3113
- description: string;
3114
- name: string;
3115
- params: {
3116
- default: any;
3117
- isRequired: boolean;
3118
- name: string;
3119
- }[];
3120
- returnDescription?: undefined;
3121
- returnType?: undefined;
3122
3081
  })[];
3123
3082
  name: string;
3124
3083
  properties: any[];
@@ -3160,6 +3119,18 @@ export declare const interfaces: {
3160
3119
  }[];
3161
3120
  returnType: string;
3162
3121
  returnDescription?: undefined;
3122
+ } | {
3123
+ description: string;
3124
+ name: string;
3125
+ params: {
3126
+ default: any;
3127
+ description: string;
3128
+ isRequired: boolean;
3129
+ name: string;
3130
+ type: string[];
3131
+ }[];
3132
+ returnType: string;
3133
+ returnDescription?: undefined;
3163
3134
  })[];
3164
3135
  name: string;
3165
3136
  properties: any[];
@@ -3245,18 +3216,6 @@ export declare const interfaces: {
3245
3216
  }[];
3246
3217
  returnType: string;
3247
3218
  returnDescription?: undefined;
3248
- } | {
3249
- description: string;
3250
- name: string;
3251
- params: {
3252
- default: any;
3253
- description: string;
3254
- isRequired: boolean;
3255
- name: string;
3256
- type: string;
3257
- }[];
3258
- returnDescription?: undefined;
3259
- returnType?: undefined;
3260
3219
  } | {
3261
3220
  description: string;
3262
3221
  name: string;
@@ -3361,18 +3320,6 @@ export declare const interfaces: {
3361
3320
  url: string;
3362
3321
  }[];
3363
3322
  methods: ({
3364
- description: string;
3365
- name: string;
3366
- params: {
3367
- default: any;
3368
- isRequired: boolean;
3369
- name: string;
3370
- }[];
3371
- returnDescription: string;
3372
- returnType?: undefined;
3373
- deprecatedDescription?: undefined;
3374
- isDeprecated?: undefined;
3375
- } | {
3376
3323
  description: string;
3377
3324
  name: string;
3378
3325
  params: {
@@ -3386,20 +3333,6 @@ export declare const interfaces: {
3386
3333
  returnType: string;
3387
3334
  deprecatedDescription?: undefined;
3388
3335
  isDeprecated?: undefined;
3389
- } | {
3390
- description: string;
3391
- name: string;
3392
- params: {
3393
- default: any;
3394
- description: string;
3395
- isRequired: boolean;
3396
- name: string;
3397
- type: string;
3398
- }[];
3399
- returnDescription: string;
3400
- returnType?: undefined;
3401
- deprecatedDescription?: undefined;
3402
- isDeprecated?: undefined;
3403
3336
  } | {
3404
3337
  description: string;
3405
3338
  name: string;
@@ -3996,21 +3929,16 @@ export declare const interfaces: {
3996
3929
  url: string;
3997
3930
  }[];
3998
3931
  methods: ({
3999
- description: string;
4000
- name: string;
4001
- params: any[];
4002
- returnDescription: string;
4003
- returnType: string;
4004
- } | {
4005
3932
  description: string;
4006
3933
  name: string;
4007
3934
  params: {
4008
3935
  default: any;
4009
3936
  isRequired: boolean;
4010
3937
  name: string;
3938
+ type: string;
4011
3939
  }[];
4012
3940
  returnDescription: string;
4013
- returnType?: undefined;
3941
+ returnType: string;
4014
3942
  } | {
4015
3943
  description: string;
4016
3944
  name: string;
@@ -4755,6 +4683,17 @@ export declare const interfaces: {
4755
4683
  }[];
4756
4684
  returnDescription: string;
4757
4685
  returnType: string;
4686
+ } | {
4687
+ description: string;
4688
+ name: string;
4689
+ params: {
4690
+ default: any;
4691
+ isRequired: boolean;
4692
+ name: string;
4693
+ type: string;
4694
+ }[];
4695
+ returnDescription: string;
4696
+ returnType: string;
4758
4697
  })[];
4759
4698
  name: string;
4760
4699
  properties: any[];
@@ -4949,16 +4888,6 @@ export declare const interfaces: {
4949
4888
  url: string;
4950
4889
  }[];
4951
4890
  methods: ({
4952
- description: string;
4953
- name: string;
4954
- params: {
4955
- default: any;
4956
- isRequired: boolean;
4957
- name: string;
4958
- }[];
4959
- returnDescription: string;
4960
- returnType?: undefined;
4961
- } | {
4962
4891
  description: string;
4963
4892
  name: string;
4964
4893
  params: {
@@ -5046,18 +4975,6 @@ export declare const interfaces: {
5046
4975
  }[];
5047
4976
  returnDescription: string;
5048
4977
  returnType: string;
5049
- } | {
5050
- description: string;
5051
- name: string;
5052
- params: {
5053
- default: any;
5054
- description: string;
5055
- isRequired: boolean;
5056
- name: string;
5057
- type: string;
5058
- }[];
5059
- returnDescription: string;
5060
- returnType?: undefined;
5061
4978
  } | {
5062
4979
  description: string;
5063
4980
  name: string;
@@ -5115,12 +5032,14 @@ export declare const interfaces: {
5115
5032
  name: string;
5116
5033
  params: {
5117
5034
  default: any;
5035
+ description: string;
5118
5036
  isRequired: boolean;
5119
5037
  name: string;
5038
+ type: string;
5120
5039
  }[];
5121
5040
  returnDescription: string;
5041
+ returnType: string;
5122
5042
  description?: undefined;
5123
- returnType?: undefined;
5124
5043
  })[];
5125
5044
  name: string;
5126
5045
  properties: any[];
@@ -5638,26 +5557,6 @@ export declare const interfaces: {
5638
5557
  }[];
5639
5558
  returnDescription: string;
5640
5559
  returnType: string;
5641
- } | {
5642
- description: string;
5643
- name: string;
5644
- params: {
5645
- default: any;
5646
- isRequired: boolean;
5647
- name: string;
5648
- }[];
5649
- returnDescription: string;
5650
- returnType?: undefined;
5651
- } | {
5652
- description: string;
5653
- name: string;
5654
- params: {
5655
- default: any;
5656
- isRequired: boolean;
5657
- name: string;
5658
- }[];
5659
- returnType?: undefined;
5660
- returnDescription?: undefined;
5661
5560
  })[];
5662
5561
  name: string;
5663
5562
  properties: any[];
@@ -5908,32 +5807,6 @@ export declare const interfaces: {
5908
5807
  returnDescription?: undefined;
5909
5808
  deprecatedDescription?: undefined;
5910
5809
  isDeprecated?: undefined;
5911
- } | {
5912
- description: string;
5913
- name: string;
5914
- params: {
5915
- default: any;
5916
- isRequired: boolean;
5917
- name: string;
5918
- }[];
5919
- returnDescription: string;
5920
- returnType?: undefined;
5921
- deprecatedDescription?: undefined;
5922
- isDeprecated?: undefined;
5923
- } | {
5924
- description: string;
5925
- name: string;
5926
- params: {
5927
- default: any;
5928
- description: string;
5929
- isRequired: boolean;
5930
- name: string;
5931
- type: string;
5932
- }[];
5933
- returnType?: undefined;
5934
- returnDescription?: undefined;
5935
- deprecatedDescription?: undefined;
5936
- isDeprecated?: undefined;
5937
5810
  } | {
5938
5811
  deprecatedDescription: string;
5939
5812
  description: string;
@@ -5993,18 +5866,6 @@ export declare const interfaces: {
5993
5866
  returnType: string;
5994
5867
  description?: undefined;
5995
5868
  returnDescription?: undefined;
5996
- } | {
5997
- description: string;
5998
- name: string;
5999
- params: {
6000
- default: any;
6001
- isRequired: boolean;
6002
- name: string;
6003
- }[];
6004
- returnType?: undefined;
6005
- returnDescription?: undefined;
6006
- deprecatedDescription?: undefined;
6007
- isDeprecated?: undefined;
6008
5869
  })[];
6009
5870
  name: string;
6010
5871
  properties: any[];
@@ -6041,18 +5902,6 @@ export declare const interfaces: {
6041
5902
  returnDescription?: undefined;
6042
5903
  deprecatedDescription?: undefined;
6043
5904
  isDeprecated?: undefined;
6044
- } | {
6045
- description: string;
6046
- name: string;
6047
- params: {
6048
- default: any;
6049
- isRequired: boolean;
6050
- name: string;
6051
- }[];
6052
- returnType?: undefined;
6053
- returnDescription?: undefined;
6054
- deprecatedDescription?: undefined;
6055
- isDeprecated?: undefined;
6056
5905
  } | {
6057
5906
  description: string;
6058
5907
  name: string;
@@ -6067,20 +5916,6 @@ export declare const interfaces: {
6067
5916
  returnType: string;
6068
5917
  deprecatedDescription?: undefined;
6069
5918
  isDeprecated?: undefined;
6070
- } | {
6071
- description: string;
6072
- name: string;
6073
- params: {
6074
- default: any;
6075
- description: string;
6076
- isRequired: boolean;
6077
- name: string;
6078
- type: string;
6079
- }[];
6080
- returnType?: undefined;
6081
- returnDescription?: undefined;
6082
- deprecatedDescription?: undefined;
6083
- isDeprecated?: undefined;
6084
5919
  } | {
6085
5920
  deprecatedDescription: string;
6086
5921
  isDeprecated: boolean;
@@ -6129,16 +5964,6 @@ export declare const interfaces: {
6129
5964
  }[];
6130
5965
  returnDescription: string;
6131
5966
  returnType: string;
6132
- } | {
6133
- description: string;
6134
- name: string;
6135
- params: {
6136
- default: any;
6137
- isRequired: boolean;
6138
- name: string;
6139
- }[];
6140
- returnDescription: string;
6141
- returnType?: undefined;
6142
5967
  } | {
6143
5968
  name: string;
6144
5969
  params: {
@@ -2,6 +2,7 @@ import type { BscType } from './BscType';
2
2
  export declare class DynamicType implements BscType {
3
3
  typeText?: string;
4
4
  constructor(typeText?: string);
5
+ static readonly instance: DynamicType;
5
6
  isAssignableTo(targetType: BscType): boolean;
6
7
  /**
7
8
  * The dynamic type is convertible to everything.
@@ -30,4 +30,5 @@ class DynamicType {
30
30
  }
31
31
  }
32
32
  exports.DynamicType = DynamicType;
33
+ DynamicType.instance = new DynamicType();
33
34
  //# sourceMappingURL=DynamicType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DynamicType.js","sourceRoot":"","sources":["../../src/types/DynamicType.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAGvD,MAAa,WAAW;IACpB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAEE,cAAc,CAAC,UAAmB;QACrC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,UAAmB;QACtC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,SAAS,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,0BAAa,EAAC,UAAU,CAAC,CAAC;IACrC,CAAC;CACJ;AA9BD,kCA8BC"}
1
+ {"version":3,"file":"DynamicType.js","sourceRoot":"","sources":["../../src/types/DynamicType.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AAGvD,MAAa,WAAW;IACpB,YACW,QAAiB;QAAjB,aAAQ,GAAR,QAAQ,CAAS;IACxB,CAAC;IAIE,cAAc,CAAC,UAAmB;QACrC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,eAAe,CAAC,UAAmB;QACtC,2EAA2E;QAC3E,OAAO,CAAC,CAAC,UAAU,CAAC;IACxB,CAAC;IAEM,QAAQ;;QACX,OAAO,MAAA,IAAI,CAAC,QAAQ,mCAAI,SAAS,CAAC;IACtC,CAAC;IAEM,YAAY;QACf,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;IAEM,MAAM,CAAC,UAAmB;QAC7B,OAAO,IAAA,0BAAa,EAAC,UAAU,CAAC,CAAC;IACrC,CAAC;;AA/BL,kCAgCC;AA3B0B,oBAAQ,GAAG,IAAI,WAAW,EAAE,CAAC"}
package/dist/util.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Diagnostic, Position, Range } from 'vscode-languageserver';
1
+ import type { Diagnostic, Position, Range, Location } from 'vscode-languageserver';
2
2
  import type { BsConfig } from './BsConfig';
3
- import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, FunctionCall, CallableParam, TranspileResult } from './interfaces';
3
+ import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, FunctionCall, CallableParam, TranspileResult, MinMax } from './interfaces';
4
4
  import { BooleanType } from './types/BooleanType';
5
5
  import { DoubleType } from './types/DoubleType';
6
6
  import { DynamicType } from './types/DynamicType';
@@ -11,13 +11,20 @@ import { LongIntegerType } from './types/LongIntegerType';
11
11
  import { StringType } from './types/StringType';
12
12
  import { VoidType } from './types/VoidType';
13
13
  import type { DottedGetExpression, Expression, NamespacedVariableNameExpression, VariableExpression } from './parser/Expression';
14
- import type { Locatable, Token } from './lexer/Token';
14
+ import type { Identifier, Locatable, Token } from './lexer/Token';
15
15
  import { SourceNode } from 'source-map';
16
16
  import { SGAttribute } from './parser/SGTypes';
17
- import type { BscType } from './types/BscType';
17
+ import type { BrsFile } from './files/BrsFile';
18
+ import type { XmlFile } from './files/XmlFile';
18
19
  import { FunctionType } from './types/FunctionType';
20
+ import type { BscType } from './types/BscType';
19
21
  export declare class Util {
20
22
  clearConsole(): void;
23
+ /**
24
+ * Returns the number of parent directories in the filPath
25
+ * @param filePath
26
+ */
27
+ getParentDirectoryCount(filePath: string | undefined): number;
21
28
  /**
22
29
  * Determine if the file exists
23
30
  * @param filePath
@@ -122,9 +129,25 @@ export declare class Util {
122
129
  */
123
130
  findBeginningVariableExpression(dottedGet: DottedGetExpression): VariableExpression | undefined;
124
131
  /**
125
- * Does a touch b in any way?
132
+ * Do `a` and `b` overlap by at least one character. This returns false if they are at the edges. Here's some examples:
133
+ * ```
134
+ * | true | true | true | true | true | false | false | false | false |
135
+ * |------|------|------|------|------|-------|-------|-------|-------|
136
+ * | aa | aaa | aaa | aaa | a | aa | aa | a | a |
137
+ * | bbb | bb | bbb | b | bbb | bb | bb | b | a |
138
+ * ```
126
139
  */
127
140
  rangesIntersect(a: Range, b: Range): boolean;
141
+ /**
142
+ * Do `a` and `b` overlap by at least one character or touch at the edges
143
+ * ```
144
+ * | true | true | true | true | true | true | true | false | false |
145
+ * |------|------|------|------|------|-------|-------|-------|-------|
146
+ * | aa | aaa | aaa | aaa | a | aa | aa | a | a |
147
+ * | bbb | bb | bbb | b | bbb | bb | bb | b | a |
148
+ * ```
149
+ */
150
+ rangesIntersectOrTouch(a: Range, b: Range): boolean;
128
151
  /**
129
152
  * Test if `position` is in `range`. If the position is at the edges, will return true.
130
153
  * Adapted from core vscode
@@ -133,6 +156,13 @@ export declare class Util {
133
156
  */
134
157
  rangeContains(range: Range, position: Position): boolean;
135
158
  comparePositionToRange(position: Position, range: Range): 1 | -1 | 0;
159
+ /**
160
+ * Test if `insideRange` is wholly in `range` - the start and end of `insideRange` must be contained in `range`
161
+ * Adapted from core vscode
162
+ * @param range
163
+ * @param insideRange
164
+ */
165
+ rangeContainsRange(range: Range, insideRange: Range): boolean;
136
166
  /**
137
167
  * Parse an xml file and get back a javascript object containing its results
138
168
  * @param text
@@ -248,7 +278,11 @@ export declare class Util {
248
278
  splitIntoLines(string: string): string[];
249
279
  getTextForRange(string: string | string[], range: Range): string;
250
280
  /**
251
- * Helper for creating `Range` objects. Prefer using this function because vscode-languageserver's `util.createRange()` is significantly slower
281
+ * Helper for creating `Location` objects. Prefer using this function because vscode-languageserver's `Location.create()` is significantly slower at scale
282
+ */
283
+ createLocation(uri: string, range: Range): Location;
284
+ /**
285
+ * Helper for creating `Range` objects. Prefer using this function because vscode-languageserver's `Range.create()` is significantly slower
252
286
  */
253
287
  createRange(startLine: number, startCharacter: number, endLine: number, endCharacter: number): Range;
254
288
  /**
@@ -286,7 +320,6 @@ export declare class Util {
286
320
  * Load and return the list of plugins
287
321
  */
288
322
  loadPlugins(cwd: string, pathOrModules: string[], onError?: (pathOrModule: string, err: Error) => void): CompilerPlugin[];
289
- resolveRequire(cwd: string, pathOrModule: string): any;
290
323
  /**
291
324
  * Gathers expressions, variables, and unique names from an expression.
292
325
  * This is mostly used for the ternary expression
@@ -320,14 +353,16 @@ export declare class Util {
320
353
  */
321
354
  copyBslibToStaging(stagingDir: string): Promise<void>;
322
355
  /**
323
- * Given a Diagnostic or BsDiagnostic, return a copy of the diagnostic
356
+ * Given a Diagnostic or BsDiagnostic, return a deep clone of the diagnostic.
357
+ * @param diagnostic the diagnostic to clone
358
+ * @param relatedInformationFallbackLocation a default location to use for all `relatedInformation` entries that are missing a location
324
359
  */
325
- toDiagnostic(diagnostic: Diagnostic | BsDiagnostic): {
360
+ toDiagnostic(diagnostic: Diagnostic | BsDiagnostic, fileUri: string): {
326
361
  severity: import("vscode-languageserver-types").DiagnosticSeverity;
327
362
  range: Range;
328
363
  message: string;
329
364
  relatedInformation: {
330
- location: import("vscode-languageserver-types").Location;
365
+ location: Location;
331
366
  message: string;
332
367
  }[];
333
368
  code: string | number;
@@ -354,10 +389,15 @@ export declare class Util {
354
389
  * @return an array with callable containers - could be empty if nothing was found
355
390
  */
356
391
  getCallableContainersByName(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer[];
392
+ /**
393
+ * Get the first locatable item found at the specified position
394
+ * @param position
395
+ */
396
+ getFirstLocatableAt(locatables: Locatable[], position: Position): Locatable;
357
397
  /**
358
398
  * Sort an array of objects that have a Range
359
399
  */
360
- sortByRange(locatables: Locatable[]): Locatable[];
400
+ sortByRange<T extends Locatable>(locatables: T[]): T[];
361
401
  /**
362
402
  * Split the given text and return ranges for each chunk.
363
403
  * Only works for single-line strings
@@ -379,7 +419,11 @@ export declare class Util {
379
419
  * @param expression
380
420
  * @returns an array of the parts of the dotted get. If not fully a dotted get, then returns undefined
381
421
  */
382
- getAllDottedGetParts(expression: Expression): string[] | undefined;
422
+ getAllDottedGetParts(expression: Expression): Identifier[] | undefined;
423
+ /**
424
+ * Break an expression into each part.
425
+ */
426
+ splitExpression(expression: Expression): Expression[];
383
427
  /**
384
428
  * Returns an integer if valid, or undefined. Eliminates checking for NaN
385
429
  */
@@ -388,6 +432,7 @@ export declare class Util {
388
432
  * Converts a range to a string in the format 1:2-3:4
389
433
  */
390
434
  rangeToString(range: Range): string;
435
+ validateTooDeepFile(file: (BrsFile | XmlFile)): void;
391
436
  }
392
437
  /**
393
438
  * A tagged template literal function for standardizing the path. This has to be defined as standalone function since it's a tagged template literal function,
@@ -396,8 +441,4 @@ export declare class Util {
396
441
  export declare function standardizePath(stringParts: any, ...expressions: any[]): string;
397
442
  export declare let util: Util;
398
443
  export default util;
399
- export interface MinMax {
400
- min: number;
401
- max: number;
402
- }
403
444
  export declare const MAX_PARAM_COUNT = 32;