Skip to content

Commit 58f15d0

Browse files
committed
Consider the 'Program' node to be completion-worthy
1 parent 041efbe commit 58f15d0

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

crates/ark/src/lsp/completions/sources/composite.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,20 @@ fn is_identifier_like(x: Node) -> bool {
201201
return true;
202202
}
203203

204+
// Consider when the user asks for completions with no existing
205+
// text-to-complete, such as at the R prompt in the Console, in an empty R
206+
// file, or on an empty line of a non-empty R file.
207+
//
208+
// Gesture-wise, a Positron user could do this with Ctrl + Space, which
209+
// invokes the command editor.action.triggerSuggest.
210+
//
211+
// The nominal completion node in these cases is just the root or 'Program'
212+
// node of the AST. In this case, we should just provide "all" completions,
213+
// for some reasonable definition of "all".
214+
if x.node_type() == NodeType::Program {
215+
return true;
216+
}
217+
204218
return false;
205219
}
206220

0 commit comments

Comments
 (0)