mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-24 21:19:37 +00:00
refactor: refactor hover, analysis/global, and docs crates (#755)
* dev: refactor hover.rs * refactor refactor AnalysisContext * refactor: refactor docs crate
This commit is contained in:
parent
1c1bc19caf
commit
8f3566366e
44 changed files with 694 additions and 790 deletions
|
|
@ -7,7 +7,7 @@ pub type DiagnosticsMap = HashMap<Url, Vec<LspDiagnostic>>;
|
|||
|
||||
/// Converts a list of Typst diagnostics to LSP diagnostics.
|
||||
pub fn convert_diagnostics<'a>(
|
||||
ctx: &AnalysisContext,
|
||||
ctx: &LocalContext,
|
||||
errors: impl IntoIterator<Item = &'a TypstDiagnostic>,
|
||||
) -> DiagnosticsMap {
|
||||
errors
|
||||
|
|
@ -15,7 +15,7 @@ pub fn convert_diagnostics<'a>(
|
|||
.flat_map(|error| {
|
||||
convert_diagnostic(ctx, error)
|
||||
.map_err(move |conversion_err| {
|
||||
error!("could not convert Typst error to diagnostic: {conversion_err:?} error to convert: {error:?}");
|
||||
log::error!("could not convert Typst error to diagnostic: {conversion_err:?} error to convert: {error:?}");
|
||||
})
|
||||
})
|
||||
.collect::<Vec<_>>()
|
||||
|
|
@ -24,7 +24,7 @@ pub fn convert_diagnostics<'a>(
|
|||
}
|
||||
|
||||
fn convert_diagnostic(
|
||||
ctx: &AnalysisContext,
|
||||
ctx: &LocalContext,
|
||||
typst_diagnostic: &TypstDiagnostic,
|
||||
) -> anyhow::Result<(Url, LspDiagnostic)> {
|
||||
let uri;
|
||||
|
|
@ -64,7 +64,7 @@ fn convert_diagnostic(
|
|||
}
|
||||
|
||||
fn tracepoint_to_relatedinformation(
|
||||
project: &AnalysisContext,
|
||||
project: &LocalContext,
|
||||
tracepoint: &Spanned<Tracepoint>,
|
||||
position_encoding: PositionEncoding,
|
||||
) -> anyhow::Result<Option<DiagnosticRelatedInformation>> {
|
||||
|
|
@ -89,7 +89,7 @@ fn tracepoint_to_relatedinformation(
|
|||
}
|
||||
|
||||
fn diagnostic_related_information(
|
||||
project: &AnalysisContext,
|
||||
project: &LocalContext,
|
||||
typst_diagnostic: &TypstDiagnostic,
|
||||
position_encoding: PositionEncoding,
|
||||
) -> anyhow::Result<Vec<DiagnosticRelatedInformation>> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue