Skip to content

Commit d629093

Browse files
committed
Update completion session when the completion is triggered by shortcut.
1 parent 51079aa commit d629093

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

addons/completion/session.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ var terminatingChars = []rune{
5252
}
5353

5454
func hasTerminateChar(input string) bool {
55+
if input == "" {
56+
return false
57+
}
58+
5559
return slices.Contains(terminatingChars, []rune(input)[0])
5660
}
5761

5862
func (s *session) Update(ctx gvcode.CompletionContext) []gvcode.CompletionCandidate {
59-
if s.canceled || ctx.Input == "" {
63+
if s.canceled {
6064
return nil
6165
}
6266

@@ -76,7 +80,7 @@ func (s *session) Update(ctx gvcode.CompletionContext) []gvcode.CompletionCandid
7680

7781
s.ctx = ctx
7882

79-
if isSymbolChar([]rune(s.ctx.Input)[0]) {
83+
if ctx.Input != "" && isSymbolChar([]rune(s.ctx.Input)[0]) {
8084
s.prefix = append(s.prefix, []rune(ctx.Input)...)
8185
if s.prefixRange == (gvcode.EditRange{}) {
8286
start := ctx.Position

0 commit comments

Comments
 (0)