mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-22 04:26:51 +00:00
fix: update code and docs about syntax mode (#2248)
which was detected by gemini review.
This commit is contained in:
parent
9d5beb196b
commit
f5db6e8d31
3 changed files with 13 additions and 9 deletions
|
|
@ -7,8 +7,12 @@ mod system {
|
||||||
::battery::Manager::new()
|
::battery::Manager::new()
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(|manager| manager.batteries().ok())
|
.and_then(|manager| manager.batteries().ok())
|
||||||
.map(|mut batteries| {
|
.map(|batteries| {
|
||||||
batteries.any(|battery| match battery {
|
let mut batteries = batteries.peekable();
|
||||||
|
if batteries.peek().is_none() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
batteries.all(|battery| match battery {
|
||||||
Ok(bat) => matches!(bat.state(), ::battery::State::Discharging),
|
Ok(bat) => matches!(bat.state(), ::battery::State::Discharging),
|
||||||
Err(_) => false,
|
Err(_) => false,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ pub static SYNTAX_ONLY: AtomicBool = AtomicBool::new(false);
|
||||||
|
|
||||||
/// Check if syntax-only mode is enabled.
|
/// Check if syntax-only mode is enabled.
|
||||||
pub fn is_syntax_only() -> bool {
|
pub fn is_syntax_only() -> bool {
|
||||||
SYNTAX_ONLY.load(Ordering::Relaxed)
|
SYNTAX_ONLY.load(Ordering::Acquire)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Compile the document if syntax-only mode is disabled; otherwise, return an
|
/// Compile the document if syntax-only mode is disabled; otherwise, return an
|
||||||
|
|
|
||||||
|
|
@ -7,18 +7,18 @@ The syntax-only mode is available since `tinymist` v0.14.2.
|
||||||
When working under power-saving mode or with resource-consumed projects, typst compilations costs too much CPU and memory resources. From a simple test on a typst document with 200 pages, containing complex figures and WASM plugin calls, editing a large `.typ` file on a windows laptop (i9-12900H), the CPU and memory usage are as follows:
|
When working under power-saving mode or with resource-consumed projects, typst compilations costs too much CPU and memory resources. From a simple test on a typst document with 200 pages, containing complex figures and WASM plugin calls, editing a large `.typ` file on a windows laptop (i9-12900H), the CPU and memory usage are as follows:
|
||||||
|
|
||||||
#align(center, table(
|
#align(center, table(
|
||||||
columns: 3,
|
columns: 4,
|
||||||
[Mode], [CPU Usage], [Memory Usage],
|
[Mode], [CPU Usage], [Memory Usage (Code Compilation)], [Memory Usage (Incremental Compilation)],
|
||||||
[Normal Mode], [5% \~ 12%], [0.9\~1.184 GB],
|
[Normal Mode], [5% \~ 12%], [2.72 GB], [6.62\~8.73GB],
|
||||||
[Syntax-Only Mode], [0% \~ 0.6%], [15.1\~16.0 MB],
|
[Syntax-Only Mode], [0% \~ 0.6%], [15.0 MB], [15.1\~16.0 MB],
|
||||||
))
|
))
|
||||||
|
|
||||||
You can configure the extension to run in syntax only mode, i.e. only performing elementary tasks, like syntax checking, syntax-only code analysis and formatting by setting the `tinymist.syntaxOnly` to `enable` or `onPowerSaving` in the configuration.
|
You can configure the extension to run in syntax only mode, i.e. only performing elementary tasks, like syntax checking, syntax-only code analysis and formatting by setting the `tinymist.syntaxOnly` to `enable` or `onPowerSaving` in the configuration.
|
||||||
|
|
||||||
The syntax-only mode is known to disable or disallowed:
|
The syntax-only mode is known to disable or limit the functionality of the following features:
|
||||||
- typst preview feature.
|
- typst preview feature.
|
||||||
- label completion.
|
|
||||||
- compilation diagnostics.
|
- compilation diagnostics.
|
||||||
|
- label completion.
|
||||||
|
|
||||||
The syntax-only mode will be able to work with following features:
|
The syntax-only mode will be able to work with following features:
|
||||||
- export PDF or other formats.
|
- export PDF or other formats.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue