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