atrep-cli 0.3.1__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/Cargo.lock +2 -9
  2. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/Cargo.toml +4 -2
  3. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/PKG-INFO +11 -7
  4. {atrep_cli-0.3.1/crates/atrep → atrep_cli-0.3.2}/README.md +9 -5
  5. {atrep_cli-0.3.1/crates/atrep-cli → atrep_cli-0.3.2/crates/atrep}/README.md +9 -5
  6. atrep_cli-0.3.2/crates/atrep-cli/Cargo.toml +30 -0
  7. atrep_cli-0.3.2/crates/atrep-cli/LSP.md +95 -0
  8. {atrep_cli-0.3.1 → atrep_cli-0.3.2/crates/atrep-cli}/README.md +9 -5
  9. atrep_cli-0.3.2/crates/atrep-cli/src/lsp/analysis.rs +102 -0
  10. atrep_cli-0.3.2/crates/atrep-cli/src/lsp/main.rs +341 -0
  11. atrep_cli-0.3.2/crates/atrep-cli/src/lsp/scan.rs +81 -0
  12. atrep_cli-0.3.2/crates/atrep-cli/src/lsp/structure.rs +566 -0
  13. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/pyproject.toml +5 -4
  14. atrep_cli-0.3.1/crates/atrep-cli/Cargo.toml +0 -18
  15. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/LICENSE-APACHE +0 -0
  16. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/LICENSE-MIT +0 -0
  17. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/Cargo.toml +0 -0
  18. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/atramento.rs +0 -0
  19. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/dendron.rs +0 -0
  20. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/dialektos.rs +0 -0
  21. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/endo.rs +0 -0
  22. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/error.rs +0 -0
  23. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/exo.rs +0 -0
  24. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/fetch.rs +0 -0
  25. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/glossa.rs +0 -0
  26. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/kanonizo.rs +0 -0
  27. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/lib.rs +0 -0
  28. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/litosis.rs +0 -0
  29. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/morph.rs +0 -0
  30. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/outline.rs +0 -0
  31. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/parser.rs +0 -0
  32. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/scan.rs +0 -0
  33. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/sigil.rs +0 -0
  34. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/source.rs +0 -0
  35. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/src/zygosis.rs +0 -0
  36. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-djot.at-markdown.iso +0 -0
  37. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-djot.dia +0 -0
  38. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-djot.dj.exo +0 -0
  39. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-docbook.dia +0 -0
  40. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-docbook.docbook.exo +0 -0
  41. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-docbook.litogramma.hom +0 -0
  42. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-drama.dia +0 -0
  43. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-html.at-markdown.hom +0 -0
  44. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-html.at-org.hom +0 -0
  45. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-html.at-rst.hom +0 -0
  46. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-html.dia +0 -0
  47. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-html.html.exo +0 -0
  48. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-html.xhtml.exo +0 -0
  49. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-markdown.dia +0 -0
  50. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-markdown.md.exo +0 -0
  51. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-org.at-html.hom +0 -0
  52. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-org.dia +0 -0
  53. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-org.org.exo +0 -0
  54. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-poesia.dia +0 -0
  55. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-prosa.dia +0 -0
  56. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-rst.at-html.hom +0 -0
  57. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-rst.dia +0 -0
  58. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-rst.rst.exo +0 -0
  59. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-tei.dia +0 -0
  60. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-tei.tei.exo +0 -0
  61. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.dia +0 -0
  62. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.latex.a5.exo +0 -0
  63. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.latex.exo +0 -0
  64. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.latex.redletter.exo +0 -0
  65. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.latex.ru.exo +0 -0
  66. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.osis.exo +0 -0
  67. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.usfm.exo +0 -0
  68. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/at-usfm.usx.exo +0 -0
  69. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/bibliogramma.bib.exo +0 -0
  70. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/bibliogramma.bibtex.exo +0 -0
  71. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/bibliogramma.dia +0 -0
  72. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/koine.dia +0 -0
  73. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/koine.latex.exo +0 -0
  74. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/litogramma.at-docbook.hom +0 -0
  75. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/litogramma.at-html.hom +0 -0
  76. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/litogramma.at-tei.hom +0 -0
  77. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/litogramma.dia +0 -0
  78. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/litogramma.gemtext.exo +0 -0
  79. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/litogramma.html.exo +0 -0
  80. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/std/litogramma.latex.exo +0 -0
  81. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/atramento.rs +0 -0
  82. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/attei.rs +0 -0
  83. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/autonym.rs +0 -0
  84. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/bibtex.rs +0 -0
  85. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/collate.rs +0 -0
  86. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/deixis.rs +0 -0
  87. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/djot.rs +0 -0
  88. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/docbook.rs +0 -0
  89. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/errors.rs +0 -0
  90. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/exo.rs +0 -0
  91. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/fixtures/base.dia +0 -0
  92. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/fixtures/child.dia +0 -0
  93. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/fixtures/exempli.html.exo +0 -0
  94. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/fixtures/exempli.lektos +0 -0
  95. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/fixtures/intro.atd +0 -0
  96. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/fixtures/pipeline.svg +0 -0
  97. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/fixtures/steps.txt +0 -0
  98. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/golden.rs +0 -0
  99. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/html.rs +0 -0
  100. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/jats.rs +0 -0
  101. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/lektos.rs +0 -0
  102. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/lex0.rs +0 -0
  103. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/litogramma.rs +0 -0
  104. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/markdown.rs +0 -0
  105. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/metagraphe.rs +0 -0
  106. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/milestone.rs +0 -0
  107. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/morph.rs +0 -0
  108. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/org.rs +0 -0
  109. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/outline.rs +0 -0
  110. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/remote.rs +0 -0
  111. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/rst.rs +0 -0
  112. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/stichoi.rs +0 -0
  113. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/tasso.rs +0 -0
  114. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/tei.rs +0 -0
  115. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/usfm.rs +0 -0
  116. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/vocab.rs +0 -0
  117. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep/tests/zygo.rs +0 -0
  118. {atrep_cli-0.3.1 → atrep_cli-0.3.2}/crates/atrep-cli/src/main.rs +0 -0
