Skip to main content
Jump to: navigation, search

JDT Core Programmer Guide/Completion

< JDT Core Programmer Guide
Revision as of 08:31, 2 October 2018 by (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)

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.


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

Back to the top