Commit Graph
364 Commits
Author SHA1 Message Date
bigguy345 006766bc1e Fixed .d.ts type merges overriding same-arity methods i.e spawn(IWorld) used to override spawn(IEntity, no more 2026-03-02 13:29:39 +02:00
bigguy345 fbb46ae9f2 Improved statement line separation logic so it includes chained dots on whitespaces and lines 2026-03-02 12:49:36 +02:00
bigguy345 32fd6af04f Fix hook signatures to follow runtime hook registrations in ScriptHookController.
This fixes broken unresolved DBC addon hook event types
2026-03-02 02:28:01 +02:00
bigguy345 36f7233297 Narrow integer literals to byte/short/char when expected i.e setByte(100) no longer throws "Expected byte, provided int" 2026-03-02 01:47:56 +02:00
bigguy345 edb285c90b Applied scope logic more consistently for variables/assignments 2026-03-02 00:45:24 +02:00
bigguy345 d45f09c27c Extracted ScopeInfo to its own class 2026-03-01 23:33:36 +02:00
bigguy345 be50fdeda5 Forgotten if clause from yesterday 2026-02-25 20:45:00 +02:00
bigguy345 30be75dbae Fix autocomplete menu scroll math when visible rows < max
When the menu shrinks in windowed/cramped layouts, several paths still assumed MAX_VISIBLE_ITEMS (10) for maxScroll/hover/scrollbar calculations, making the last entries unreachable. Use the actual visible capacity (visibleItemsCount) consistently and normalize scissor Y conversion for scaled GUI coords
2026-02-25 19:54:32 +02:00
bigguy345 6c45957b82 Add ShowImplementationFieldsInAutocomplete config 2026-02-25 17:13:35 +02:00
bigguy345 5b8827549f Fixed broken .d.ts fields parsing logic 2026-02-25 16:29:52 +02:00
bigguy345 0c842a22b9 Fix java method declaration MethodInfo not being fetched properly 2026-02-24 23:02:25 +02:00
bigguy345 95897dc746 Show 'function' instead of 'void' or other return type for hover info of JS method declarations 2026-02-24 21:34:18 +02:00
bigguy345 53f06ab388 Properly sanitized pasted text from trailing spaces at end of line, fixes forced soft-wrap when too many consecutive trailing spaces 2026-02-24 20:18:45 +02:00
bigguy345 d59d990b70 Marked JavaTextContainer as deprecated 2026-02-24 19:49:53 +02:00
bigguy345 12850bfe36 Improve JS 'any' propagation in expression typing 2026-02-24 18:53:10 +02:00
bigguy345 182c00b142 Fix JS 'number' and 'any' compatibility in expression type resolution
i.e fixes 'i * offsetMulti' in 'skinOverlay.setOffset(0, 0, i * offsetMulti)' not resolving properly
2026-02-24 17:57:01 +02:00
bigguy345 63f6c7c045 Made .d.ts files retain java primitive types ('int' retained as is without transforming to 'number') + necessary changes to support that 2026-02-24 15:50:12 +02:00
bigguy345 5c53b7e768 .d.ts API asset files are now reloaded on mc resource reload 2026-02-24 14:05:56 +02:00
bigguy345 430ff7c3a8 Improve autocomplete for method reference contexts
- trigger completion after :: and detect method-reference receiver chains

- restrict suggestions to methods (plus constructor refs) in method-reference mode

- insert method names without parentheses when completing method references
2026-02-18 05:21:55 +02:00
bigguy345 e2b35d6d54 Method reference and SAM type resolution
- add full parser/type-resolver support for Java method and constructor references

- infer SAM callback types for named JS script methods with conflict reporting

- surface argument-level SAM/type mismatch errors in method validation
2026-02-18 05:21:42 +02:00
bigguy345 7f4bc87d7a Extract overload selection to OverloadSelector helper with scoring algorithm
Problem:
- schedule("TpGainAction", function(act){...}) resolved to wrong overload
- TypeInfo.getBestMethodOverload rejected candidates when argType == null
- Fell back to arbitrary overloads.get(0) based on reflection order
- Result: selected 1-arg varargs overload instead of 2-arg fixed-arity

Solution:
- Created OverloadSelector helper class implementing scoring algorithm
- Scoring tiers (lower is better):
  * Arity mismatch: +10000 + distance penalty (hard disqualifier)
  * Varargs: +1000 penalty (fixed-arity strongly preferred)
  * Unknown arg type (null): +10 (penalty but doesn't disqualify)
  * Compatible type: +5 (modest preference for matching)
  * Exact match: +0 (best case)
- Closest arity fallback when no arity-applicable overload exists
- TypeInfo.getBestMethodOverload now delegates (4 lines vs 220)

Impact:
- Deterministic overload selection (no reflection-order dependence)
- schedule("TpGainAction", function(act){...}) now resolves correctly
- Unknown arg types no longer cause fallback to unrelated overloads
- Fixed-arity methods preferred over varargs when both viable
- Removed 220 lines of complex nested logic from TypeInfo

Testing:
- OverloadResolutionTest with 6 test cases (all passing)
- Verifies fixed-arity preference, unknown arg handling, arity fallback
2026-02-03 22:13:15 +02:00
bigguy345 6fc0bf4d6b Fix expression typing gate to route JS function/lambda expressions into ExpressionParser
Problem:
- function(act){...} expressions not reaching ExpressionParser
- resolveExpressionType only checked containsOperators() or startsWith("(")
- Function expressions went through simple resolver and returned null type

Solution:
- Added looksLikeFunctionOrLambda helper (lines 4766-4773) to detect:
  * JS functions: function(...)
  * Arrow functions: =>
  * Java lambdas: ->
- Updated gate condition at line 4144 to route these into ExpressionParser
- Function expressions now reach ExpressionTypeResolver.resolveJSFunctionType

Impact:
- SAM typing now works in pass-2 when expected type is known
- Fixes schedule("TpGainAction", function(act){...}) argument typing
- Enables proper overload resolution for function/lambda parameters
2026-02-03 22:12:43 +02:00
bigguy345 074c780d50 Add inner callable scope locals and expression type resolution
ScriptDocument now tracks locals inside lambdas/function expressions and resolves identifiers by consulting the innermost callable scope before falling back to method/global scope.

Adds expression resolver nodes/type resolver and wires position-aware resolution for lambda bodies, plus basic lambda operator marking and return type validation against expected functional interface SAM.
2026-02-03 07:03:33 +02:00
bigguy345 4e78ffb024 Fix autocomplete trigger after dot 2026-02-03 06:54:09 +02:00
bigguy345 98351bbc3c dev merge 2026-02-03 04:25:16 +02:00
Kam 1b8ad4dd90 Player Abilities 2026-01-30 05:01:54 -05:00
bigguy345 62d87c0c66 Added comment/multi-line handling for Autocomplete findReceiverExpression 2026-01-28 20:30:41 +02:00
bigguy345 9e04a1184c Lambda impl Phase 1: Track inner callables as nested scopes so parameters and locals resolve correctly inside the callable body, 2026-01-28 06:59:58 +02:00
bigguy345 6c5a269966 Fixed Autocomplete suggestions not working when whitespaces exist between it and receiver like "player. get <- doesnt work due to WS" 2026-01-28 06:06:01 +02:00
bigguy345 969d82dff8 Fixed visual hover info bugs for generics 2026-01-28 04:55:32 +02:00
bigguy345 125a799df4 Optimised and refined type generics parsing. Removed bloat and added edge case handling 2026-01-28 04:37:17 +02:00
bigguy345 5795cc984b Completely parsed type generics.
List<IPlayer> list;
list.get(0) NOW returns IPlayer, instead of T or Object.

Nested generics are also handled and functional:
Map<String, List<IPlayer>>

Implemented TokenHoverInfo/Autocomplete rendering and handling for generics as well.
2026-01-27 17:10:31 +02:00
bigguy345 1e96a21cca Added JS overloads to autocomplete properly 2026-01-26 22:54:40 +02:00
bigguy345 235fd3b3f3 Improved comment/string excluded range detection for auto-pair insertion 2026-01-26 21:52:04 +02:00
bigguy345 ea8cc51eef Prevented auto pair insertion of '', "", [], () blocks in excluded ranges (comments,strings) 2026-01-26 19:19:58 +02:00
bigguy345 83a54c10b8 forgot this from autocomplete insertion carat between () commit 2026-01-26 19:10:27 +02:00
bigguy345 720d0dc1b9 On Autocomplete insertion, set cursor carat inside () if method has parameters 2026-01-26 19:01:54 +02:00
bigguy345 bd1743d069 Penalised keyword items in autocomplete suggestions 2026-01-26 03:51:02 +02:00
bigguy345 76b6dae9d4 Added API global engine objects and DataScript global definitions as JS autocomplete suggestions 2026-01-26 03:50:33 +02:00
bigguy345 aae2fdb23a Added DataScript global definitions i.e. npc, world, event to syntax highlighter as global vars 2026-01-26 03:49:38 +02:00
bigguy345 df0d46e63d Properly parsed enclosed namespace types like INpcEvent.UpdateEvent and added them to JSTypeRegistry.types 2026-01-26 03:48:18 +02:00
bigguy345 46b62eea56 Bridged .d.ts patch overrides to java side to show in autocomplete/hoverinfo 2026-01-25 06:22:11 +02:00
bigguy345 f43b9ae186 Allowed for .d.ts patches to be applied and merge into existing types
i.e IPlayer.d.ts patch for getDBCPlayer() by npcdbc addon to return IDBCAddon instead of IDBCPlayer
2026-01-25 05:37:30 +02:00
bigguy345 f1a968d196 Got bridges working for new JSTypeRegistry domains (.d.ts files of each loaded mod) 2026-01-24 06:47:44 +02:00
bigguy345 b86c0284ac Loaded all .d.ts files in assets/modId/api directory of ALL loaded mods 2026-01-24 06:42:38 +02:00
bigguy345 26bf90ac66 Improved TokenHoverRenderer box height calculations 2026-01-24 05:36:59 +02:00
bigguy345 52db241b9a DtsJavaBridge interface/superclass fallback
Cached DtsJavaBridge lookups

Java varargs now match DTS reset params (...x: T)
2026-01-24 05:36:16 +02:00
bigguy345 3f6972f9f6 Bridged over JSDocs/param names for fields/methods of java reflected classes that have a matching JS type twin loaded from .d.ts files 2026-01-24 04:56:42 +02:00
bigguy345 64f8ca657c Parsed fully qualified name of API java classes in .d.ts files 2026-01-24 04:54:47 +02:00
bigguy345 1b9e674b36 Proper parsing for generic JSDoc tags like "@word this is a tag"
Removed deprecated/since tags, parsed them as generics instead
2026-01-24 03:29:48 +02:00