@@ -60,7 +60,7 @@ dependencies = [
60
60
 
61
61
  [[package]]
62
62
  name = "atrep"
63
- version = "0.3.1"
63
+ version = "0.3.2"
64
64
  dependencies = [
65
65
  "flate2",
66
66
  "serde",
@@ -73,17 +73,10 @@ dependencies = [
73
73
 
74
74
  [[package]]
75
75
  name = "atrep-cli"
76
- version = "0.3.1"
76
+ version = "0.3.2"
77
77
  dependencies = [
78
78
  "atrep",
79
79
  "clap",
80
- ]
81
-
82
- [[package]]
83
- name = "atrep-lsp"
84
- version = "0.3.1"
85
- dependencies = [
86
- "atrep",
87
80
  "lsp-server",
88
81
  "lsp-types",
89
82
  "serde",
@@ -3,14 +3,14 @@ resolver = "2"
3
3
  members = ["crates/atrep", "crates/atrep-cli"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.3.1"
6
+ version = "0.3.2"
7
7
  edition = "2024"
8
8
  license = "MIT OR Apache-2.0"
9
9
  authors = ["Bojan Durickovic <dev@deyanovich.org>"]
10
10
  repository = "https://gitlab.com/atrep/atrep-rs"
11
11
 
12
12
  [workspace.dependencies]
13
- atrep = { path = "crates/atrep", version = "0.3.1" }
13
+ atrep = { path = "crates/atrep", version = "0.3.2" }
14
14
  unicode-normalization = "0.1"
15
15
  sha2 = "0.10"
16
16
  ureq = "3"
@@ -19,3 +19,5 @@ flate2 = "1"
19
19
  serde = { version = "1", features = ["derive"] }
20
20
  serde_json = "1"
21
21
  clap = { version = "4", features = ["derive"] }
22
+ lsp-server = "0.9"
23
+ lsp-types = "0.97"
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: atrep-cli
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Classifier: Development Status :: 4 - Beta
5
5
  Classifier: Intended Audience :: Developers
6
6
  Classifier: Programming Language :: Rust
7
7
  Classifier: Topic :: Text Processing :: Markup
8
8
  License-File: LICENSE-MIT
9
9
  License-File: LICENSE-APACHE
10
- Summary: The atrep command-line tool: check, respellings, outline, kanonizo, endo importers, morphisms, exo rendering, collation
10
+ Summary: The atrep command-line tool (check, respellings, outline, kanonizo, endo importers, morphisms, exo rendering, collation) and the atrep-lsp language server
11
11
  Keywords: atrep,markup,semantic,document,dialect,cli
12
12
  Author: Bojan Đuričković
13
13
  License-Expression: MIT OR Apache-2.0
@@ -43,11 +43,15 @@ spec revision.
43
43
  classes), `dialektos` (`.lektos`/`.dia` definitions, local
44
44
  inheritance and import), `parser` (document to Dendron),
45
45
  `dendron` (AST + canonical serializer), `kanonizo`, `litosis`.
46
- - `crates/atrep-cli` — the `atrep` binary.
47
- - `crates/atrep-lsp` the `atrep-lsp` language server:
48
- diagnostics + semantic-token highlighting for `.atd`/`.atk`
49
- documents and `.dia`/`.lektos` definitions (see its README
50
- for editor configuration).
46
+ - `crates/atrep-cli` — two binaries, one crate: the `atrep`
47
+ CLI, and the `atrep-lsp` language server (diagnostics +
48
+ semantic-token highlighting for `.atd`/`.atk` documents and
49
+ `.dia`/`.lektos` definitions, and over the outline —
50
+ document symbols, folding, onym definition and references,
51
+ selection ranges, and sim hover for documents; see
52
+ `crates/atrep-cli/LSP.md` for editor configuration). Both
53
+ ship with `cargo install atrep-cli` and the PyPI `atrep-cli`
54
+ wheel.
51
55
 
52
56
  ## Usage
53
57
 
@@ -26,11 +26,15 @@ spec revision.
26
26
  classes), `dialektos` (`.lektos`/`.dia` definitions, local
27
27
  inheritance and import), `parser` (document to Dendron),
28
28
  `dendron` (AST + canonical serializer), `kanonizo`, `litosis`.
29
- - `crates/atrep-cli` — the `atrep` binary.
30
- - `crates/atrep-lsp` the `atrep-lsp` language server:
31
- diagnostics + semantic-token highlighting for `.atd`/`.atk`
32
- documents and `.dia`/`.lektos` definitions (see its README
33
- for editor configuration).
29
+ - `crates/atrep-cli` — two binaries, one crate: the `atrep`
30
+ CLI, and the `atrep-lsp` language server (diagnostics +
31
+ semantic-token highlighting for `.atd`/`.atk` documents and
32
+ `.dia`/`.lektos` definitions, and over the outline —
33
+ document symbols, folding, onym definition and references,
34
+ selection ranges, and sim hover for documents; see
35
+ `crates/atrep-cli/LSP.md` for editor configuration). Both
36
+ ship with `cargo install atrep-cli` and the PyPI `atrep-cli`
37
+ wheel.
34
38
 
35
39
  ## Usage
36
40
 
@@ -26,11 +26,15 @@ spec revision.
26
26
  classes), `dialektos` (`.lektos`/`.dia` definitions, local
27
27
  inheritance and import), `parser` (document to Dendron),
28
28
  `dendron` (AST + canonical serializer), `kanonizo`, `litosis`.
29
- - `crates/atrep-cli` — the `atrep` binary.
30
- - `crates/atrep-lsp` the `atrep-lsp` language server:
31
- diagnostics + semantic-token highlighting for `.atd`/`.atk`
32
- documents and `.dia`/`.lektos` definitions (see its README
33
- for editor configuration).
29
+ - `crates/atrep-cli` — two binaries, one crate: the `atrep`
30
+ CLI, and the `atrep-lsp` language server (diagnostics +
31
+ semantic-token highlighting for `.atd`/`.atk` documents and
32
+ `.dia`/`.lektos` definitions, and over the outline —
33
+ document symbols, folding, onym definition and references,
34
+ selection ranges, and sim hover for documents; see
35
+ `crates/atrep-cli/LSP.md` for editor configuration). Both
36
+ ship with `cargo install atrep-cli` and the PyPI `atrep-cli`
37
+ wheel.
34
38
 
35
39
  ## Usage
36
40
 
@@ -0,0 +1,30 @@
1
+ [package]
2
+ name = "atrep-cli"
3
+ description = "atrep command-line tool and language server (pilot implementation)"
4
+ version.workspace = true
5
+ edition.workspace = true
6
+ license.workspace = true
7
+ repository.workspace = true
8
+ readme = "README.md"
9
+ keywords = ["atrep", "markup", "semantic", "document", "cli"]
10
+ categories = ["command-line-utilities", "text-processing"]
11
+
12
+ # Two binaries, one crate, one release: the `atrep` CLI for
13
+ # pipelines and the `atrep-lsp` language server for editors
14
+ # (LSP.md). Both ride the crates.io publish and the PyPI wheel.
15
+ [[bin]]
16
+ name = "atrep"
17
+ path = "src/main.rs"
18
+
19
+ [[bin]]
20
+ name = "atrep-lsp"
21
+ path = "src/lsp/main.rs"
22
+
23
+ [dependencies]
24
+ atrep.workspace = true
25
+ clap.workspace = true
26
+ lsp-server.workspace = true
27
+ lsp-types.workspace = true
28
+ serde.workspace = true
29
+ serde_json.workspace = true
30
+ unicode-normalization.workspace = true
@@ -0,0 +1,95 @@
1
+ # atrep-lsp
2
+
3
+ Language server for **atrep** documents (`.atd`/`.atk`) and
4
+ dialektos definitions (`.dia`/`.lektos`), over the `atrep`
5
+ engine. stdio transport. It is the second binary of the
6
+ `atrep-cli` crate — a thin transport over the engine, released
7
+ and distributed together with the `atrep` CLI (crates.io and
8
+ the PyPI `atrep-cli` wheel both carry it).
9
+
10
+ Surface:
11
+
12
+ - **Diagnostics** — the buffer is parsed on open and on every
13
+ change (`atrep` `check_source`: documents and definitions
14
+ are routed on the declaration line); the first parse error is
15
+ published with its source location.
16
+ - **Semantic tokens** (full-document) — lexical highlighting of
17
+ the declaration (`@@@!id@version`), sim and episim symbols,
18
+ monosim parameters (numeric taxis vs. onym), comments
19
+ (single- and multi-line, at any sigil-run depth), and escaped
20
+ sigils. When the document's dialektos resolves (locally beside
21
+ the file, or from the embedded std set — litogramma included),
22
+ symbols are matched against it with the parser's own
23
+ longest-match rule, and undefined sims render distinctly.
24
+ Alias-sigil (`\`) documents are handled.
25
+
26
+ Structural features, for documents whose outline assembles (the
27
+ engine's `atrep outline` data: block spans recorded by the
28
+ parser, milestones, onyms, deixes — dialektos-generic, so they
29
+ work for litogramma, lexigramma, at-docbook, or any dialektos
30
+ that resolves):
31
+
32
+ - **Document symbols** — the nested block tree (sim name plus
33
+ lemma; symbol, genoses, and onym in the detail), with each
34
+ block's milestones and standalone onym anchors as leaf
35
+ children, so a coordinate such as `steph:17a` is one symbol
36
+ search away.
37
+ - **Folding ranges** — one per multi-line block; the opening
38
+ line stays visible.
39
+ - **Go to definition** — on a `(onym)` group: the onym's
40
+ declaration (the block's episim line or the standalone
41
+ anchor). **References** — every deixis pointing at the onym,
42
+ plus the declaration when the client asks for it.
43
+ - **Selection ranges** — the enclosing-block chain at the
44
+ cursor, innermost first: the structural text objects.
45
+ - **Hover** on a sim symbol or episim — the sim's name, form
46
+ (endo-simmere, para-simmere, monosim), symbol pair, and the
47
+ definition's descriptions from the resolved dialektos.
48
+
49
+ Not yet: atramento (the loose syntax compiles via `atrep endo`;
50
+ its own LSP comes later), incremental sync, completions, rename.
51
+
52
+ ## Install
53
+
54
+ Any of:
55
+
56
+ ```
57
+ cargo install atrep-cli # crates.io: atrep + atrep-lsp
58
+ pip install atrep-cli # PyPI wheel, same two binaries
59
+ cargo build -p atrep-cli --release # from a checkout
60
+ ```
61
+
62
+ The binary is `atrep-lsp`; it speaks LSP on stdin/stdout.
63
+ Editor package managers that install from PyPI or crates.io
64
+ (mason.nvim, for one) can fetch it through either registry.
65
+
66
+ ## Editor configuration
67
+
68
+ **Helix** (`languages.toml`):
69
+
70
+ ```toml
71
+ [language-server.atrep]
72
+ command = "atrep-lsp"
73
+
74
+ [[language]]
75
+ name = "atrep"
76
+ scope = "source.atrep"
77
+ file-types = ["atd", "atk", "dia", "lektos"]
78
+ language-servers = ["atrep"]
79
+ ```
80
+
81
+ **Neovim** (0.11+):
82
+
83
+ ```lua
84
+ vim.filetype.add({ extension = { atd = "atrep", atk = "atrep",
85
+ dia = "atrep", lektos = "atrep" } })
86
+ vim.lsp.config("atrep", {
87
+ cmd = { "atrep-lsp" },
88
+ filetypes = { "atrep" },
89
+ })
90
+ vim.lsp.enable("atrep")
91
+ ```
92
+
93
+ **VS Code**: needs a thin client extension (planned); any generic
94
+ LSP client extension pointed at `atrep-lsp` with the file types
95
+ above works meanwhile.
@@ -26,11 +26,15 @@ spec revision.
26
26
  classes), `dialektos` (`.lektos`/`.dia` definitions, local
27
27
  inheritance and import), `parser` (document to Dendron),
28
28
  `dendron` (AST + canonical serializer), `kanonizo`, `litosis`.
29
- - `crates/atrep-cli` — the `atrep` binary.
30
- - `crates/atrep-lsp` the `atrep-lsp` language server:
31
- diagnostics + semantic-token highlighting for `.atd`/`.atk`
32
- documents and `.dia`/`.lektos` definitions (see its README
33
- for editor configuration).
29
+ - `crates/atrep-cli` — two binaries, one crate: the `atrep`
30
+ CLI, and the `atrep-lsp` language server (diagnostics +
31
+ semantic-token highlighting for `.atd`/`.atk` documents and
32
+ `.dia`/`.lektos` definitions, and over the outline —
33
+ document symbols, folding, onym definition and references,
34
+ selection ranges, and sim hover for documents; see
35
+ `crates/atrep-cli/LSP.md` for editor configuration). Both
36
+ ship with `cargo install atrep-cli` and the PyPI `atrep-cli`
37
+ wheel.
34
38
 
35
39
  ## Usage
36
40
 
@@ -0,0 +1,102 @@
1
+ //! Per-document analysis: diagnostics via atrep, dialektos
2
+ //! resolution for the scanner.
3
+
4
+ use std::path::{Path, PathBuf};
5
+
6
+ use atrep::dialektos::{self, Dialektos};
7
+ use lsp_types::{Diagnostic, DiagnosticSeverity, Position, Range};
8
+ use unicode_normalization::UnicodeNormalization;
9
+
10
+ /// Parse the buffer (document or definition, routed on the
11
+ /// declaration) and map the error, if any, to LSP diagnostics.
12
+ pub fn diagnostics(source: &str, path: &Path) -> Vec<Diagnostic> {
13
+ match atrep::check_source(source, path) {
14
+ Ok(_) => Vec::new(),
15
+ Err(e) => {
16
+ let range = e
17
+ .location
18
+ .as_ref()
19
+ .map(|loc| location_range(source, loc.line, loc.col))
20
+ .unwrap_or_else(|| Range::new(Position::new(0, 0), Position::new(0, 0)));
21
+ vec![Diagnostic {
22
+ range,
23
+ severity: Some(DiagnosticSeverity::ERROR),
24
+ source: Some("atrep".into()),
25
+ message: e.to_string(),
26
+ ..Default::default()
27
+ }]
28
+ }
29
+ }
30
+ }
31
+
32
+ /// Range for a 1-based (line, col) error location: from the column
33
+ /// to the end of that line (the core reports positions, not spans).
34
+ fn location_range(source: &str, line: usize, col: usize) -> Range {
35
+ let l = line.saturating_sub(1);
36
+ let text = source.lines().nth(l).unwrap_or("");
37
+ let mut start16 = 0u32;
38
+ let mut end16 = 0u32;
39
+ for (i, c) in text.chars().enumerate() {
40
+ if i < col.saturating_sub(1) {
41
+ start16 += c.len_utf16() as u32;
42
+ }
43
+ end16 += c.len_utf16() as u32;
44
+ }
45
+ if end16 <= start16 {
46
+ start16 = 0;
47
+ }
48
+ Range::new(
49
+ Position::new(l as u32, start16),
50
+ Position::new(l as u32, end16),
51
+ )
52
+ }
53
+
54
+ /// Resolve the buffer's declared dialektos (documents only;
55
+ /// definitions highlight structurally). NFC-normalized like the
56
+ /// parser input; resolution is local-to-the-file's-directory plus
57
+ /// the embedded std set, exactly as atrep resolves it.
58
+ pub fn resolve_dialektos(source: &str, path: &Path) -> Option<Dialektos> {
59
+ if atrep::is_definition_source(source) {
60
+ return None;
61
+ }
62
+ let id = atrep::scan::declared_id(source)?;
63
+ let normalized: String = id.nfc().collect();
64
+ let dir: PathBuf = path.parent().unwrap_or(Path::new(".")).to_path_buf();
65
+ dialektos::resolve(&dir, &normalized).ok()
66
+ }
67
+
68
+ #[cfg(test)]
69
+ mod tests {
70
+ use super::*;
71
+
72
+ #[test]
73
+ fn clean_litogramma_document() {
74
+ let src = "@@@!litogramma\n\n@#(1) Title\ntext\n#@\n";
75
+ assert!(diagnostics(src, Path::new("t.atd")).is_empty());
76
+ }
77
+
78
+ #[test]
79
+ fn missing_declaration_is_flagged() {
80
+ let d = diagnostics("just prose\n", Path::new("t.atd"));
81
+ assert_eq!(d.len(), 1);
82
+ assert_eq!(d[0].range.start.line, 0);
83
+ }
84
+
85
+ #[test]
86
+ fn unresolvable_dialektos_is_flagged() {
87
+ let d = diagnostics("@@@!no-such-dialekt\n", Path::new("t.atd"));
88
+ assert_eq!(d.len(), 1);
89
+ }
90
+
91
+ #[test]
92
+ fn std_dialektos_resolves() {
93
+ let src = "@@@!litogramma\n\ntext\n";
94
+ assert!(resolve_dialektos(src, Path::new("t.atd")).is_some());
95
+ }
96
+
97
+ #[test]
98
+ fn definition_source_gets_no_dialektos() {
99
+ let src = "@@@!atrep\n\n@=== note\n";
100
+ assert!(resolve_dialektos(src, Path::new("x.dia")).is_none());
101
+ }
102
+ }