fix: improve release profile & fix typos (#177)

* dev: split a gh-release profile to accelerate development

* fix: many typos

* fix: miri warnings

* fix: update fixtures
This commit is contained in:
QuarticCat 2024-04-10 11:34:18 +08:00 committed by GitHub
parent e7acb31a54
commit ebed95cbcd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 159 additions and 71 deletions

View file

@ -78,7 +78,7 @@ impl Analysis {
.modules
.values()
.map(|v| {
v.def_use_lexical_heirarchy
v.def_use_lexical_hierarchy
.output
.as_ref()
.map_or(0, |e| e.iter().map(|e| e.estimated_memory()).sum())
@ -145,13 +145,13 @@ impl<Inputs, Output> ComputingNode<Inputs, Output> {
///
/// You should not holds across requests, because source code may change.
pub struct ModuleAnalysisGlobalCache {
def_use_lexical_heirarchy: ComputingNode<Source, EcoVec<LexicalHierarchy>>,
def_use_lexical_hierarchy: ComputingNode<Source, EcoVec<LexicalHierarchy>>,
}
impl Default for ModuleAnalysisGlobalCache {
fn default() -> Self {
Self {
def_use_lexical_heirarchy: ComputingNode::new("def_use_lexical_heirarchy"),
def_use_lexical_hierarchy: ComputingNode::new("def_use_lexical_hierarchy"),
}
}
}
@ -172,7 +172,7 @@ pub struct AnalysisCaches {
}
/// The resources for analysis.
pub trait AnaylsisResources {
pub trait AnalysisResources {
/// Get the world surface for Typst compiler.
fn world(&self) -> &dyn World;
@ -201,7 +201,7 @@ pub trait AnaylsisResources {
/// The context for analyzers.
pub struct AnalysisContext<'a> {
/// The world surface for Typst compiler
pub resources: &'a dyn AnaylsisResources,
pub resources: &'a dyn AnalysisResources,
/// The analysis data
pub analysis: CowMut<'a, Analysis>,
caches: AnalysisCaches,
@ -209,7 +209,7 @@ pub struct AnalysisContext<'a> {
impl<'w> AnalysisContext<'w> {
/// Create a new analysis context.
pub fn new(resources: &'w dyn AnaylsisResources, a: Analysis) -> Self {
pub fn new(resources: &'w dyn AnalysisResources, a: Analysis) -> Self {
Self {
resources,
analysis: CowMut::Owned(a),
@ -218,7 +218,7 @@ impl<'w> AnalysisContext<'w> {
}
/// Create a new analysis context with borrowing the analysis data.
pub fn new_borrow(resources: &'w dyn AnaylsisResources, a: &'w mut Analysis) -> Self {
pub fn new_borrow(resources: &'w dyn AnalysisResources, a: &'w mut Analysis) -> Self {
Self {
resources,
analysis: CowMut::Borrowed(a),
@ -355,7 +355,7 @@ impl<'w> AnalysisContext<'w> {
.modules
.entry(source.id())
.or_default()
.def_use_lexical_heirarchy
.def_use_lexical_hierarchy
.compute(source, |_before, after| {
crate::syntax::get_lexical_hierarchy(after, crate::syntax::LexicalScopeKind::DefUse)
})

View file

@ -310,7 +310,6 @@ fn complete_path(
#[cfg(test)]
mod tests {
use insta::with_settings;
use lsp_types::{CompletionItem, CompletionList};
use super::*;
use crate::tests::*;

View file

@ -1,4 +1,4 @@
use crate::{path_to_url, prelude::*};
use crate::prelude::*;
/// Stores diagnostics for files.
pub type DiagnosticsMap = HashMap<Url, Vec<LspDiagnostic>>;

View file

@ -1,6 +1,6 @@
---
source: crates/tinymist-query/src/inlay_hint.rs
expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/inlay_hints/imcomplete-expression.typ
input_file: crates/tinymist-query/src/fixtures/inlay_hints/incomplete-expression.typ
---
[]

View file

@ -1,7 +1,6 @@
use std::ops::Range;
use log::debug;
use lsp_types::LocationLink;
use crate::{
prelude::*,
@ -70,7 +69,7 @@ impl SemanticRequest for GotoDeclarationRequest {
});
}
debug!("goto_declartion: {links:?}");
debug!("goto_declaration: {links:?}");
Some(GotoDeclarationResponse::Link(links))
}
}

View file

@ -1,7 +1,6 @@
use std::ops::Range;
use log::debug;
use typst::foundations::Value;
use typst::syntax::FileId as TypstFileId;
use crate::{
@ -122,7 +121,7 @@ pub(crate) fn find_definition(
}
};
// syntatic definition
// syntactic definition
let def_use = ctx.def_use(source)?;
let ident_ref = match use_site.cast::<ast::Expr>()? {
ast::Expr::Ident(e) => IdentRef {

View file

@ -175,7 +175,7 @@ mod polymorphic {
pub struct ServerInfoRequest {}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ServerInfoReponse {
pub struct ServerInfoResponse {
pub root: Option<PathBuf>,
#[serde(rename = "fontPaths")]
pub font_paths: Vec<PathBuf>,
@ -188,7 +188,7 @@ mod polymorphic {
pub enum FoldRequestFeature {
PinnedFirst,
Unique,
Mergable,
Mergeable,
ContextFreeUnique,
}
@ -224,8 +224,8 @@ mod polymorphic {
pub fn fold_feature(&self) -> FoldRequestFeature {
use FoldRequestFeature::*;
match self {
CompilerQueryRequest::OnExport(..) => Mergable,
CompilerQueryRequest::OnSaveExport(..) => Mergable,
CompilerQueryRequest::OnExport(..) => Mergeable,
CompilerQueryRequest::OnSaveExport(..) => Mergeable,
CompilerQueryRequest::Hover(..) => PinnedFirst,
CompilerQueryRequest::GotoDefinition(..) => PinnedFirst,
CompilerQueryRequest::GotoDeclaration(..) => PinnedFirst,
@ -234,12 +234,12 @@ mod polymorphic {
CompilerQueryRequest::DocumentColor(..) => PinnedFirst,
CompilerQueryRequest::ColorPresentation(..) => ContextFreeUnique,
CompilerQueryRequest::CodeLens(..) => Unique,
CompilerQueryRequest::Completion(..) => Mergable,
CompilerQueryRequest::Completion(..) => Mergeable,
CompilerQueryRequest::SignatureHelp(..) => PinnedFirst,
CompilerQueryRequest::Rename(..) => Mergable,
CompilerQueryRequest::PrepareRename(..) => Mergable,
CompilerQueryRequest::Rename(..) => Mergeable,
CompilerQueryRequest::PrepareRename(..) => Mergeable,
CompilerQueryRequest::DocumentSymbol(..) => ContextFreeUnique,
CompilerQueryRequest::Symbol(..) => Mergable,
CompilerQueryRequest::Symbol(..) => Mergeable,
CompilerQueryRequest::SemanticTokensFull(..) => ContextFreeUnique,
CompilerQueryRequest::SemanticTokensDelta(..) => ContextFreeUnique,
CompilerQueryRequest::Formatting(..) => ContextFreeUnique,
@ -247,7 +247,7 @@ mod polymorphic {
CompilerQueryRequest::SelectionRange(..) => ContextFreeUnique,
CompilerQueryRequest::DocumentMetrics(..) => PinnedFirst,
CompilerQueryRequest::ServerInfo(..) => Mergable,
CompilerQueryRequest::ServerInfo(..) => Mergeable,
}
}
@ -306,7 +306,7 @@ mod polymorphic {
SelectionRange(Option<Vec<SelectionRange>>),
DocumentMetrics(Option<DocumentMetricsResponse>),
ServerInfo(Option<HashMap<String, ServerInfoReponse>>),
ServerInfo(Option<HashMap<String, ServerInfoResponse>>),
}
}

View file

@ -372,8 +372,6 @@ mod test {
use lsp_types::Position;
use typst::syntax::Source;
use crate::{lsp_to_typst, PositionEncoding};
use super::*;
#[test]

View file

@ -45,7 +45,7 @@ pub fn find_source_by_expr(
current: TypstFileId,
e: ast::Expr,
) -> Option<Source> {
// todo: this could be vaild: import("path.typ"), where v is parenthesized
// todo: this could be valid: import("path.typ"), where v is parenthesized
match e {
ast::Expr::Str(s) => find_source_by_import_path(world, current, s.get().as_str()),
_ => None,

View file

@ -1,4 +1,4 @@
use std::{collections::HashMap, sync::Once};
use std::sync::Once;
use super::find_imports;
use crate::prelude::*;

View file

@ -27,14 +27,14 @@ pub use insta::assert_snapshot;
pub use typst_ts_compiler::TypstSystemWorld;
use crate::{
analysis::{Analysis, AnaylsisResources},
analysis::{Analysis, AnalysisResources},
prelude::AnalysisContext,
typst_to_lsp, LspPosition, PositionEncoding,
};
struct WrapWorld<'a>(&'a mut TypstSystemWorld);
impl<'a> AnaylsisResources for WrapWorld<'a> {
impl<'a> AnalysisResources for WrapWorld<'a> {
fn world(&self) -> &dyn typst::World {
self.0
}