Problem
Auto-completion for OFT specification item IDs under Covers: works during normal editing, but originally did not work while the caret was inside an expanded live template.
This left a gap in the authoring workflow for templates such as scn, req, dsn, qs, and arch, where users fill the COVERED placeholder with an existing requirement or specification item.
What We Learned
The original assumption that the bundled live-template COVERED variables must use IntelliJ's complete() expression turned out to be wrong.
The actual failure was in the Covers: context detection:
- Several bundled templates generate a blank spacer line between
Covers: and the covered-item bullet.
- The completion provider only offers OFT item IDs when the caret is detected inside a
Covers: section.
- The parser treated a blank line as the end of the
Covers: section.
- As a result, the active live-template
COVERED field was seen as outside Covers:, so user-invoked completion returned no OFT suggestions.
Important Follow-up Finding
Adding complete() to the live-template variables is not required for the expected workflow and can be harmful.
With IntelliJ full-line inline completion enabled, forcing completion when the live-template field receives focus can trigger an IntelliJ-side exception:
java.lang.IllegalArgumentException: Required value was null.
at org.jetbrains.completion.full.line.request.FullLineRequest$Companion...
The fix should therefore avoid forced live-template completion and keep completion user-invoked through IntelliJ basic completion while the live-template session remains active.
Expected Outcome
Users should be able to expand an OFT live template, type a partial specification item ID into the active COVERED field, invoke basic completion, and select an existing declaration without leaving live-template mode.
Implementation Direction
- Keep the bundled
COVERED live-template variables as ordinary editable placeholders.
- Keep the completion contributor as the single source of OFT specification item completion.
- Make
Covers: section detection stay active across blank spacer lines.
- Use the active editor document for completion-context checks so live-template edits are visible before the template session finishes.
- Add regression tests for:
- completion in an active live-template
COVERED field
- completion when a blank line separates
Covers: from the edited entry
- avoiding forced completion expressions in bundled
COVERED variables
Problem
Auto-completion for OFT specification item IDs under
Covers:works during normal editing, but originally did not work while the caret was inside an expanded live template.This left a gap in the authoring workflow for templates such as
scn,req,dsn,qs, andarch, where users fill theCOVEREDplaceholder with an existing requirement or specification item.What We Learned
The original assumption that the bundled live-template
COVEREDvariables must use IntelliJ'scomplete()expression turned out to be wrong.The actual failure was in the
Covers:context detection:Covers:and the covered-item bullet.Covers:section.Covers:section.COVEREDfield was seen as outsideCovers:, so user-invoked completion returned no OFT suggestions.Important Follow-up Finding
Adding
complete()to the live-template variables is not required for the expected workflow and can be harmful.With IntelliJ full-line inline completion enabled, forcing completion when the live-template field receives focus can trigger an IntelliJ-side exception:
The fix should therefore avoid forced live-template completion and keep completion user-invoked through IntelliJ basic completion while the live-template session remains active.
Expected Outcome
Users should be able to expand an OFT live template, type a partial specification item ID into the active
COVEREDfield, invoke basic completion, and select an existing declaration without leaving live-template mode.Implementation Direction
COVEREDlive-template variables as ordinary editable placeholders.Covers:section detection stay active across blank spacer lines.COVEREDfieldCovers:from the edited entryCOVEREDvariables