brighterscript 1.0.0-alpha.24 → 1.0.0-alpha.26

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 (536) hide show
  1. package/CHANGELOG.md +521 -233
  2. package/README.md +45 -139
  3. package/bsconfig.schema.json +46 -0
  4. package/dist/ActionPipeline.d.ts +10 -0
  5. package/dist/ActionPipeline.js +40 -0
  6. package/dist/ActionPipeline.js.map +1 -0
  7. package/dist/AstValidationSegmenter.d.ts +25 -0
  8. package/dist/AstValidationSegmenter.js +152 -0
  9. package/dist/AstValidationSegmenter.js.map +1 -0
  10. package/dist/BsConfig.d.ts +40 -4
  11. package/dist/BusyStatusTracker.d.ts +31 -0
  12. package/dist/BusyStatusTracker.js +83 -0
  13. package/dist/BusyStatusTracker.js.map +1 -0
  14. package/dist/Cache.js +3 -3
  15. package/dist/Cache.js.map +1 -1
  16. package/dist/CacheVerifier.d.ts +7 -0
  17. package/dist/CacheVerifier.js +20 -0
  18. package/dist/CacheVerifier.js.map +1 -0
  19. package/dist/CodeActionUtil.d.ts +3 -3
  20. package/dist/CodeActionUtil.js.map +1 -1
  21. package/dist/CommentFlagProcessor.d.ts +3 -2
  22. package/dist/CommentFlagProcessor.js +5 -4
  23. package/dist/CommentFlagProcessor.js.map +1 -1
  24. package/dist/DependencyGraph.d.ts +3 -2
  25. package/dist/DependencyGraph.js +11 -10
  26. package/dist/DependencyGraph.js.map +1 -1
  27. package/dist/DiagnosticCollection.js +9 -5
  28. package/dist/DiagnosticCollection.js.map +1 -1
  29. package/dist/DiagnosticFilterer.d.ts +1 -0
  30. package/dist/DiagnosticFilterer.js +5 -3
  31. package/dist/DiagnosticFilterer.js.map +1 -1
  32. package/dist/DiagnosticMessages.d.ts +61 -13
  33. package/dist/DiagnosticMessages.js +116 -19
  34. package/dist/DiagnosticMessages.js.map +1 -1
  35. package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
  36. package/dist/DiagnosticSeverityAdjuster.js +41 -0
  37. package/dist/DiagnosticSeverityAdjuster.js.map +1 -0
  38. package/dist/FunctionScope.d.ts +28 -0
  39. package/dist/FunctionScope.js +52 -0
  40. package/dist/FunctionScope.js.map +1 -0
  41. package/dist/KeyedThrottler.d.ts +3 -3
  42. package/dist/KeyedThrottler.js +3 -3
  43. package/dist/KeyedThrottler.js.map +1 -1
  44. package/dist/LanguageServer.d.ts +23 -11
  45. package/dist/LanguageServer.js +150 -69
  46. package/dist/LanguageServer.js.map +1 -1
  47. package/dist/Logger.d.ts +3 -2
  48. package/dist/Logger.js +11 -3
  49. package/dist/Logger.js.map +1 -1
  50. package/dist/PluginInterface.d.ts +21 -3
  51. package/dist/PluginInterface.js +74 -6
  52. package/dist/PluginInterface.js.map +1 -1
  53. package/dist/Program.d.ts +158 -79
  54. package/dist/Program.js +841 -706
  55. package/dist/Program.js.map +1 -1
  56. package/dist/ProgramBuilder.d.ts +22 -12
  57. package/dist/ProgramBuilder.js +130 -103
  58. package/dist/ProgramBuilder.js.map +1 -1
  59. package/dist/Scope.d.ts +86 -137
  60. package/dist/Scope.js +453 -519
  61. package/dist/Scope.js.map +1 -1
  62. package/dist/Stopwatch.js +1 -1
  63. package/dist/Stopwatch.js.map +1 -1
  64. package/dist/SymbolTable.d.ts +89 -34
  65. package/dist/SymbolTable.js +239 -114
  66. package/dist/SymbolTable.js.map +1 -1
  67. package/dist/Throttler.d.ts +12 -0
  68. package/dist/Throttler.js +39 -0
  69. package/dist/Throttler.js.map +1 -1
  70. package/dist/Watcher.d.ts +0 -3
  71. package/dist/Watcher.js +0 -3
  72. package/dist/Watcher.js.map +1 -1
  73. package/dist/XmlScope.d.ts +4 -11
  74. package/dist/XmlScope.js +75 -88
  75. package/dist/XmlScope.js.map +1 -1
  76. package/dist/astUtils/CachedLookups.d.ts +48 -0
  77. package/dist/astUtils/CachedLookups.js +323 -0
  78. package/dist/astUtils/CachedLookups.js.map +1 -0
  79. package/dist/astUtils/{AstEditor.d.ts → Editor.d.ts} +9 -5
  80. package/dist/astUtils/{AstEditor.js → Editor.js} +10 -4
  81. package/dist/astUtils/Editor.js.map +1 -0
  82. package/dist/astUtils/{AstEditor.spec.js → Editor.spec.js} +69 -65
  83. package/dist/astUtils/Editor.spec.js.map +1 -0
  84. package/dist/astUtils/creators.d.ts +10 -10
  85. package/dist/astUtils/creators.js +54 -24
  86. package/dist/astUtils/creators.js.map +1 -1
  87. package/dist/astUtils/creators.spec.js +5 -5
  88. package/dist/astUtils/creators.spec.js.map +1 -1
  89. package/dist/astUtils/reflection.d.ts +132 -104
  90. package/dist/astUtils/reflection.js +220 -174
  91. package/dist/astUtils/reflection.js.map +1 -1
  92. package/dist/astUtils/reflection.spec.js +256 -157
  93. package/dist/astUtils/reflection.spec.js.map +1 -1
  94. package/dist/astUtils/stackedVisitor.spec.js +12 -12
  95. package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
  96. package/dist/astUtils/visitors.d.ts +53 -35
  97. package/dist/astUtils/visitors.js +29 -3
  98. package/dist/astUtils/visitors.js.map +1 -1
  99. package/dist/astUtils/visitors.spec.js +208 -52
  100. package/dist/astUtils/visitors.spec.js.map +1 -1
  101. package/dist/astUtils/xml.d.ts +9 -9
  102. package/dist/astUtils/xml.js +9 -9
  103. package/dist/astUtils/xml.js.map +1 -1
  104. package/dist/bscPlugin/BscPlugin.d.ts +11 -2
  105. package/dist/bscPlugin/BscPlugin.js +37 -3
  106. package/dist/bscPlugin/BscPlugin.js.map +1 -1
  107. package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
  108. package/dist/bscPlugin/CallExpressionInfo.js +131 -0
  109. package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
  110. package/dist/bscPlugin/FileWriter.d.ts +6 -0
  111. package/dist/bscPlugin/FileWriter.js +24 -0
  112. package/dist/bscPlugin/FileWriter.js.map +1 -0
  113. package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
  114. package/dist/bscPlugin/SignatureHelpUtil.js +136 -0
  115. package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
  116. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +16 -13
  117. package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
  118. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +16 -16
  119. package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
  120. package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +52 -1
  121. package/dist/bscPlugin/completions/CompletionsProcessor.js +517 -26
  122. package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
  123. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +1909 -0
  124. package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
  125. package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
  126. package/dist/bscPlugin/definition/DefinitionProvider.js +210 -0
  127. package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -0
  128. package/dist/bscPlugin/definition/DefinitionProvider.spec.js +88 -0
  129. package/dist/bscPlugin/definition/DefinitionProvider.spec.js.map +1 -0
  130. package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
  131. package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
  132. package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
  133. package/dist/bscPlugin/hover/HoverProcessor.d.ts +7 -7
  134. package/dist/bscPlugin/hover/HoverProcessor.js +123 -125
  135. package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
  136. package/dist/bscPlugin/hover/HoverProcessor.spec.js +371 -53
  137. package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -1
  138. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +2 -1
  139. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +83 -23
  140. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
  141. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +83 -6
  142. package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
  143. package/dist/bscPlugin/serialize/BslibInjector.spec.d.ts +1 -0
  144. package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
  145. package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
  146. package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
  147. package/dist/bscPlugin/serialize/BslibManager.js +40 -0
  148. package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
  149. package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
  150. package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
  151. package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
  152. package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.d.ts → BrsFileTranspileProcessor.d.ts} +4 -2
  153. package/dist/bscPlugin/transpile/{BrsFilePreTranspileProcessor.js → BrsFileTranspileProcessor.js} +38 -12
  154. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
  155. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
  156. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
  157. package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
  158. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +12 -0
  159. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +99 -0
  160. package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
  161. package/dist/bscPlugin/validation/BrsFileValidator.d.ts +13 -5
  162. package/dist/bscPlugin/validation/BrsFileValidator.js +262 -52
  163. package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
  164. package/dist/bscPlugin/validation/BrsFileValidator.spec.js +230 -14
  165. package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -1
  166. package/dist/bscPlugin/validation/ProgramValidator.d.ts +10 -0
  167. package/dist/bscPlugin/validation/ProgramValidator.js +32 -0
  168. package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
  169. package/dist/bscPlugin/validation/ScopeValidator.d.ts +58 -27
  170. package/dist/bscPlugin/validation/ScopeValidator.js +514 -286
  171. package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
  172. package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
  173. package/dist/bscPlugin/validation/ScopeValidator.spec.js +2527 -0
  174. package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
  175. package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
  176. package/dist/bscPlugin/validation/XmlFileValidator.js +44 -0
  177. package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
  178. package/dist/cli.js +104 -13
  179. package/dist/cli.js.map +1 -1
  180. package/dist/deferred.d.ts +3 -3
  181. package/dist/deferred.js.map +1 -1
  182. package/dist/diagnosticUtils.d.ts +8 -2
  183. package/dist/diagnosticUtils.js +47 -17
  184. package/dist/diagnosticUtils.js.map +1 -1
  185. package/dist/examples/plugins/removePrint.js +8 -10
  186. package/dist/examples/plugins/removePrint.js.map +1 -1
  187. package/dist/files/AssetFile.d.ts +26 -0
  188. package/dist/files/AssetFile.js +26 -0
  189. package/dist/files/AssetFile.js.map +1 -0
  190. package/dist/files/BrsFile.Class.spec.js +523 -493
  191. package/dist/files/BrsFile.Class.spec.js.map +1 -1
  192. package/dist/files/BrsFile.d.ts +111 -117
  193. package/dist/files/BrsFile.js +684 -1142
  194. package/dist/files/BrsFile.js.map +1 -1
  195. package/dist/files/BrsFile.spec.js +1783 -1233
  196. package/dist/files/BrsFile.spec.js.map +1 -1
  197. package/dist/files/BscFile.d.ts +104 -0
  198. package/dist/files/BscFile.js +16 -0
  199. package/dist/files/BscFile.js.map +1 -0
  200. package/dist/files/Factory.d.ts +25 -0
  201. package/dist/files/Factory.js +22 -0
  202. package/dist/files/Factory.js.map +1 -0
  203. package/dist/files/LazyFileData.d.ts +20 -0
  204. package/dist/files/LazyFileData.js +54 -0
  205. package/dist/files/LazyFileData.js.map +1 -0
  206. package/dist/files/LazyFileData.spec.d.ts +1 -0
  207. package/dist/files/LazyFileData.spec.js +27 -0
  208. package/dist/files/LazyFileData.spec.js.map +1 -0
  209. package/dist/files/XmlFile.d.ts +70 -32
  210. package/dist/files/XmlFile.js +106 -118
  211. package/dist/files/XmlFile.js.map +1 -1
  212. package/dist/files/XmlFile.spec.js +325 -262
  213. package/dist/files/XmlFile.spec.js.map +1 -1
  214. package/dist/files/tests/imports.spec.js +48 -40
  215. package/dist/files/tests/imports.spec.js.map +1 -1
  216. package/dist/files/tests/optionalChaning.spec.js +84 -24
  217. package/dist/files/tests/optionalChaning.spec.js.map +1 -1
  218. package/dist/globalCallables.js +16 -21
  219. package/dist/globalCallables.js.map +1 -1
  220. package/dist/index.d.ts +12 -1
  221. package/dist/index.js +12 -1
  222. package/dist/index.js.map +1 -1
  223. package/dist/interfaces.d.ts +421 -162
  224. package/dist/interfaces.js +27 -0
  225. package/dist/interfaces.js.map +1 -1
  226. package/dist/lexer/Character.spec.js +5 -5
  227. package/dist/lexer/Character.spec.js.map +1 -1
  228. package/dist/lexer/Lexer.d.ts +12 -5
  229. package/dist/lexer/Lexer.js +28 -13
  230. package/dist/lexer/Lexer.js.map +1 -1
  231. package/dist/lexer/Lexer.spec.js +181 -135
  232. package/dist/lexer/Lexer.spec.js.map +1 -1
  233. package/dist/lexer/Token.d.ts +9 -1
  234. package/dist/lexer/Token.js +9 -1
  235. package/dist/lexer/Token.js.map +1 -1
  236. package/dist/lexer/TokenKind.d.ts +8 -0
  237. package/dist/lexer/TokenKind.js +24 -4
  238. package/dist/lexer/TokenKind.js.map +1 -1
  239. package/dist/parser/AstNode.d.ts +162 -0
  240. package/dist/parser/AstNode.js +225 -0
  241. package/dist/parser/AstNode.js.map +1 -0
  242. package/dist/parser/AstNode.spec.d.ts +1 -0
  243. package/dist/parser/AstNode.spec.js +165 -0
  244. package/dist/parser/AstNode.spec.js.map +1 -0
  245. package/dist/parser/BrsTranspileState.d.ts +4 -7
  246. package/dist/parser/BrsTranspileState.js +4 -12
  247. package/dist/parser/BrsTranspileState.js.map +1 -1
  248. package/dist/parser/Expression.d.ts +376 -283
  249. package/dist/parser/Expression.js +742 -585
  250. package/dist/parser/Expression.js.map +1 -1
  251. package/dist/parser/Parser.Class.spec.js +151 -145
  252. package/dist/parser/Parser.Class.spec.js.map +1 -1
  253. package/dist/parser/Parser.d.ts +48 -201
  254. package/dist/parser/Parser.js +705 -1026
  255. package/dist/parser/Parser.js.map +1 -1
  256. package/dist/parser/Parser.spec.d.ts +3 -1
  257. package/dist/parser/Parser.spec.js +861 -848
  258. package/dist/parser/Parser.spec.js.map +1 -1
  259. package/dist/parser/SGParser.d.ts +9 -8
  260. package/dist/parser/SGParser.js +10 -8
  261. package/dist/parser/SGParser.js.map +1 -1
  262. package/dist/parser/SGParser.spec.js +27 -38
  263. package/dist/parser/SGParser.spec.js.map +1 -1
  264. package/dist/parser/SGTypes.d.ts +98 -35
  265. package/dist/parser/SGTypes.js +169 -99
  266. package/dist/parser/SGTypes.js.map +1 -1
  267. package/dist/parser/Statement.d.ts +468 -272
  268. package/dist/parser/Statement.js +904 -631
  269. package/dist/parser/Statement.js.map +1 -1
  270. package/dist/parser/Statement.spec.js +47 -23
  271. package/dist/parser/Statement.spec.js.map +1 -1
  272. package/dist/parser/TranspileState.d.ts +1 -1
  273. package/dist/parser/TranspileState.js +7 -12
  274. package/dist/parser/TranspileState.js.map +1 -1
  275. package/dist/parser/tests/Parser.spec.js +3 -2
  276. package/dist/parser/tests/Parser.spec.js.map +1 -1
  277. package/dist/parser/tests/controlFlow/For.spec.js +33 -23
  278. package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
  279. package/dist/parser/tests/controlFlow/ForEach.spec.js +25 -20
  280. package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
  281. package/dist/parser/tests/controlFlow/If.spec.js +96 -94
  282. package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
  283. package/dist/parser/tests/controlFlow/While.spec.js +22 -16
  284. package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
  285. package/dist/parser/tests/expression/Additive.spec.js +8 -8
  286. package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
  287. package/dist/parser/tests/expression/ArrayLiterals.spec.js +58 -21
  288. package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
  289. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +62 -21
  290. package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
  291. package/dist/parser/tests/expression/Boolean.spec.js +8 -8
  292. package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
  293. package/dist/parser/tests/expression/Call.spec.js +129 -21
  294. package/dist/parser/tests/expression/Call.spec.js.map +1 -1
  295. package/dist/parser/tests/expression/Exponential.spec.js +5 -5
  296. package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
  297. package/dist/parser/tests/expression/Function.spec.js +36 -36
  298. package/dist/parser/tests/expression/Function.spec.js.map +1 -1
  299. package/dist/parser/tests/expression/Indexing.spec.js +92 -22
  300. package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
  301. package/dist/parser/tests/expression/Multiplicative.spec.js +9 -9
  302. package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
  303. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +59 -59
  304. package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
  305. package/dist/parser/tests/expression/PrefixUnary.spec.js +12 -12
  306. package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
  307. package/dist/parser/tests/expression/Primary.spec.js +12 -12
  308. package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
  309. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +10 -10
  310. package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -1
  311. package/dist/parser/tests/expression/Relational.spec.js +13 -13
  312. package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
  313. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +24 -24
  314. package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
  315. package/dist/parser/tests/expression/TemplateStringExpression.spec.js +96 -57
  316. package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
  317. package/dist/parser/tests/expression/TernaryExpression.spec.js +89 -89
  318. package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
  319. package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
  320. package/dist/parser/tests/expression/TypeExpression.spec.js +127 -0
  321. package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
  322. package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
  323. package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
  324. package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
  325. package/dist/parser/tests/statement/AssignmentOperators.spec.js +15 -15
  326. package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
  327. package/dist/parser/tests/statement/ConstStatement.spec.js +82 -33
  328. package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -1
  329. package/dist/parser/tests/statement/Continue.spec.d.ts +1 -0
  330. package/dist/parser/tests/statement/Continue.spec.js +119 -0
  331. package/dist/parser/tests/statement/Continue.spec.js.map +1 -0
  332. package/dist/parser/tests/statement/Declaration.spec.js +19 -19
  333. package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
  334. package/dist/parser/tests/statement/Dim.spec.js +22 -22
  335. package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
  336. package/dist/parser/tests/statement/Enum.spec.js +98 -302
  337. package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
  338. package/dist/parser/tests/statement/For.spec.js +9 -10
  339. package/dist/parser/tests/statement/For.spec.js.map +1 -1
  340. package/dist/parser/tests/statement/ForEach.spec.js +8 -9
  341. package/dist/parser/tests/statement/ForEach.spec.js.map +1 -1
  342. package/dist/parser/tests/statement/Function.spec.js +44 -35
  343. package/dist/parser/tests/statement/Function.spec.js.map +1 -1
  344. package/dist/parser/tests/statement/Goto.spec.js +5 -5
  345. package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
  346. package/dist/parser/tests/statement/Increment.spec.js +20 -20
  347. package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
  348. package/dist/parser/tests/statement/InterfaceStatement.spec.js +30 -196
  349. package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
  350. package/dist/parser/tests/statement/LibraryStatement.spec.js +11 -11
  351. package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
  352. package/dist/parser/tests/statement/Misc.spec.js +16 -78
  353. package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
  354. package/dist/parser/tests/statement/PrintStatement.spec.js +36 -34
  355. package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
  356. package/dist/parser/tests/statement/ReturnStatement.spec.js +14 -12
  357. package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
  358. package/dist/parser/tests/statement/Set.spec.js +48 -35
  359. package/dist/parser/tests/statement/Set.spec.js.map +1 -1
  360. package/dist/parser/tests/statement/Stop.spec.js +6 -6
  361. package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
  362. package/dist/parser/tests/statement/Throw.spec.js +6 -6
  363. package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
  364. package/dist/parser/tests/statement/TryCatch.spec.js +18 -16
  365. package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
  366. package/dist/preprocessor/Manifest.d.ts +1 -1
  367. package/dist/preprocessor/Manifest.js +2 -2
  368. package/dist/preprocessor/Manifest.js.map +1 -1
  369. package/dist/preprocessor/Manifest.spec.js +8 -8
  370. package/dist/preprocessor/Manifest.spec.js.map +1 -1
  371. package/dist/preprocessor/Preprocessor.d.ts +5 -6
  372. package/dist/preprocessor/Preprocessor.js +5 -5
  373. package/dist/preprocessor/Preprocessor.js.map +1 -1
  374. package/dist/preprocessor/Preprocessor.spec.js +25 -25
  375. package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
  376. package/dist/preprocessor/PreprocessorParser.d.ts +1 -1
  377. package/dist/preprocessor/PreprocessorParser.js +7 -1
  378. package/dist/preprocessor/PreprocessorParser.js.map +1 -1
  379. package/dist/preprocessor/PreprocessorParser.spec.js +13 -13
  380. package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
  381. package/dist/roku-types/data.json +5892 -10081
  382. package/dist/roku-types/index.d.ts +622 -1719
  383. package/dist/types/ArrayType.d.ts +10 -9
  384. package/dist/types/ArrayType.js +65 -60
  385. package/dist/types/ArrayType.js.map +1 -1
  386. package/dist/types/ArrayType.spec.js +36 -68
  387. package/dist/types/ArrayType.spec.js.map +1 -1
  388. package/dist/types/AssociativeArrayType.d.ts +11 -0
  389. package/dist/types/AssociativeArrayType.js +52 -0
  390. package/dist/types/AssociativeArrayType.js.map +1 -0
  391. package/dist/types/BaseFunctionType.d.ts +9 -0
  392. package/dist/types/BaseFunctionType.js +25 -0
  393. package/dist/types/BaseFunctionType.js.map +1 -0
  394. package/dist/types/BooleanType.d.ts +8 -5
  395. package/dist/types/BooleanType.js +14 -7
  396. package/dist/types/BooleanType.js.map +1 -1
  397. package/dist/types/BooleanType.spec.js +10 -6
  398. package/dist/types/BooleanType.spec.js.map +1 -1
  399. package/dist/types/BscType.d.ts +32 -21
  400. package/dist/types/BscType.js +118 -21
  401. package/dist/types/BscType.js.map +1 -1
  402. package/dist/types/BscTypeKind.d.ts +25 -0
  403. package/dist/types/BscTypeKind.js +30 -0
  404. package/dist/types/BscTypeKind.js.map +1 -0
  405. package/dist/types/BuiltInInterfaceAdder.d.ts +23 -0
  406. package/dist/types/BuiltInInterfaceAdder.js +171 -0
  407. package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
  408. package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
  409. package/dist/types/BuiltInInterfaceAdder.spec.js +116 -0
  410. package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
  411. package/dist/types/ClassType.d.ts +17 -0
  412. package/dist/types/ClassType.js +58 -0
  413. package/dist/types/ClassType.js.map +1 -0
  414. package/dist/types/ClassType.spec.d.ts +1 -0
  415. package/dist/types/ClassType.spec.js +77 -0
  416. package/dist/types/ClassType.spec.js.map +1 -0
  417. package/dist/types/ComponentType.d.ts +26 -0
  418. package/dist/types/ComponentType.js +83 -0
  419. package/dist/types/ComponentType.js.map +1 -0
  420. package/dist/types/DoubleType.d.ts +8 -5
  421. package/dist/types/DoubleType.js +18 -16
  422. package/dist/types/DoubleType.js.map +1 -1
  423. package/dist/types/DoubleType.spec.js +12 -6
  424. package/dist/types/DoubleType.spec.js.map +1 -1
  425. package/dist/types/DynamicType.d.ts +9 -5
  426. package/dist/types/DynamicType.js +15 -4
  427. package/dist/types/DynamicType.js.map +1 -1
  428. package/dist/types/DynamicType.spec.js +16 -5
  429. package/dist/types/DynamicType.spec.js.map +1 -1
  430. package/dist/types/EnumType.d.ts +30 -12
  431. package/dist/types/EnumType.js +43 -17
  432. package/dist/types/EnumType.js.map +1 -1
  433. package/dist/types/EnumType.spec.d.ts +1 -0
  434. package/dist/types/EnumType.spec.js +33 -0
  435. package/dist/types/EnumType.spec.js.map +1 -0
  436. package/dist/types/FloatType.d.ts +8 -5
  437. package/dist/types/FloatType.js +18 -16
  438. package/dist/types/FloatType.js.map +1 -1
  439. package/dist/types/FloatType.spec.js +4 -6
  440. package/dist/types/FloatType.spec.js.map +1 -1
  441. package/dist/types/FunctionType.d.ts +13 -8
  442. package/dist/types/FunctionType.js +30 -14
  443. package/dist/types/FunctionType.js.map +1 -1
  444. package/dist/types/InheritableType.d.ts +28 -0
  445. package/dist/types/InheritableType.js +152 -0
  446. package/dist/types/InheritableType.js.map +1 -0
  447. package/dist/types/IntegerType.d.ts +8 -5
  448. package/dist/types/IntegerType.js +18 -16
  449. package/dist/types/IntegerType.js.map +1 -1
  450. package/dist/types/IntegerType.spec.js +8 -6
  451. package/dist/types/IntegerType.spec.js.map +1 -1
  452. package/dist/types/InterfaceType.d.ts +12 -13
  453. package/dist/types/InterfaceType.js +20 -48
  454. package/dist/types/InterfaceType.js.map +1 -1
  455. package/dist/types/InterfaceType.spec.js +90 -56
  456. package/dist/types/InterfaceType.spec.js.map +1 -1
  457. package/dist/types/InvalidType.d.ts +7 -5
  458. package/dist/types/InvalidType.js +13 -7
  459. package/dist/types/InvalidType.js.map +1 -1
  460. package/dist/types/InvalidType.spec.js +8 -6
  461. package/dist/types/InvalidType.spec.js.map +1 -1
  462. package/dist/types/LongIntegerType.d.ts +8 -5
  463. package/dist/types/LongIntegerType.js +17 -15
  464. package/dist/types/LongIntegerType.js.map +1 -1
  465. package/dist/types/LongIntegerType.spec.js +10 -6
  466. package/dist/types/LongIntegerType.spec.js.map +1 -1
  467. package/dist/types/NamespaceType.d.ts +12 -0
  468. package/dist/types/NamespaceType.js +28 -0
  469. package/dist/types/NamespaceType.js.map +1 -0
  470. package/dist/types/ObjectType.d.ts +9 -8
  471. package/dist/types/ObjectType.js +21 -11
  472. package/dist/types/ObjectType.js.map +1 -1
  473. package/dist/types/ObjectType.spec.js +3 -3
  474. package/dist/types/ObjectType.spec.js.map +1 -1
  475. package/dist/types/ReferenceType.d.ts +63 -0
  476. package/dist/types/ReferenceType.js +423 -0
  477. package/dist/types/ReferenceType.js.map +1 -0
  478. package/dist/types/ReferenceType.spec.d.ts +1 -0
  479. package/dist/types/ReferenceType.spec.js +137 -0
  480. package/dist/types/ReferenceType.spec.js.map +1 -0
  481. package/dist/types/StringType.d.ts +11 -5
  482. package/dist/types/StringType.js +18 -7
  483. package/dist/types/StringType.js.map +1 -1
  484. package/dist/types/StringType.spec.js +3 -5
  485. package/dist/types/StringType.spec.js.map +1 -1
  486. package/dist/types/TypedFunctionType.d.ts +22 -17
  487. package/dist/types/TypedFunctionType.js +78 -60
  488. package/dist/types/TypedFunctionType.js.map +1 -1
  489. package/dist/types/TypedFunctionType.spec.js +105 -20
  490. package/dist/types/TypedFunctionType.spec.js.map +1 -1
  491. package/dist/types/UninitializedType.d.ts +8 -6
  492. package/dist/types/UninitializedType.js +13 -7
  493. package/dist/types/UninitializedType.js.map +1 -1
  494. package/dist/types/UnionType.d.ts +20 -0
  495. package/dist/types/UnionType.js +123 -0
  496. package/dist/types/UnionType.js.map +1 -0
  497. package/dist/types/UnionType.spec.d.ts +1 -0
  498. package/dist/types/UnionType.spec.js +130 -0
  499. package/dist/types/UnionType.spec.js.map +1 -0
  500. package/dist/types/VoidType.d.ts +8 -5
  501. package/dist/types/VoidType.js +14 -7
  502. package/dist/types/VoidType.js.map +1 -1
  503. package/dist/types/VoidType.spec.js +3 -3
  504. package/dist/types/VoidType.spec.js.map +1 -1
  505. package/dist/types/helper.spec.d.ts +1 -0
  506. package/dist/types/helper.spec.js +145 -0
  507. package/dist/types/helper.spec.js.map +1 -0
  508. package/dist/types/helpers.d.ts +19 -37
  509. package/dist/types/helpers.js +159 -99
  510. package/dist/types/helpers.js.map +1 -1
  511. package/dist/types/index.d.ts +22 -0
  512. package/dist/types/index.js +39 -0
  513. package/dist/types/index.js.map +1 -0
  514. package/dist/util.d.ts +143 -139
  515. package/dist/util.js +864 -385
  516. package/dist/util.js.map +1 -1
  517. package/dist/validators/ClassValidator.d.ts +8 -25
  518. package/dist/validators/ClassValidator.js +99 -179
  519. package/dist/validators/ClassValidator.js.map +1 -1
  520. package/package.json +165 -152
  521. package/dist/astUtils/AstEditor.js.map +0 -1
  522. package/dist/astUtils/AstEditor.spec.js.map +0 -1
  523. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +0 -1
  524. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -32
  525. package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
  526. package/dist/parser/SGTypes.spec.js +0 -351
  527. package/dist/parser/SGTypes.spec.js.map +0 -1
  528. package/dist/types/CustomType.d.ts +0 -12
  529. package/dist/types/CustomType.js +0 -44
  530. package/dist/types/CustomType.js.map +0 -1
  531. package/dist/types/LazyType.d.ts +0 -16
  532. package/dist/types/LazyType.js +0 -44
  533. package/dist/types/LazyType.js.map +0 -1
  534. /package/dist/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
  535. /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → completions/CompletionsProcessor.spec.d.ts} +0 -0
  536. /package/dist/{parser/SGTypes.spec.d.ts → bscPlugin/definition/DefinitionProvider.spec.d.ts} +0 -0
