Skip to content

Commit

Permalink
add lazy evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Rudnicki committed Jul 3, 2024
1 parent 967ae4f commit 1bcefcc
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ class SpelExpressionSuggester(
validationContext
)

val newExpression: Expression = truncateExpressionByCaretPosition2d(expression, caretPosition2d)
lazy val newExpression: Expression = truncateExpressionByCaretPosition2d(expression, caretPosition2d)

val futureSuggestionsAfterTruncatingExpressionByCaretPositionOption = expressionSuggestionsAux(
lazy val futureSuggestionsAfterTruncatingExpressionByCaretPositionOption = expressionSuggestionsAux(
newExpression,
caretPosition2d.normalizedCaretPosition(newExpression.expression),
validationContext
)

val allFutureSuggestionOptions =
lazy val allFutureSuggestionOptions =
List(futureSuggestionsOption, futureSuggestionsAfterTruncatingExpressionByCaretPositionOption)

val firstNonEmptySuggestionFutureOption = allFutureSuggestionOptions.collectFirst { case some @ Some(_) =>
Expand Down

0 comments on commit 1bcefcc

Please sign in to comment.