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