Ticket #276 (closed enhancement: fixed)

Opened 4 years ago

Last modified 4 years ago

Better formatting for method bindings

Reported by: stephan Owned by: stephan
Priority: major Milestone: OTDT_1.3.1
Component: dom Version: 1.3.0
Keywords: Cc:

Description

When formatting a method binding with long signatures the binding kind (->/=>/<-) and potentiall modifiers (before/replace/after/get/set) are buried within those signatures.

It would be better, if formatting could better expose those toplevel parts. However, a straight-forward inclusion of linebreaks breaks the assumption in CalloutCompletionProposal that the binding token starts directly before the base method spec.

Change History

Changed 4 years ago by stephan

r21785 bring necessary changes to the DOM:

  • make bindingOperator an AST node of it's own (comprising binding kind and binding modifier)

Thus, the bindingOperator has an explicit source position, which should help to avoid the hack in CalloutCompletionProposal.

Changed 4 years ago by stephan

r21789 improves the new AST structure (regarding MethodBindingOperator)

  • creating callin/callout mappings sets a default binding kind
  • get/set is no longer stored in FieldAccessSpec (dom) (became redundant with MethodBindingOperator)
  • extend ASTVisitor to also visit MethodBindingOperator, needed for letting ASTRewrite work on these nodes. Mapping declarations no longer bypass that node during accept0.
  • consistently preset AbstractMethodMappingDeclaration#modifierEnd, in case the modifier is missing in source - prevent illegal argument during setSourceRange

Test updates:

  • new test for quickfix to change callin binding modifier (CallinQuickFixTest)
  • use MethodBindingOperator where appropriate

Adjustments in jdt.ui.adaptor:

  • use MethodBindingOperator where appropriate -> can finally avoid the hack in CalloutCompletionProposal mentioned above.

Changed 4 years ago by stephan

  • status changed from new to closed
  • resolution set to fixed

r21790 updates the formatter as requested:

  • if a method spec has one or more line breaks that subsequent MethodBindingOperator will stand on a line of its own.
Note: See TracTickets for help on using tickets.