Skip to content

Commit

Permalink
Add information message for inline suggestion trigger command (#896)
Browse files Browse the repository at this point in the history
*  For inline suggestion trigger the cursor should be present on
   a blank line after task descrption with indentation matching to
   previous line. If this condition is not met show an informational
   message to the user.
  • Loading branch information
ganeshrn authored May 18, 2023
1 parent 7c090ef commit fe06c1c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/features/lightspeed/inlineSuggestions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,24 @@ export class LightSpeedInlineSuggestionProvider
spacesBeforeTaskNameStart !== spacesBeforeCursor
) {
resetInlineSuggestionDisplayed();
// If the user has triggered the inline suggestion by pressing the configured keys,
// we will show an information message to the user to help them understand the
// correct cursor position to trigger the inline suggestion.
if (context.triggerKind === vscode.InlineCompletionTriggerKind.Invoke) {
if (!taskMatchedPattern || !currentLineText.isEmptyOrWhitespace) {
vscode.window.showInformationMessage(
"Cursor should be positioned on the line after the task name with the same indent as that of the task name line to trigger an inline suggestion."
);
} else if (
taskMatchedPattern &&
currentLineText.isEmptyOrWhitespace &&
spacesBeforeTaskNameStart !== spacesBeforeCursor
) {
vscode.window.showInformationMessage(
`Cursor must be in column ${spacesBeforeTaskNameStart} to trigger an inline suggestion.`
);
}
}
return [];
}
inlineSuggestionData = {};
Expand Down

0 comments on commit fe06c1c

Please sign in to comment.