Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for MixinExtras expressions (#2274)
* Start on MixinExtras Expression language * MEExpression color settings page * MEExpression annotator * MEExpression brace matcher and quote handler * Switch LHS of MEExpression assignmentExpression to themselves be certain types of expression * MEExpression language injection inside @expression * Fix formatting and licenses * Add MIXINEXTRAS:EXPRESSION injection point and add @expression annotation on completion * Fix licenser errors * Add new ME expression features * Implement MixinExtras expression collect visitor * Fix cast expressions * Simple best-effort source matching for ME expressions * Fix name expression source matching * Fix MEName.isWildcard * Fix MELitExpression source matching * operationSign - operationTokenType * Add built-in definitions * Update MixinExtras * Start with ME definition references * Attempt to overhaul ME expression injection * Some fixes to the new injection + navigation * MixinExtras: Add handler signature support for expressions. (#2244) * Partially fix ME definition renaming * Attempt to get inplace rename refactoring to work (it doesn't) * MixinExtras: Use expression-suggested parameter names if they're present. (#2257) * Fix MEExpressionInjector. Rename refactoring works! * Suppress deprecation warning * ME expression `@Definition` find usages * Fix/expressions int like types (#2261) * Mixin: Combine parameter and return type inspections. * MixinExtras: Offer a choice between all valid int-like types. * Mixin: Fix tests for handler signature inspection. * Add simple keyword completion to ME expressions * Why didn't my local ktlint tell me about these * Store whether a declaration is a type in the ME PSI * Add completions for items that already have a definition * Extract some ME expression matching into its own class, and cache some more things * Remove some debug code * First attempt at bytecode-based completion (it's broken) * Bytecode-based completion fixes * Add new definition annotations below existing definition annotations, or at the top * Fix cursor offset * Add utilities to textify various ASM nodes * Add expression variants, to allow MixinExtras to match expressions as if they were other types of expressions * Merge two expression types into a single MENewExpression, improve ME expression completion * Add better completion tail types * Fix completion not working inside of constructors * Add errors/warnings for unused and unresolved definitions, and highlight primitive types specially * Split MatchUtil into CompletionUtil * Fold @At.target for definition completions * Local variable completions * Some fixes to local variable completion * Fix can-be-implicit locals with inaccessible types not showing template * Show field and method types in completion list * Add completion tests, and make some fixes to completion * Fix folding on completion * Refactor mcdev settings, move shadow setting into a project setting * Add setting for position of @Definition relative to @expression * Add folding for @definitions * Fix array literal input completion * Fix ktlint * Relax uniqueness in ME expression completions * Initial switch from @Definition.at to field and method * Fix tests * Add references to @Definition.field and method * Add folding to @Definition.field and method * Add comments to MEExpressionCompletionUtil to explain the completion process in more detail * Fix @Local.type extraction * Add string literal completion for ME expressions * Fix @Local.type for source matching too * Fix parsing of multiple @expression annotations in a single modifier list * Format MEExpressionLexer.flex * Better handle parenthesized expressions in Java source matching * Add method reference expressions * Fix presentable name of method reference completions * Override matches(Handle) for method MemberDefinition * Update MixinExtras and don't assume that instructions are part of the method * Wrap expanded instructions in a custom type to prevent them accidentally being used when an instruction in the original method is expected or vice versa. * Fix IdentityHashMap with VirtualInsn keys * Update MixinExtras * Fix completion of new expressions with new MixinExtras update * Update MixinExtras, fixes compound instructions * New: Add support for string concat expressions in MixinExtras. (#2281) * Address PR comments * MixinExtras Expressions: Migrate to Expressions library. * Fix: Resolve being unable to get the descriptor for some complex types. * MixinExtras Expressions: Recreate `ClassInfo#getCommonSuperClassOrInterface`. It's quite scuffed and often returns `Object` even when there is a suitable common interface, but what's important is that this matches the runtime logic. * MixinExtras: Fix completion confidence. * Expressions: Autocomplete `method`s and `field`s using flows not instructions. * Expressions: Autocomplete `method`s for method references. * Expressions: A class constant is an expression. * Expressions: Show instantiation desc in autocomplete. * Expressions: Make completions always unique to stop them being filtered. We filter duplicates ourselves. * Expressions: Overhaul array completions. Make the preview text more representative of the actual completion and support array literals which were previously missing. * Expressions: Fix super call completions. * Expressions: Confidently suggest completions after `::`. * Expressions: Add intention action to define unresolved identifiers. * Expressions: Fix `@Local`s not properly handling compound insns. Also adapt to related MixinExtras changes. * Refactor: Add `project` as parameter to `MEExpressionCompletionUtil.addDefinition` * Use maven central MixinExtras library * Remove reference to light service in plugin.xml * Use ReentrantReadWriteLock.read and write extension functions --------- Co-authored-by: LlamaLad7 <[email protected]>
- Loading branch information