tinymist_query/goto_declaration.rs
1use std::ops::Range;
2
3use crate::{SemanticRequest, prelude::*, syntax::SyntaxClass};
4
5/// The [`textDocument/declaration`] request asks the server for the declaration
6/// location of a symbol at a given text document position.
7///
8/// [`textDocument/declaration`]: https://microsoft.github.io/language-server-protocol/specification#textDocument_declaration
9///
10/// # Compatibility
11///
12/// This request was introduced in specification version 3.14.0.
13///
14/// The [`GotoDeclarationResponse::Link`](lsp_types::GotoDefinitionResponse::Link) return value
15/// was introduced in specification version 3.14.0 and requires client-side
16/// support in order to be used. It can be returned if the client set the
17/// following field to `true` in the `initialize` method:
18///
19/// ```text
20/// InitializeParams::capabilities::text_document::declaration::link_support
21/// ```
22#[derive(Debug, Clone)]
23pub struct GotoDeclarationRequest {
24 /// The path of the document to get the declaration location for.
25 pub path: PathBuf,
26 /// The position of the symbol to get the declaration location for.
27 pub position: LspPosition,
28}
29
30impl SemanticRequest for GotoDeclarationRequest {
31 type Response = GotoDeclarationResponse;
32
33 fn request(self, _ctx: &mut LocalContext) -> Option<Self::Response> {
34 let _ = find_declarations;
35 todo!()
36 }
37}
38
39fn find_declarations(
40 _ctx: &LocalContext,
41 _expr_info: Arc<crate::syntax::ExprInfo>,
42 _syntax: SyntaxClass<'_>,
43) -> Option<Vec<Range<usize>>> {
44 todo!()
45}