package/dist/util.d.ts CHANGED
@@ -1,38 +1,39 @@
1
- import type { Diagnostic, Position, Range, Location } from 'vscode-languageserver';
2
- import type { BsConfig } from './BsConfig';
3
- import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, FunctionCall, CallableParam, TranspileResult, MinMax } from './interfaces';
1
+ import { type Diagnostic, type Position, type Location } from 'vscode-languageserver';
2
+ import { Range } from 'vscode-languageserver';
3
+ import type { BsConfig, FinalizedBsConfig } from './BsConfig';
4
+ import type { CallableContainer, BsDiagnostic, FileReference, CallableContainerMap, CompilerPlugin, ExpressionInfo, TypeChainEntry, TypeChainProcessResult } from './interfaces';
4
5
  import { BooleanType } from './types/BooleanType';
5
6
  import { DoubleType } from './types/DoubleType';
6
7
  import { DynamicType } from './types/DynamicType';
7
8
  import { FloatType } from './types/FloatType';
8
9
  import { IntegerType } from './types/IntegerType';
9
- import { InvalidType } from './types/InvalidType';
10
10
  import { LongIntegerType } from './types/LongIntegerType';
11
+ import { ObjectType } from './types/ObjectType';
11
12
  import { StringType } from './types/StringType';
