vtcode_core/prompts/
context.rs1use std::path::PathBuf;
2
3#[derive(Debug, Clone)]
5pub struct PromptContext {
6 pub workspace: Option<PathBuf>,
8 pub languages: Vec<String>,
10 pub project_type: Option<String>,
12 pub available_tools: Vec<String>,
14 pub user_preferences: Option<UserPreferences>,
16}
17
18impl Default for PromptContext {
19 fn default() -> Self {
20 Self {
21 workspace: None,
22 languages: Vec::new(),
23 project_type: None,
24 available_tools: Vec::new(),
25 user_preferences: None,
26 }
27 }
28}
29
30#[derive(Debug, Clone)]
32pub struct UserPreferences {
33 pub preferred_languages: Vec<String>,
35 pub coding_style: Option<String>,
37 pub preferred_frameworks: Vec<String>,
39}
40
41impl PromptContext {
42 pub fn from_workspace(workspace: PathBuf) -> Self {
44 Self {
45 workspace: Some(workspace),
46 ..Default::default()
47 }
48 }
49
50 pub fn add_language(&mut self, language: String) {
52 if !self.languages.contains(&language) {
53 self.languages.push(language);
54 }
55 }
56
57 pub fn set_project_type(&mut self, project_type: String) {
59 self.project_type = Some(project_type);
60 }
61
62 pub fn add_tool(&mut self, tool: String) {
64 if !self.available_tools.contains(&tool) {
65 self.available_tools.push(tool);
66 }
67 }
68}