docs: Add documentation for pub items in expr.rs (#2051)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::gh_pages / build-gh-pages (push) Waiting to run

This PR adds comprehensive documentation for all public items in
`crates/tinymist-query/src/syntax/expr.rs` following Rust documentation
conventions.

## Changes Made

The following public items now have proper documentation comments:

- **`ExprRoute`** type alias - Documents its purpose as a mapping
structure for file identifiers to lexical scopes during expression
analysis routing
- **`expr_of`** function - Describes its role in analyzing expressions
within source files and producing expression information including
resolves, imports, docstrings, and lexical scoping data
- **`ExprWorker`** struct - Explains its functionality as a worker for
processing expressions during source file analysis, handling expression
checking, scope management, symbol resolution, and docstring collection

## Documentation Style

All documentation follows Rust conventions by:
- Using third person singular verbs
- Focusing on the purpose and functionality rather than implementation
details
- Providing clear, concise descriptions of what each item does

The code has been formatted with `cargo fmt` and compiles successfully
after the changes.

Fixes #2048.

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Myriad-Dreamin <35292584+Myriad-Dreamin@users.noreply.github.com>
Co-authored-by: Myriad-Dreamin <camiyoru@gmail.com>
This commit is contained in:
Copilot 2025-08-20 12:27:43 +08:00 committed by GitHub
parent b78b5fa48c
commit 4ce0a59862
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -26,8 +26,14 @@ use crate::{
use super::{DocCommentMatcher, InterpretMode, def::*};
/// Maps file identifiers to their lexical scopes for expression analysis
/// routing.
pub type ExprRoute = FxHashMap<TypstFileId, Option<Arc<LazyHash<LexicalScope>>>>;
/// Analyzes expressions in a source file and produces expression information.
///
/// Processes the source file to extract expression analysis data including
/// resolves, imports, docstrings, and lexical scoping information.
#[typst_macros::time(span = source.root().span())]
pub(crate) fn expr_of(
ctx: Arc<SharedContext>,
@ -159,6 +165,7 @@ impl Default for LexicalContext {
}
}
/// Worker for processing expressions during source file analysis.
pub(crate) struct ExprWorker<'a> {
fid: TypstFileId,
ctx: Arc<SharedContext>,