refactor: rearrange imports (#1461)

This commit is contained in:
Myriad-Dreamin 2025-03-09 23:12:54 +08:00 committed by GitHub
parent 2ec7a26420
commit d35afa679a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 54 additions and 70 deletions

View file

@ -7,10 +7,10 @@ use lsp_types::notification::{Notification, PublishDiagnostics as PublishDiagnos
use lsp_types::{Diagnostic, Url};
use reflexo_typst::typst::prelude::{eco_vec, EcoVec};
use serde::{Deserialize, Serialize};
use tinymist_project::ProjectInsId;
use tinymist_query::DiagnosticsMap;
use tokio::sync::mpsc;
use crate::project::ProjectInsId;
use crate::{tool::word_count::WordsCount, LspClient};
/// The request to the editor actor.

View file

@ -8,10 +8,8 @@ use tinymist_std::error::IgnoreLogging;
use tokio::sync::{mpsc, oneshot};
use typst_preview::{ControlPlaneMessage, Previewer};
use crate::{
project::ProjectPreviewState,
tool::preview::{HttpServer, PreviewProjectHandler},
};
use crate::project::ProjectPreviewState;
use crate::tool::preview::{HttpServer, PreviewProjectHandler};
pub struct PreviewTab {
/// Task ID

View file

@ -1,12 +1,9 @@
use std::path::Path;
use sync_lsp::transport::MirrorArgs;
use tinymist::{
project::DocCommands,
tool::project::{CompileArgs, GenerateScriptArgs, TaskCommands},
CompileFontArgs, CompileOnceArgs,
};
use tinymist::project::DocCommands;
use tinymist::tool::project::{CompileArgs, GenerateScriptArgs, TaskCommands};
use tinymist::{CompileFontArgs, CompileOnceArgs};
use tinymist_core::LONG_VERSION;
#[derive(Debug, Clone, clap::Parser)]

View file

@ -1,7 +1,6 @@
use std::path::{Path, PathBuf};
use std::sync::Arc;
use crate::project::font::TinymistFontResolver;
use anyhow::bail;
use clap::Parser;
use itertools::Itertools;
@ -13,10 +12,6 @@ use serde::{Deserialize, Serialize};
use serde_json::{json, Map, Value as JsonValue};
use strum::IntoEnumIterator;
use task::{ExportUserConfig, FormatUserConfig, FormatterConfig};
use tinymist_project::{
EntryResolver, ExportPdfTask, ExportTask, PathPattern, ProjectResolutionKind, ProjectTask,
TaskWhen,
};
use tinymist_query::analysis::{Modifier, TokenType};
use tinymist_query::{CompletionFeat, PositionEncoding};
use tinymist_render::PeriscopeArgs;
@ -29,7 +24,11 @@ use typst_shim::utils::LazyHash;
// textDocument.definition.linkSupport capability.
use super::*;
use crate::project::ImmutDict;
use crate::project::font::TinymistFontResolver;
use crate::project::{
EntryResolver, ExportPdfTask, ExportTask, ImmutDict, PathPattern, ProjectResolutionKind,
ProjectTask, TaskWhen,
};
/// Capability to add valid commands to the arguments.
pub trait AddCommands {

View file

@ -1,11 +1,11 @@
use lsp_types::*;
use reflexo_typst::Bytes;
use tinymist_project::{Interrupt, ProjectResolutionKind};
use tinymist_query::{to_typst_range, PositionEncoding};
use tinymist_std::error::prelude::*;
use tinymist_std::ImmutPath;
use typst::{diag::FileResult, syntax::Source};
use crate::project::{Interrupt, ProjectResolutionKind};
use crate::route::ProjectResolution;
use crate::world::vfs::{notify::MemoryEvent, FileChangeSet};
use crate::world::TaskInputs;

View file

@ -6,15 +6,15 @@ use lsp_types::request::GotoDeclarationParams;
use lsp_types::*;
use serde::{Deserialize, Serialize};
use sync_lsp::*;
use tinymist_project::{EntryState, TaskInputs, DETACHED_ENTRY};
use tinymist_query::SyntaxRequest;
use tinymist_query::{
CompilerQueryRequest, CompilerQueryResponse, FoldRequestFeature, SyntaxRequest,
};
use tinymist_std::{ImmutPath, Result};
use super::ServerState;
use crate::project::{EntryState, TaskInputs, DETACHED_ENTRY};
use crate::{as_path, as_path_, as_path_pos, FormatterMode};
use tinymist_query::{CompilerQueryRequest, CompilerQueryResponse, FoldRequestFeature};
/// The future type for a lsp query.
pub type QueryFuture = Result<ResponseFuture<Result<CompilerQueryResponse>>>;

View file

@ -2,11 +2,9 @@
mod args;
use std::{
io,
path::{Path, PathBuf},
str::FromStr,
};
use std::io;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use clap::Parser;
use clap_builder::CommandFactory;
@ -17,16 +15,12 @@ use once_cell::sync::Lazy;
use reflexo::ImmutPath;
use reflexo_typst::package::PackageSpec;
use serde_json::Value as JsonValue;
use sync_lsp::{
internal_error,
transport::{with_stdio_transport, MirrorArgs},
LspBuilder, LspClientRoot, LspResult,
};
use tinymist::{tool::project::generate_script_main, world::TaskInputs};
use tinymist::{
tool::project::{compile_main, project_main, task_main},
CompileConfig, Config, RegularInit, ServerState, SuperInit, UserActionTask,
};
use sync_lsp::internal_error;
use sync_lsp::transport::{with_stdio_transport, MirrorArgs};
use sync_lsp::{LspBuilder, LspClientRoot, LspResult};
use tinymist::tool::project::{compile_main, generate_script_main, project_main, task_main};
use tinymist::world::TaskInputs;
use tinymist::{CompileConfig, Config, RegularInit, ServerState, SuperInit, UserActionTask};
use tinymist_core::LONG_VERSION;
use tinymist_project::EntryResolver;
use tinymist_query::package::PackageInfo;

View file

@ -39,12 +39,10 @@ use tokio::sync::mpsc;
use typst::{diag::FileResult, foundations::Bytes, layout::Position as TypstPosition};
use super::ServerState;
use crate::actor::editor::{CompileStatus, CompileStatusEnum, EditorRequest, ProjVersion};
use crate::stats::{CompilerQueryStats, QueryStatGuard};
use crate::{
actor::editor::{CompileStatus, CompileStatusEnum, EditorRequest, ProjVersion},
ServerEvent,
};
use crate::{task::ExportUserConfig, Config};
use crate::task::ExportUserConfig;
use crate::{Config, ServerEvent};
type EditorSender = mpsc::UnboundedSender<EditorRequest>;

View file

@ -1,11 +1,11 @@
use std::sync::Arc;
use serde::{Deserialize, Serialize};
use tinymist_project::LspCompileSnapshot;
use tinymist_std::debug_loc::DataSource;
use typst::text::{FontStretch, FontStyle, FontWeight};
use super::prelude::*;
use crate::project::LspCompileSnapshot;
use crate::world::font::FontResolver;
#[derive(Debug, Clone, Serialize, Deserialize)]

View file

@ -3,14 +3,13 @@ use std::{collections::BTreeMap, path::Path, sync::Arc};
use reflexo_typst::TypstPagedDocument;
use reflexo_typst::{vector::font::GlyphId, TypstFont};
use sync_lsp::LspResult;
use tinymist_project::LspCompileSnapshot;
use tinymist_std::typst::TypstDocument;
use typst::foundations::Bytes;
use typst::{syntax::VirtualPath, World};
use crate::world::{base::ShadowApi, EntryState, TaskInputs};
use super::prelude::*;
use crate::project::LspCompileSnapshot;
use crate::world::{base::ShadowApi, EntryState, TaskInputs};
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]

View file

@ -2,11 +2,12 @@ use std::{path::Path, sync::Arc};
use reflexo_typst::{path::unix_slash, typst::prelude::EcoVec, LazyHash};
use rpds::RedBlackTreeMapSync;
use tinymist_project::{Id, LockFile, LspCompileSnapshot, ProjectPathMaterial, ProjectRoute};
use tinymist_query::LspWorldExt;
use tinymist_std::{hash::FxHashMap, ImmutPath};
use typst::diag::EcoString;
use crate::project::{Id, LockFile, LspCompileSnapshot, ProjectPathMaterial, ProjectRoute};
#[derive(Default)]
pub struct ProjectRouteState {
path_routes: FxHashMap<ImmutPath, RoutePathState>,

View file

@ -5,7 +5,6 @@ use std::sync::Arc;
use lsp_types::*;
use sync_lsp::*;
use tinymist_project::{CompiledArtifact, EntryResolver, LspCompileSnapshot, ProjectInsId};
use tinymist_query::{LspWorldExt, OnExportRequest, ServerInfoResponse};
use tinymist_std::error::prelude::*;
use tinymist_std::ImmutPath;
@ -14,7 +13,10 @@ use typst::syntax::Source;
use crate::actor::editor::{EditorActor, EditorRequest};
use crate::lsp_query::OnEnter;
use crate::project::{update_lock, LspInterrupt, ProjectState, PROJECT_ROUTE_USER_ACTION_PRIORITY};
use crate::project::{
update_lock, CompiledArtifact, EntryResolver, LspCompileSnapshot, LspInterrupt, ProjectInsId,
ProjectState, PROJECT_ROUTE_USER_ACTION_PRIORITY,
};
use crate::route::ProjectRouteState;
use crate::task::{ExportTask, FormatTask, UserActionTask};
use crate::world::TaskInputs;

View file

@ -1,10 +1,8 @@
//! Statistics about the analyzers
use std::{
path::{Path, PathBuf},
sync::{Arc, OnceLock},
time::Duration,
};
use std::path::{Path, PathBuf};
use std::sync::{Arc, OnceLock};
use std::time::Duration;
use parking_lot::Mutex;
use reflexo::{hash::FxDashMap, path::unix_slash};

View file

@ -3,15 +3,7 @@
use std::str::FromStr;
use std::{path::PathBuf, sync::Arc};
use crate::project::{
ApplyProjectTask, CompiledArtifact, ExportHtmlTask, ExportMarkdownTask, ExportPdfTask,
ExportPngTask, ExportTextTask, TaskWhen,
};
use reflexo::ImmutPath;
use tinymist_project::{
convert_source_date_epoch, EntryReader, ExportSvgTask, ExportTask as ProjectExportTask,
LspCompiledArtifact, ProjectTask, QueryTask,
};
use tinymist_std::error::prelude::*;
use tinymist_std::typst::TypstDocument;
use tinymist_task::{convert_datetime, get_page_selection, ExportTarget, TextExport};
@ -21,9 +13,14 @@ use typst::foundations::IntoValue;
use typst::visualize::Color;
use typst_pdf::PdfOptions;
use crate::{actor::editor::EditorRequest, tool::word_count};
use super::{FutureFolder, SyncTaskFactory};
use crate::project::{
convert_source_date_epoch, ApplyProjectTask, CompiledArtifact, EntryReader, ExportHtmlTask,
ExportMarkdownTask, ExportPdfTask, ExportPngTask, ExportSvgTask,
ExportTask as ProjectExportTask, ExportTextTask, LspCompiledArtifact, ProjectTask, QueryTask,
TaskWhen,
};
use crate::{actor::editor::EditorRequest, tool::word_count};
#[derive(Clone)]
pub struct ExportTask {

View file

@ -4,14 +4,16 @@ use std::sync::Arc;
use reflexo_typst::{Bytes, CompilerFeat, EntryReader, ExportWebSvgHtmlTask, WebSvgHtmlExport};
use reflexo_vec2svg::DefaultExportFeature;
use tinymist_project::{HtmlExport, LspCompilerFeat, PdfExport, PngExport, SvgExport, TaskWhen};
use tinymist_std::error::prelude::*;
use tinymist_std::typst::TypstPagedDocument;
use tinymist_task::{ExportTimings, TextExport};
use typlite::Typlite;
use typst::diag::SourceResult;
use crate::project::{ExportMarkdownTask, ProjectTask};
use crate::project::{
ExportMarkdownTask, HtmlExport, LspCompilerFeat, PdfExport, PngExport, ProjectTask, SvgExport,
TaskWhen,
};
use crate::world::base::{
ConfigTask, DiagnosticsTask, ExportComputation, FlagTask, HtmlCompilationTask,
OptionDocumentTask, PagedCompilationTask, WorldComputable, WorldComputeGraph,

View file

@ -11,10 +11,10 @@ use reflexo_typst::{TypstDict, TypstPagedDocument};
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
use sync_lsp::{just_future, LspClient, SchedulableResponse};
use tinymist_project::LspWorld;
use tinymist_std::error::IgnoreLogging;
use typst::{syntax::Span, World};
use crate::project::LspWorld;
use crate::{internal_error, ServerState};
#[derive(Debug, Clone, Serialize, Deserialize)]

View file

@ -22,7 +22,6 @@ use serde::Serialize;
use serde_json::Value as JsonValue;
use sync_lsp::just_ok;
use tinymist_assets::TYPST_PREVIEW_HTML;
use tinymist_project::{LspWorld, ProjectInsId, WorldProvider};
use tinymist_std::error::IgnoreLogging;
use tinymist_std::typst::TypstDocument;
use tokio::sync::{mpsc, oneshot};
@ -38,8 +37,8 @@ use typst_preview::{
use typst_shim::syntax::LinkedNodeExt;
use crate::project::{
CompileHandlerImpl, CompileServerOpts, LspCompiledArtifact, LspInterrupt, ProjectClient,
ProjectCompiler, ProjectState,
CompileHandlerImpl, CompileServerOpts, LspCompiledArtifact, LspInterrupt, LspWorld,
ProjectClient, ProjectCompiler, ProjectInsId, ProjectState, WorldProvider,
};
use crate::*;
use actor::preview::{PreviewActor, PreviewRequest, PreviewTab};