@teipublisher/oddity-language-server 0.0.0-stage → 0.2.0
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.
- package/LICENSE +21 -0
- package/README.md +58 -2
- package/dist/edit.js +1211 -0
- package/dist/edit.js.map +7 -0
- package/dist/index.js +1701 -0
- package/dist/index.js.map +7 -0
- package/dist/node.cjs +45925 -0
- package/dist/node.cjs.map +7 -0
- package/package.json +74 -4
- package/schema/README.md +45 -0
- package/schema/docbook/docbook.rng +18457 -0
- package/schema/jats/BITS-embedded-index2.ent.rng +340 -0
- package/schema/jats/BITS-question-answer2.ent.rng +795 -0
- package/schema/jats/JATS-XHTMLtablesetup1-3.ent.rng +614 -0
- package/schema/jats/JATS-ali-namespace1-3.ent.rng +284 -0
- package/schema/jats/JATS-archivearticle1-3-mathml3.rng +1277 -0
- package/schema/jats/JATS-archivecustom-classes1-3.ent.rng +427 -0
- package/schema/jats/JATS-archivecustom-mixes1-3.ent.rng +630 -0
- package/schema/jats/JATS-archivecustom-models1-3.ent.rng +2205 -0
- package/schema/jats/JATS-articlemeta1-3.ent.rng +3138 -0
- package/schema/jats/JATS-backmatter1-3.ent.rng +601 -0
- package/schema/jats/JATS-chars1-3.ent.rng +715 -0
- package/schema/jats/JATS-common-atts1-3.ent.rng +367 -0
- package/schema/jats/JATS-common1-3.ent.rng +6007 -0
- package/schema/jats/JATS-default-classes1-3.ent.rng +1953 -0
- package/schema/jats/JATS-default-mixes1-3.ent.rng +583 -0
- package/schema/jats/JATS-display1-3.ent.rng +1669 -0
- package/schema/jats/JATS-format1-3.ent.rng +1256 -0
- package/schema/jats/JATS-funding1-3.ent.rng +1389 -0
- package/schema/jats/JATS-journalmeta1-3.ent.rng +691 -0
- package/schema/jats/JATS-link1-3.ent.rng +664 -0
- package/schema/jats/JATS-list1-3.ent.rng +747 -0
- package/schema/jats/JATS-math1-3.ent.rng +620 -0
- package/schema/jats/JATS-mathml3-mathmlsetup1-3.ent.rng +459 -0
- package/schema/jats/JATS-nlmcitation1-3.ent.rng +522 -0
- package/schema/jats/JATS-para1-3.ent.rng +780 -0
- package/schema/jats/JATS-phrase1-3.ent.rng +725 -0
- package/schema/jats/JATS-references1-3.ent.rng +1713 -0
- package/schema/jats/JATS-related-object1-3.ent.rng +453 -0
- package/schema/jats/JATS-section1-3.ent.rng +482 -0
- package/schema/jats/mathml3-qname1.mod.rng +61 -0
- package/schema/jats/mathml3.rng +4094 -0
- package/schema/jats/xhtml-inlstyle-1.mod.rng +37 -0
- package/schema/jats/xhtml-table-1.mod.rng +426 -0
- package/schema/odd/teipublisher_odds.rng +12769 -0
- package/schema/opm/opm.schema.json +402 -0
- package/schema/tei/tei_all.rng +23212 -0
- package/src/core/association.ts +155 -0
- package/src/core/complete.ts +147 -0
- package/src/core/elements.ts +86 -0
- package/src/core/opmToml.ts +432 -0
- package/src/core/outline.ts +156 -0
- package/src/core/schema.ts +55 -0
- package/src/core/tags.ts +104 -0
- package/src/core/toml.ts +64 -0
- package/src/core/tomlScan.ts +155 -0
- package/src/core/validate.ts +128 -0
- package/src/core/wellformed.ts +16 -0
- package/src/edit.ts +12 -0
- package/src/index.ts +17 -0
- package/src/node.ts +39 -0
- package/src/server/server.ts +322 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 e-editiones
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
-
#
|
|
1
|
+
# oddity-language-server
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
RELAX NG validation and schema-aware completion for TEI documents and ODDs, as a
|
|
4
|
+
language server. Used by the ODDity VS Code extension.
|
|
5
|
+
|
|
6
|
+
Completion only suggests elements and attributes that the schema allows at the
|
|
7
|
+
cursor position, and it respects their required order. For example, right after
|
|
8
|
+
`<TEI>` it suggests only `<teiHeader>`. Each suggestion shows the description
|
|
9
|
+
that the ODD provides for that element or attribute.
|
|
10
|
+
|
|
11
|
+
## Schema lookup
|
|
12
|
+
|
|
13
|
+
The language server tries to find the schema associated with a document by checking the following locations in order:
|
|
14
|
+
|
|
15
|
+
1. a local `.rng` named by the document's `<?xml-model?>`
|
|
16
|
+
2. for documents other than ODDs, `[editor] schema` in the nearest `opm.toml`
|
|
17
|
+
3. defaults by vocabulary: `schema/odd/teipublisher_odds.rng` for `.odd` files,
|
|
18
|
+
and for documents recognised as TEI, DocBook or JATS `tei_all`, DocBook 5.2 or
|
|
19
|
+
JATS 1.3 Archiving with MathML 3 (see `schema/README.md` for sources and licences)
|
|
20
|
+
|
|
21
|
+
An `<?xml-model?>` or `[editor] schema` naming one of these by its published URL
|
|
22
|
+
(e.g. the TEI's `tei_all.rng`) uses the bundled copy; other remote schemas are ignored.
|
|
23
|
+
|
|
24
|
+
If no schema can be determined, the language server still supports
|
|
25
|
+
well-formedness checks, an outline and tag renaming.
|
|
26
|
+
|
|
27
|
+
## opm.toml
|
|
28
|
+
|
|
29
|
+
A document named `opm.toml` is checked against the JSON Schema that opm ships
|
|
30
|
+
(`schema/opm/opm.schema.json`, copied by `npm run schemas`): TOML syntax errors,
|
|
31
|
+
wrong types and values are errors, unknown keys and legacy top-level sections
|
|
32
|
+
warnings. Completion offers table names in headers, the keys a table may still
|
|
33
|
+
take, and values (enums, booleans, examples) after `=`; hover shows a key's
|
|
34
|
+
description. Clients have to send `opm.toml` to the server, e.g. a document
|
|
35
|
+
selector `{ pattern: '**/opm.toml' }`.
|
|
36
|
+
|
|
37
|
+
## Layout
|
|
38
|
+
|
|
39
|
+
- `src/core/`: editor-independent code (validation, completion, schema
|
|
40
|
+
association, outline, tag matching), exported from `src/index.ts`.
|
|
41
|
+
`validate.ts`, `complete.ts` and `toml.ts` come from opm studio.
|
|
42
|
+
- `src/server/server.ts`: the language server, independent of its transport.
|
|
43
|
+
- `src/node.ts`: Node entry (`--node-ipc` or `--stdio`), built to `dist/node.cjs`.
|
|
44
|
+
`ODDITY_LS_SCHEMAS` points it at a `schema/` folder for the defaults; clients
|
|
45
|
+
can pass `initializationOptions.defaultSchemas` instead.
|
|
46
|
+
|
|
47
|
+
Custom protocol: request `oddity/schemaFor { uri }` returns the schema in use;
|
|
48
|
+
notification `oddity/schemaChanged { uri, schema }` is sent when it changes.
|
|
49
|
+
|
|
50
|
+
## Development
|
|
51
|
+
|
|
52
|
+
npm install
|
|
53
|
+
npm test # node --test, runs the TypeScript directly
|
|
54
|
+
npm run check # tsc
|
|
55
|
+
npm run build # dist/
|
|
56
|
+
npm run schemas # regenerate schema/ (opm compiles teipublisher_odds.odd from jinks)
|
|
57
|
+
|
|
58
|
+
`npm run schemas` looks for jinks in `$JINKS_DIR`, `../../apps/tei-publisher/jinks`
|
|
59
|
+
or `../jinks`, and falls back to GitHub.
|