Að leggja til¶
- Höfundur:
Rohit Goswami
Þróunaruppsetning¶
git clone https://github.com/TurtleTech-ehf/snapper
cd snapper
cargo build
cargo test
Með pixi:
pixi run -e dev check
Keyra prófanir¶
cargo fmt --check
cargo clippy -- -D warnings
cargo test
Sjálfsprófun (staðfesta að öll skjöl standist sníðmótun):
pixi run -e dev dogfood
Verkefnisbygging¶
src/
main.rs -- Entry point, CLI dispatch, subcommand routing
lib.rs -- Public API: format_text(), FormatConfig, build_splitter()
cli.rs -- Clap derive CLI + subcommands (init, sdiff, git-diff, watch, lsp)
config.rs -- .snapperrc.toml serde-based config with per-format sections
format.rs -- Format enum + auto-detection from extension
diff.rs -- Unified diff output for --diff mode
sdiff.rs -- Sentence-level diff (snapper sdiff)
git_diff.rs -- Git-aware sentence diff (snapper git-diff)
init.rs -- Project initialization (snapper init)
lsp.rs -- LSP server (snapper lsp) via tower-lsp
watch.rs -- File watcher (snapper watch) via notify
output.rs -- JSON/SARIF output for --check mode
abbreviations.rs -- Multi-language abbreviation lists (en, de, fr, is, pl)
reflow.rs -- Core reflow engine (regions + splitter -> output)
files.rs -- File-level formatting utilities
sentence/
mod.rs -- SentenceSplitter trait
unicode.rs -- UAX #29 + abbreviation merge + placeholder system
neural.rs -- nnsplit LSTM sentence detection (9 languages)
parser/
mod.rs -- Region enum, FormatParser trait, pragma support
org.rs -- Org-mode parser
latex.rs -- LaTeX parser
markdown.rs -- Markdown parser
rst.rs -- reStructuredText parser
plaintext.rs -- Plaintext parser (everything is prose)
editors/
vscode/ -- VS Code extension (LSP client)
tests/
integration.rs -- Integration tests (format, check, idempotency, stdin)
fixtures/ -- Sample input/expected output pairs per format
vale/
snapper/ -- Vale style rules for editor hints
site/ -- Landing page (static HTML)
docs/
orgmode/ -- Documentation source (org-mode)
source/ -- Sphinx config + templates
export.el -- Batch org -> RST exporter
Innleggjavenjur¶
Innlegg fylgja stöðluðum innleggjum, stýrt af cocogitto (cog):
feat:nýir eiginleikar
fix:villuleiðréttingar
doc:breytingar á skjölun
chore:viðhald, uppfærsla á háðum pökkum
tst:breytingar á prófunum
bld:breytingar á byggingarkerfi
Byggja skjölun¶
pixi run -e docs docbld
Eða handvirkt:
emacs --batch -l docs/export.el
sphinx-build docs/source docs/build -b html
Bæta við nýjum sniðþáttara¶
Búðu til
src/parser/yourformat.rssem útfærirFormatParsereiginleikannBættu afbrigðinu við
Formatupptalninguna ísrc/format.rsTengdu það inn í
format_text()ísrc/lib.rsBættu við skráarendingarvörpun í
Format::from_path()Bættu við prófunargögnum í
tests/fixtures/(sample.fmt+expected.fmt)Bættu við samþættingarprófunum í
tests/integration.rsSkjalaðu í
docs/orgmode/reference/formats.org