12
13
  import { VoidType } from './types/VoidType';
13
- import type { DottedGetExpression, Expression, NamespacedVariableNameExpression, VariableExpression } from './parser/Expression';
14
+ import { ParseMode } from './parser/Parser';
15
+ import type { DottedGetExpression, VariableExpression } from './parser/Expression';
14
16
  import type { Identifier, Locatable, Token } from './lexer/Token';
15
17
  import { SourceNode } from 'source-map';
16
- import { SGAttribute } from './parser/SGTypes';
17
18
  import type { BrsFile } from './files/BrsFile';
18
19
  import type { XmlFile } from './files/XmlFile';
20
+ import { type AstNode, type Expression, type Statement } from './parser/AstNode';
21
+ import type { UnresolvedSymbol } from './AstValidationSegmenter';
22
+ import type { SymbolTable } from './SymbolTable';
23
+ import type { BscType } from './types';
19
24
  import { FunctionType } from './types/FunctionType';
20
- import type { BscType } from './types/BscType';
21
25
  export declare class Util {
22
26
  clearConsole(): void;
23
27
  /**
24
28
  * Returns the number of parent directories in the filPath
25
- * @param filePath
26
29
  */
27
30
  getParentDirectoryCount(filePath: string | undefined): number;
28
31
  /**
29
32
  * Determine if the file exists
30
- * @param filePath
31
33
  */
32
34
  pathExists(filePath: string | undefined): Promise<boolean>;
33
35
  /**
34
36
  * Determine if the file exists
35
- * @param filePath
36
37
  */
37
38
  pathExistsSync(filePath: string | undefined): boolean;
38
39
  /**
@@ -47,77 +48,73 @@ export declare class Util {
47
48
  * Determine if the given path starts with a protocol
48
49
  */
49
50
  startsWithProtocol(path: string): boolean;
51
+ /**
52
+ * Given a pkg path of any kind, transform it to a roku-specific pkg path (i.e. "pkg:/some/path.brs")
53
+ * @deprecated use `sanitizePkgPath instead. Will be removed in v1
54
+ */
55
+ getRokuPkgPath(pkgPath: string): string;
50
56
  /**
51
57
  * Given a path to a file/directory, replace all path separators with the current system's version.
52
- * @param filePath
53
58
  */
54
59
  pathSepNormalize(filePath: string, separator?: string): string;
55
60
  /**
56
61
  * Find the path to the config file.
57
62
  * If the config file path doesn't exist
58
- * @param configFilePath
63
+ * @param cwd the current working directory where the search for configs should begin
59
64
  */
60
65
  getConfigFilePath(cwd?: string): string;
61
66
  getRangeFromOffsetLength(text: string, offset: number, length: number): Range;
62
67
  /**
63
68
  * Load the contents of a config file.
64
69
  * If the file extends another config, this will load the base config as well.
65
- * @param configFilePath
66
- * @param parentProjectPaths
70
+ * @param configFilePath the relative or absolute path to a brighterscript config json file
71
+ * @param parentProjectPaths a list of parent config files. This is used by this method to recursively build the config list
67
72
  */
68
- loadConfigFile(configFilePath: string, parentProjectPaths?: string[], cwd?: string): BsConfig;
73
+ loadConfigFile(configFilePath: string | undefined, parentProjectPaths?: string[], cwd?: string): BsConfig | undefined;
69
74
  /**
70
75
  * Convert relative paths to absolute paths, relative to the given directory. Also de-dupes the paths. Modifies the array in-place
71
- * @param paths the list of paths to be resolved and deduped
76
+ * @param collection usually a bsconfig.
77
+ * @param key a key of the config to read paths from (usually this is `'plugins'` or `'require'`)
72
78
  * @param relativeDir the path to the folder where the paths should be resolved relative to. This should be an absolute path
73
79
  */
74
80
  resolvePathsRelativeTo(collection: any, key: string, relativeDir: string): void;
75
81
  /**
76
82
  * Do work within the scope of a changed current working directory
77
- * @param targetCwd
78
- * @param callback
83
+ * @param targetCwd the cwd where the work should be performed
84
+ * @param callback a function to call when the cwd has been changed to `targetCwd`
79
85
  */
80
86
  cwdWork<T>(targetCwd: string | null | undefined, callback: () => T): T;
81
87
  /**
82
88
  * Given a BsConfig object, start with defaults,
83
89
  * merge with bsconfig.json and the provided options.
84
- * @param config
90
+ * @param config a bsconfig object to use as the baseline for the resulting config
85
91
  */
86
- normalizeAndResolveConfig(config: BsConfig): BsConfig;
92
+ normalizeAndResolveConfig(config: BsConfig | undefined): FinalizedBsConfig;
87
93
  /**
88
94
  * Set defaults for any missing items
89
- * @param config
95
+ * @param config a bsconfig object to use as the baseline for the resulting config
90
96
  */
91
- normalizeConfig(config: BsConfig): BsConfig;
97
+ normalizeConfig(config: BsConfig | undefined): FinalizedBsConfig;
92
98
  /**
93
99
  * Get the root directory from options.
94
100
  * Falls back to options.cwd.
95
101
  * Falls back to process.cwd
96
- * @param options
102
+ * @param options a bsconfig object
97
103
  */
98
104
  getRootDir(options: BsConfig): string;
99
- /**
100
- * Format a string with placeholders replaced by argument indexes
101
- * @param subject
102
- * @param params
103
- */
104
- stringFormat(subject: string, ...args: any[]): string;
105
105
  /**
106
106
  * Given a list of callables as a dictionary indexed by their full name (namespace included, transpiled to underscore-separated.
107
- * @param callables
108
107
  */
109
108
  getCallableContainersByLowerName(callables: CallableContainer[]): CallableContainerMap;
110
109
  /**
111
110
  * Split a file by newline characters (LF or CRLF)
112
- * @param text
113
111
  */
114
112
  getLines(text: string): string[];
115
113
  /**
116
- * Compute the pkg path for the target relative to the source file's location
117
- * @param sourcePkgPath The pkgPath of the file that contains the target path
118
- * @param targetPath a full pkgPath, or a path relative to the containing file
114
+ * Given an absolute path to a source file, and a target path,
115
+ * compute the pkg path for the target relative to the source file's location
119
116
  */
120
- getPkgPathFromTarget(sourcePkgPath: string, targetPath: string): string;
117
+ getPkgPathFromTarget(containingFilePathAbsolute: string, targetPath: string): string;
121
118
  /**
122
119
  * Compute the relative path from the source file to the target file
123
120
  * @param pkgSrcPath - the absolute path to the source, where cwd is the package location
@@ -137,7 +134,7 @@ export declare class Util {
137
134
  * | bbb | bb | bbb | b | bbb | bb | bb | b | a |
138
135
  * ```
139
136
  */
140
- rangesIntersect(a: Range, b: Range): boolean;
137
+ rangesIntersect(a: Range | undefined, b: Range | undefined): boolean;
141
138
  /**
142
139
  * Do `a` and `b` overlap by at least one character or touch at the edges
143
140
  * ```
@@ -147,39 +144,47 @@ export declare class Util {
147
144
  * | bbb | bb | bbb | b | bbb | bb | bb | b | a |
148
145
  * ```
149
146
  */
150
- rangesIntersectOrTouch(a: Range, b: Range): boolean;
147
+ rangesIntersectOrTouch(a: Range | undefined, b: Range | undefined): boolean;
151
148
  /**
152
149
  * Test if `position` is in `range`. If the position is at the edges, will return true.
153
150
  * Adapted from core vscode
154
- * @param range
155
- * @param position
156
151
  */
157
- rangeContains(range: Range, position: Position): boolean;
158
- comparePositionToRange(position: Position, range: Range): 1 | -1 | 0;
152
+ rangeContains(range: Range | undefined, position: Position | undefined): boolean;
153
+ comparePositionToRange(position: Position | undefined, range: Range | undefined): 1 | -1 | 0;
154
+ comparePosition(a: Position | undefined, b: Position): 1 | -1 | 0;
159
155
  /**
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;
156
+ * Combine all the documentation found before a token (i.e. comment tokens)
157
+ */
158
+ getTokenDocumentation(tokens: Token[], token?: Token): string;
159
+ /**
160
+ * Combine all the documentation for a node - uses the AstNode's leadingTrivia property
161
+ */
162
+ getNodeDocumentation(node: AstNode): string;
163
+ /**
164
+ * Prefixes a component name so it can be used as type in the symbol table, without polluting available symbols
165
+ *
166
+ * @param sgNodeName the Name of the component
167
+ * @returns the node name, prefixed with `roSGNode`
168
+ */
169
+ getSgNodeTypeName(sgNodeName: string): string;
166
170
  /**
167
171
  * Parse an xml file and get back a javascript object containing its results
168
- * @param text
169
172
  */
170
173
  parseXml(text: string): Promise<any>;
171
174
  propertyCount(object: Record<string, unknown>): number;
172
175
  padLeft(subject: string, totalLength: number, char: string): string;
173
176
  /**
174
177
  * Given a URI, convert that to a regular fs path
175
- * @param uri
176
178
  */
177
179
  uriToPath(uri: string): string;
178
180
  /**
179
181
  * Force the drive letter to lower case
180
- * @param fullPath
181
182
  */
182
183
  driveLetterToLower(fullPath: string): string;
184
+ /**
185
+ * Replace the first instance of `search` in `subject` with `replacement`
186
+ */
187
+ replaceCaseInsensitive(subject: string, search: string, replacement: string): string;
183
188
  /**
184
189
  * Determine if two arrays containing primitive values are equal.
185
190
  * This considers order and compares by equality.
@@ -187,45 +192,40 @@ export declare class Util {
187
192
  areArraysEqual(arr1: any[], arr2: any[]): boolean;
188
193
  /**
189
194
  * Given a file path, convert it to a URI string
190
- * @param srcPath The absolute path to the source file on disk
191
195
  */
192
- pathToUri(srcPath: string): string;
196
+ pathToUri(filePath: string): string;
193
197
  /**
194
198
  * Get the outDir from options, taking into account cwd and absolute outFile paths
195
- * @param options
196
199
  */
197
- getOutDir(options: BsConfig): string;
200
+ getOutDir(options: FinalizedBsConfig): string;
198
201
  /**
199
202
  * Get paths to all files on disc that match this project's source list
200
203
  */
201
- getFilePaths(options: BsConfig): Promise<import("roku-deploy").StandardizedFileEntry[]>;
204
+ getFilePaths(options: FinalizedBsConfig): Promise<import("roku-deploy").StandardizedFileEntry[]>;
202
205
  /**
203
206
  * Given a path to a brs file, compute the path to a theoretical d.bs file.
204
- * Only `.brs` files can have a typedef, so return undefined for everything else
205
- * @param brsSrcPath The absolute path to the .brs source file on disk
207
+ * Only `.brs` files can have typedef path, so return undefined for everything else
206
208
  */
207
209
  getTypedefPath(brsSrcPath: string): string;
208
210
  /**
209
211
  * Determine whether this diagnostic should be supressed or not, based on brs comment-flags
210
- * @param diagnostic
211
212
  */
212
213
  diagnosticIsSuppressed(diagnostic: BsDiagnostic): boolean;
213
214
  /**
214
- * Walks up the chain
215
- * @param currentPath
215
+ * Walks up the chain to find the closest bsconfig.json file
216
216
  */
217
- findClosestConfigFile(currentPath: string): Promise<string>;
217
+ findClosestConfigFile(currentPath: string): Promise<string | undefined>;
218
218
  /**
219
219
  * Set a timeout for the specified milliseconds, and resolve the promise once the timeout is finished.
220
- * @param milliseconds
220
+ * @param milliseconds the minimum number of milliseconds to sleep for
221
221
  */
222
222
  sleep(milliseconds: number): Promise<unknown>;
223
223
  /**
224
224
  * Given an array, map and then flatten
225
- * @param arr
226
- * @param cb
225
+ * @param array the array to flatMap over
226
+ * @param callback a function that is called for every array item
227
227
  */
228
- flatMap<T, R>(array: T[], cb: (arg: T) => R): R;
228
+ flatMap<T, R>(array: T[], callback: (arg: T) => R[]): R[];
229
229
  /**
230
230
  * Determines if the position is greater than the range. This means
231
231
  * the position does not touch the range, and has a position greater than the end
@@ -251,8 +251,6 @@ export declare class Util {
251
251
  }): boolean;
252
252
  /**
253
253
  * If the two items have lines that touch
254
- * @param first
255
- * @param second
256
254
  */
257
255
  linesTouch(first: {
258
256
  range: Range;
@@ -267,7 +265,7 @@ export declare class Util {
267
265
  /**
268
266
  * Find a script import that the current position touches, or undefined if not found
269
267
  */
270
- getScriptImportAtPosition(scriptImports: FileReference[], position: Position): FileReference;
268
+ getScriptImportAtPosition(scriptImports: FileReference[], position: Position): FileReference | undefined;
271
269
  /**
272
270
  * Given the class name text, return a namespace-prefixed name.
273
271
  * If the name already has a period in it, or the namespaceName was not provided, return the class name as is.
@@ -281,6 +279,11 @@ export declare class Util {
281
279
  * Helper for creating `Location` objects. Prefer using this function because vscode-languageserver's `Location.create()` is significantly slower at scale
282
280
  */
283
281
  createLocation(uri: string, range: Range): Location;
282
+ /**
283
+ * A cache of `Range` objects. The key is a 52bit integer created from the 4 range integers and leveraging bitshifting.
284
+ * The whole point of this cache is to reduce garbage collection churn, so we didn't want to use string concatenation for the key
285
+ */
286
+ private rangeCache;
284
287
  /**
285
288
  * Helper for creating `Range` objects. Prefer using this function because vscode-languageserver's `Range.create()` is significantly slower
286
289
  */
@@ -290,19 +293,29 @@ export declare class Util {
290
293
  */
291
294
  createRangeFromPositions(startPosition: Position, endPosition: Position): Range;
292
295
  /**
293
- * Given a list of ranges, create a range that starts with the first non-null lefthand range, and ends with the first non-null
294
- * righthand range. Returns undefined if none of the items have a range.
296
+ * Gets the bounding range of a bunch of ranges or objects that have ranges
297
+ * TODO: this does a full iteration of the args. If the args were guaranteed to be in range order, we could optimize this
295
298
  */
296
299
  createBoundingRange(...locatables: Array<{
297
300
  range?: Range;
298
- }>): Range;
301
+ } | Range>): Range | undefined;
302
+ /**
303
+ * Gets the bounding range of an object that contains a bunch of tokens
304
+ * @param tokens Object with tokens in it
305
+ * @returns Range containing all the tokens
306
+ */
307
+ createBoundingRangeFromTokens(tokens: Record<string, {
308
+ range?: Range;
309
+ }>): Range | undefined;
310
+ /**
311
+ * A cache of `Position` objects. The key is a 26bit integer created from line and character and leveraging bitshifting
312
+ * The whole point of this cache is to reduce garbage collection churn, so we didn't want to use string concatenation for the key
313
+ */
314
+ private positionCache;
299
315
  /**
300
316
  * Create a `Position` object. Prefer this over `Position.create` for performance reasons
301
317
  */
302
- createPosition(line: number, character: number): {
303
- line: number;
304
- character: number;
305
- };
318
+ createPosition(line: number, character: number): Position;
306
319
  /**
307
320
  * Convert a list of tokens into a string, including their leading whitespace
308
321
  */
@@ -310,10 +323,27 @@ export declare class Util {
310
323
  /**
311
324
  * Convert a token into a BscType
312
325
  */
313
- tokenToBscType(token: Token, allowBrighterscriptTypes?: boolean, currentNamespaceName?: NamespacedVariableNameExpression): DynamicType | BscType | FloatType | IntegerType | DoubleType | LongIntegerType | StringType | BooleanType | FunctionType | InvalidType | VoidType;
326
+ tokenToBscType(token: Token): DynamicType | ObjectType | StringType | IntegerType | BooleanType | FloatType | DoubleType | LongIntegerType | VoidType | FunctionType;
327
+ /**
328
+ * Deciphers the correct types for fields based on docs
329
+ * https://developer.roku.com/en-ca/docs/references/scenegraph/xml-elements/interface.md
330
+ * @param typeDescriptor the type descriptor from the docs
331
+ * @returns {BscType} the known type, or dynamic
332
+ */
333
+ getNodeFieldType(typeDescriptor: string, lookupTable?: SymbolTable): BscType;
334
+ /**
335
+ * Return the type of the result of a binary operator
336
+ * Note: compound assignments (eg. +=) internally use a binary expression, so that's why TokenKind.PlusEqual, etc. are here too
337
+ */
338
+ binaryOperatorResultType(leftType: BscType, operator: Token, rightType: BscType): BscType;
339
+ /**
340
+ * Return the type of the result of a binary operator
341
+ */
342
+ unaryOperatorResultType(operator: Token, exprType: BscType): BscType;
314
343
  /**
315
344
  * Get the extension for the given file path. Basically the part after the final dot, except for
316
345
  * `d.bs` which is treated as single extension
346
+ * @returns the file extension (i.e. ".d.bs", ".bs", ".brs", ".xml", ".jpg", etc...)
317
347
  */
318
348
  getExtension(filePath: string): string;
319
349
  /**
@@ -325,74 +355,27 @@ export declare class Util {
325
355
  * This is mostly used for the ternary expression
326
356
  */
327
357
  getExpressionInfo(expression: Expression): ExpressionInfo;
358
+ concatAnnotationLeadingTrivia(stmt: Statement, otherTrivia: Token[]): Token[];
328
359
  /**
329
360
  * Create a SourceNode that maps every line to itself. Useful for creating maps for files
330
361
  * that haven't changed at all, but we still need the map
331
362
  */
332
363
  simpleMap(source: string, src: string): SourceNode;
333
- /**
334
- * Creates a new SGAttribute object, but keeps the existing Range references (since those should be immutable)
335
- */
336
- cloneSGAttribute(attr: SGAttribute, value: string): SGAttribute;
337
- /**
338
- * Shorthand for creating a new source node
339
- */
340
- sourceNode(source: string, locatable: {
341
- range: Range;
342
- }, code: string | SourceNode | TranspileResult): SourceNode | undefined;
343
- /**
344
- * Remove leading simple protocols from a path (if present)
345
- */
346
- removeProtocol(pkgPath: string): string;
347
364
  /**
348
365
  * Converts a path into a standardized format (drive letter to lower, remove extra slashes, use single slash type, resolve relative parts, etc...)
349
366
  */
350
367
  standardizePath(thePath: string): string;
351
- /**
352
- * Copy the version of bslib from local node_modules to the staging folder
353
- */
354
- copyBslibToStaging(stagingDir: string): Promise<void>;
355
368
  /**
356
369
  * Given a Diagnostic or BsDiagnostic, return a deep clone of the diagnostic.
357
370
  * @param diagnostic the diagnostic to clone
358
371
  * @param relatedInformationFallbackLocation a default location to use for all `relatedInformation` entries that are missing a location
359
372
  */
360
- toDiagnostic(diagnostic: Diagnostic | BsDiagnostic, fileUri: string): {
361
- severity: import("vscode-languageserver-types").DiagnosticSeverity;
362
- range: Range;
363
- message: string;
364
- relatedInformation: {
365
- location: Location;
366
- message: string;
367
- }[];
368
- code: string | number;
369
- source: string;
370
- };
371
- /**
372
- * Gets the minimum and maximum number of allowed params
373
- * @param params The list of callable parameters to check
374
- * @returns the minimum and maximum number of allowed params
375
- */
376
- getMinMaxParamCount(params: CallableParam[]): MinMax;
377
- /**
378
- * Gets the minimum and maximum number of allowed params for ALL functions with the name of the function call
379
- * @param callablesByLowerName The map of callable containers
380
- * @param expCall function call expression to use for the name
381
- * @returns the minimum and maximum number of allowed params
382
- */
383
- getMinMaxParamCountByFunctionCall(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): MinMax;
384
- /**
385
- * Finds the array of callables from a container map, based on the name of the function call
386
- * If the callable was called in a function in a namespace, functions in that namespace are preferred
387
- * @param callablesByLowerName The map of callable containers
388
- * @param expCall function call expression to use for the name
389
- * @return an array with callable containers - could be empty if nothing was found
390
- */
391
- getCallableContainersByName(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer[];
392
- /**
393
- * Get the first locatable item found at the specified position
394
- * @param position
395
- */
373
+ toDiagnostic(diagnostic: Diagnostic | BsDiagnostic, relatedInformationFallbackLocation: string): Diagnostic;
374
+ /**
375
+ * Get the first locatable item found at the specified position
376
+ * @param locatables an array of items that have a `range` property
377
+ * @param position the position that the locatable must contain
378
+ */
396
379
  getFirstLocatableAt(locatables: Locatable[], position: Position): Locatable;
397
380
  /**
398
381
  * Sort an array of objects that have a Range
@@ -406,24 +389,30 @@ export declare class Util {
406
389
  text: string;
407
390
  range: Range;
408
391
  }[];
409
- mdFence(code: string, language?: string): string;
410
392
  /**
411
- * Finds a callable from a container map based on the name AND number of arguments
412
- * If the callable was called in a function in a namespace, functions in that namespace are preferred
413
- * The first callable that matches the name AND will accept the number of arguments given is returned
414
- * @return a callable containers that matches the call
393
+ * Wrap the given code in a markdown code fence (with the language)
415
394
  */
416
- getCallableContainerByFunctionCall(callablesByLowerName: CallableContainerMap, expCall: FunctionCall): CallableContainer;
395
+ mdFence(code: string, language?: string): string;
417
396
  /**
418
397
  * Gets each part of the dotted get.
419
- * @param expression
398
+ * @param node any ast expression
420
399
  * @returns an array of the parts of the dotted get. If not fully a dotted get, then returns undefined
421
400
  */
422
- getAllDottedGetParts(expression: Expression): Identifier[] | undefined;
401
+ getAllDottedGetParts(node: AstNode): Identifier[] | undefined;
402
+ /**
403
+ * Given an expression, return all the DottedGet name parts as a string.
404
+ * Mostly used to convert namespaced item full names to a strings
405
+ */
406
+ getAllDottedGetPartsAsString(node: Expression | Statement, parseMode?: ParseMode): string;
407
+ stringJoin(strings: string[], separator: string): string;
423
408
  /**
424
409
  * Break an expression into each part.
425
410
  */
426
411
  splitExpression(expression: Expression): Expression[];
412
+ /**
413
+ * Break an expression into each part, and return any VariableExpression or DottedGet expresisons from left-to-right.
414
+ */
415
+ getDottedGetPath(expression: Expression): [VariableExpression, ...DottedGetExpression[]];
427
416
  /**
428
417
  * Returns an integer if valid, or undefined. Eliminates checking for NaN
429
418
  */
@@ -433,6 +422,22 @@ export declare class Util {
433
422
  */
434
423
  rangeToString(range: Range): string;
435
424
  validateTooDeepFile(file: (BrsFile | XmlFile)): void;
425
+ /**
426
+ * Find the index of the last item in the array that matches.
427
+ */
428
+ findLastIndex<T>(array: T[], matcher: (T: any) => boolean): number;
429
+ processTypeChain(typeChain: TypeChainEntry[]): TypeChainProcessResult;
430
+ isInTypeExpression(expression: AstNode): boolean;
431
+ setContainsUnresolvedSymbol(symbolLowerNameSet: Set<string>, symbol: UnresolvedSymbol): boolean;
432
+ truncate<T>(options: {
433
+ leadingText: string;
434
+ items: T[];
435
+ trailingText?: string;
436
+ maxLength: number;
437
+ itemSeparator?: string;
438
+ partBuilder?: (item: T) => string;
439
+ }): string;
440
+ getAstNodeFriendlyName(node: AstNode): string;
436
441
  }
437
442
  /**
438
443
  * 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,
@@ -441,4 +446,3 @@ export declare class Util {
441
446
  export declare function standardizePath(stringParts: any, ...expressions: any[]): string;
442
447
  export declare let util: Util;
443
448
  export default util;
444
- export declare const MAX_PARAM_COUNT = 32;