types.rs

 1mod context_server;
 2mod dap;
 3mod lsp;
 4mod slash_command;
 5
 6use std::ops::Range;
 7
 8pub use context_server::*;
 9pub use dap::*;
10pub use lsp::*;
11pub use slash_command::*;
12
13/// A list of environment variables.
14pub type EnvVars = Vec<(String, String)>;
15
16/// A command.
17#[derive(Debug)]
18pub struct Command {
19    /// The command to execute.
20    pub command: String,
21    /// The arguments to pass to the command.
22    pub args: Vec<String>,
23    /// The environment variables to set for the command.
24    pub env: EnvVars,
25}
26
27/// A label containing some code.
28#[derive(Debug, Clone)]
29pub struct CodeLabel {
30    /// The source code to parse with Tree-sitter.
31    pub code: String,
32    /// The spans to display in the label.
33    pub spans: Vec<CodeLabelSpan>,
34    /// The range of the displayed label to include when filtering.
35    pub filter_range: Range<usize>,
36}
37
38/// A span within a code label.
39#[derive(Debug, Clone)]
40pub enum CodeLabelSpan {
41    /// A range into the parsed code.
42    CodeRange(Range<usize>),
43    /// A span containing a code literal.
44    Literal(CodeLabelSpanLiteral),
45}
46
47/// A span containing a code literal.
48#[derive(Debug, Clone)]
49pub struct CodeLabelSpanLiteral {
50    /// The literal text.
51    pub text: String,
52    /// The name of the highlight to use for this literal.
53    pub highlight_name: Option<String>,
54}