vtcode_core/code/code_completion/context/
mod.rs1pub mod analyzer;
2
3pub use analyzer::ContextAnalyzer;
4
5use serde::{Deserialize, Serialize};
6
7#[derive(Debug, Clone, Serialize, Deserialize)]
9pub struct CompletionContext {
10 pub line: usize,
11 pub column: usize,
12 pub prefix: String,
13 pub language: String,
14 pub scope: Vec<String>,
15 pub imports: Vec<String>,
16 pub recent_symbols: Vec<String>,
17}
18
19impl CompletionContext {
20 pub fn new(line: usize, column: usize, prefix: String, language: String) -> Self {
21 Self {
22 line,
23 column,
24 prefix,
25 language,
26 scope: Vec::new(),
27 imports: Vec::new(),
28 recent_symbols: Vec::new(),
29 }
30 }
31
32 pub fn is_completion_suitable(&self) -> bool {
34 !self.prefix.trim().is_empty()
35 }
36}