Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

JDT Core Programmer Guide/Completion

< JDT Core Programmer Guide
Revision as of 09:31, 2 October 2018 by Stephan.herrmann.berlin.de (Talk | contribs) (Created page with "{{Note|In this page we collect our understanding of how code completion is implemented, in particular the beast that is CompletionParser}} ==Source code range== Various parti...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Note.png
In this page we collect our understanding of how code completion is implemented, in particular the beast that is CompletionParser


Source code range

Various parties influence the source range that is analysed (scanned & parsed):

  • Parser.parseBlockStatements() starts with scanner.resetTo(md.bodyStart, bodyEnd(md))
    • CompletionParser implements bodyEnd by answering the cursorLocation
  • Since stopping at the cursorLocation is unacceptable in some situations (notably involving lambdas), AssistParser.fallBackToSpringForward() may set eofPosition to one of (a) actual source end or (b) real body end of the method.


It is unclear, how much is gained by stopping to parse in the middle of code:

  • does it help to cope with broken code beyond the cursor location?
  • does it improve performance? (I doubt it has significant impact. --SH)
  • in bug 473654 experiments to avoid setting eof to cursorLocation caused regressions, so some code must meanwhile depend on this strategy.

Recovery

This is the story of Parser.currentElement. Details to be written here.

Back to the top