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