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