@markup-carve/carve-lsp 0.1.1 → 0.1.2

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 (63) hide show
  1. package/README.md +55 -0
  2. package/dist/analyze.d.ts +17 -1
  3. package/dist/analyze.js +53 -1
  4. package/dist/analyze.js.map +1 -1
  5. package/dist/analyze.test.js +84 -0
  6. package/dist/analyze.test.js.map +1 -1
  7. package/dist/definition.js +22 -2
  8. package/dist/definition.js.map +1 -1
  9. package/dist/hover.js +23 -8
  10. package/dist/hover.js.map +1 -1
  11. package/dist/include-directive.d.ts +61 -0
  12. package/dist/include-directive.js +158 -0
  13. package/dist/include-directive.js.map +1 -0
  14. package/dist/include-directive.test.d.ts +1 -0
  15. package/dist/include-directive.test.js +83 -0
  16. package/dist/include-directive.test.js.map +1 -0
  17. package/dist/include-path.d.ts +63 -0
  18. package/dist/include-path.js +135 -0
  19. package/dist/include-path.js.map +1 -0
  20. package/dist/include-path.test.d.ts +1 -0
  21. package/dist/include-path.test.js +189 -0
  22. package/dist/include-path.test.js.map +1 -0
  23. package/dist/include-security-conformance.test.d.ts +1 -0
  24. package/dist/include-security-conformance.test.js +100 -0
  25. package/dist/include-security-conformance.test.js.map +1 -0
  26. package/dist/include-settings.d.ts +50 -0
  27. package/dist/include-settings.js +135 -0
  28. package/dist/include-settings.js.map +1 -0
  29. package/dist/include-settings.test.d.ts +1 -0
  30. package/dist/include-settings.test.js +191 -0
  31. package/dist/include-settings.test.js.map +1 -0
  32. package/dist/includes.d.ts +78 -0
  33. package/dist/includes.js +158 -0
  34. package/dist/includes.js.map +1 -0
  35. package/dist/includes.test.d.ts +1 -0
  36. package/dist/includes.test.js +202 -0
  37. package/dist/includes.test.js.map +1 -0
  38. package/dist/inline-text.d.ts +24 -0
  39. package/dist/inline-text.js +34 -0
  40. package/dist/inline-text.js.map +1 -0
  41. package/dist/inline-text.test.d.ts +1 -0
  42. package/dist/inline-text.test.js +32 -0
  43. package/dist/inline-text.test.js.map +1 -0
  44. package/dist/position-encoding.test.d.ts +1 -0
  45. package/dist/position-encoding.test.js +143 -0
  46. package/dist/position-encoding.test.js.map +1 -0
  47. package/dist/position.d.ts +82 -0
  48. package/dist/position.js +137 -0
  49. package/dist/position.js.map +1 -0
  50. package/dist/position.test.d.ts +1 -0
  51. package/dist/position.test.js +61 -0
  52. package/dist/position.test.js.map +1 -0
  53. package/dist/references.js +3 -0
  54. package/dist/references.js.map +1 -1
  55. package/dist/semantic.d.ts +14 -0
  56. package/dist/semantic.js +98 -13
  57. package/dist/semantic.js.map +1 -1
  58. package/dist/semantic.test.d.ts +1 -0
  59. package/dist/semantic.test.js +93 -0
  60. package/dist/semantic.test.js.map +1 -0
  61. package/dist/server.js +50 -23
  62. package/dist/server.js.map +1 -1
  63. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"includes.test.js","sourceRoot":"","sources":["../src/includes.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAG/C,8EAA8E;AAC9E,yEAAyE;AACzE,gFAAgF;AAChF,0DAA0D;AAE1D,2EAA2E;AAC3E,SAAS,eAAe,CAAC,KAA6B,EAAE,KAAgB;IACtE,OAAO,CAAC,WAAW,EAAE,EAAE;QACrB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,CAAA;QACxB,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,CAAC,CAAA;QACjC,IAAI,MAAM,KAAK,SAAS;YAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,CAAA;QACpF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,MAAM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,24 @@
1
+ /**
2
+ * Shared inline-to-text fallback for the three plain-text walks (outline
3
+ * symbols, cross-reference matching, go-to-definition).
4
+ *
5
+ * Carve represents a typographic substitution as a `smart_punctuation` inline
6
+ * node rather than writing the glyph into the text buffer (carve spec PART 9
7
+ * §8). The node carries the resolved `kind`, the author's source run in
8
+ * `value`, and - for quotes, whose glyph is locale-dependent and chosen during
9
+ * parsing - the resolved character in `glyph`.
10
+ *
11
+ * The walks here used if/else-if chains with no final branch, so a node type
12
+ * they did not know about contributed nothing. That failed silently: every
13
+ * quote, apostrophe, dash and ellipsis vanished from the extracted text, and
14
+ * `# Don't repeat yourself` became `Dont repeat yourself` in outline symbols
15
+ * and in the text a crossref resolves against.
16
+ *
17
+ * Preference order is `glyph`, then the source run. Resolving `kind` through
18
+ * carve's glyph table would be marginally more faithful for dashes and
19
+ * ellipses, but the table is not exported from the package root, and it does
20
+ * not matter for what these walks feed: heading ids normalize typographic
21
+ * output back to ASCII anyway, and the three walks stay consistent with each
22
+ * other either way, which is what reference matching actually needs.
23
+ */
24
+ export declare function smartPunctuationText(node: unknown): string;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Shared inline-to-text fallback for the three plain-text walks (outline
3
+ * symbols, cross-reference matching, go-to-definition).
4
+ *
5
+ * Carve represents a typographic substitution as a `smart_punctuation` inline
6
+ * node rather than writing the glyph into the text buffer (carve spec PART 9
7
+ * §8). The node carries the resolved `kind`, the author's source run in
8
+ * `value`, and - for quotes, whose glyph is locale-dependent and chosen during
9
+ * parsing - the resolved character in `glyph`.
10
+ *
11
+ * The walks here used if/else-if chains with no final branch, so a node type
12
+ * they did not know about contributed nothing. That failed silently: every
13
+ * quote, apostrophe, dash and ellipsis vanished from the extracted text, and
14
+ * `# Don't repeat yourself` became `Dont repeat yourself` in outline symbols
15
+ * and in the text a crossref resolves against.
16
+ *
17
+ * Preference order is `glyph`, then the source run. Resolving `kind` through
18
+ * carve's glyph table would be marginally more faithful for dashes and
19
+ * ellipses, but the table is not exported from the package root, and it does
20
+ * not matter for what these walks feed: heading ids normalize typographic
21
+ * output back to ASCII anyway, and the three walks stay consistent with each
22
+ * other either way, which is what reference matching actually needs.
23
+ */
24
+ export function smartPunctuationText(node) {
25
+ if (typeof node !== 'object' || node === null)
26
+ return '';
27
+ const candidate = node;
28
+ if (candidate.type !== 'smart_punctuation')
29
+ return '';
30
+ if (typeof candidate.glyph === 'string')
31
+ return candidate.glyph;
32
+ return typeof candidate.value === 'string' ? candidate.value : '';
33
+ }
34
+ //# sourceMappingURL=inline-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-text.js","sourceRoot":"","sources":["../src/inline-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAAa;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,CAAA;IACxD,MAAM,SAAS,GAAG,IAA4D,CAAA;IAC9E,IAAI,SAAS,CAAC,IAAI,KAAK,mBAAmB;QAAE,OAAO,EAAE,CAAA;IACrD,IAAI,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC,KAAK,CAAA;IAC/D,OAAO,OAAO,SAAS,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AACnE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import assert from 'node:assert/strict';
2
+ import test from 'node:test';
3
+ import { smartPunctuationText } from './inline-text.js';
4
+ // The nodes below are written literally rather than produced by parse(), so the
5
+ // tests hold whether or not the installed @markup-carve/carve emits
6
+ // smart_punctuation yet. That is the point: the regression this guards against
7
+ // arrives with a dependency bump, and a test that only exercises the current
8
+ // dependency would pass right up until the day it mattered.
9
+ test('a quote node contributes its resolved glyph', () => {
10
+ // Quote glyphs are locale-dependent and fixed during parsing, so the node
11
+ // carries the character rather than leaving it to a kind lookup.
12
+ assert.equal(smartPunctuationText({ type: 'smart_punctuation', kind: 'right_single_quote', value: "'", glyph: '’' }), '’');
13
+ });
14
+ test('a node without a glyph falls back to the author source run', () => {
15
+ assert.equal(smartPunctuationText({ type: 'smart_punctuation', kind: 'ellipsis', value: '...' }), '...');
16
+ assert.equal(smartPunctuationText({ type: 'smart_punctuation', kind: 'em_dash', value: '---' }), '---');
17
+ });
18
+ test('other node types contribute nothing', () => {
19
+ // The helper sits in a final else, so every unrecognized node reaches it. It
20
+ // must stay silent for anything that is not smart punctuation, matching the
21
+ // previous behavior of those chains.
22
+ assert.equal(smartPunctuationText({ type: 'soft_break' }), '');
23
+ assert.equal(smartPunctuationText({ type: 'text', value: 'x' }), '');
24
+ });
25
+ test('malformed input does not throw', () => {
26
+ assert.equal(smartPunctuationText(null), '');
27
+ assert.equal(smartPunctuationText(undefined), '');
28
+ assert.equal(smartPunctuationText('not a node'), '');
29
+ assert.equal(smartPunctuationText({ type: 'smart_punctuation' }), '');
30
+ assert.equal(smartPunctuationText({ type: 'smart_punctuation', value: 42 }), '');
31
+ });
32
+ //# sourceMappingURL=inline-text.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline-text.test.js","sourceRoot":"","sources":["../src/inline-text.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD,gFAAgF;AAChF,oEAAoE;AACpE,+EAA+E;AAC/E,6EAA6E;AAC7E,4DAA4D;AAE5D,IAAI,CAAC,6CAA6C,EAAE,GAAG,EAAE;IACvD,0EAA0E;IAC1E,iEAAiE;IACjE,MAAM,CAAC,KAAK,CACV,oBAAoB,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,oBAAoB,EAAE,KAA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,KAAK,CAAC,oBAAoB,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,143 @@
1
+ import assert from 'node:assert/strict';
2
+ import test from 'node:test';
3
+ import { hoverAt } from './hover.js';
4
+ import { semanticTokens } from './semantic.js';
5
+ import { astColumnToCharacter, characterToAstColumn, engineColumnUnit, setEngineColumnUnit, CODEPOINT_PROBE_END_COLUMN, COLUMN_PROBE, probeEndColumn, } from './position.js';
6
+ function hoverText(hover) {
7
+ const contents = hover.contents;
8
+ return contents.value ?? String(hover.contents);
9
+ }
10
+ // Every assertion below is written against the SOURCE, not against the parser's
11
+ // numbers: an LSP character is a UTF-16 index into the line, so `indexOf` is
12
+ // the answer a client expects no matter which unit the installed parser counts
13
+ // in. That is what makes these hold across the carve-js release that switched
14
+ // columns from UTF-16 code units to codepoints (carve-js#447) - the release
15
+ // this server's `^0.1.2` range picks up without a change here.
16
+ const LINE = '\u{1F600} *bold* tail';
17
+ const BOLD_START = LINE.indexOf('*');
18
+ const BOLD_END = LINE.lastIndexOf('*') + 1;
19
+ // The unit the PINNED engine reports, asserted directly.
20
+ //
21
+ // The test above is deliberately unit-agnostic, so a release that changes the
22
+ // unit passes it - which is how the change got in last time. This one names the
23
+ // answer, so the change arrives as a failing assertion instead of as correct
24
+ // positions on ASCII and wrong ones on every emoji.
25
+ //
26
+ // That is exactly what happened: this assertion read `utf16` while the pin sat
27
+ // at `0.1.2`, and raising the pin to `0.1.3` turned it red. `0.1.3` carries
28
+ // carve-js#447, which counts codepoints and so conforms to spec PART 12
29
+ // section 4. The expectation is flipped here rather than relaxed, because an
30
+ // assertion that accepts either unit is the shape that let the change through
31
+ // unnoticed the first time.
32
+ //
33
+ // The conversions in position.js have always had both branches; until this
34
+ // release the `codepoint` one was unreachable with the installed engine. It is
35
+ // the live branch now, and the unit-agnostic tests above cover it: they derive
36
+ // every expectation from `indexOf` on the SOURCE, so they would fail if the
37
+ // conversion returned the parser's raw codepoint column to an LSP client.
38
+ test('the pinned engine counts codepoints', () => {
39
+ assert.equal(engineColumnUnit(), 'codepoint');
40
+ });
41
+ // This test used to retype the probe string and the constant, and then assert
42
+ // that engineColumnUnit() agreed with a recomputation of its own expression:
43
+ //
44
+ // const endColumn = parse('\u{1F600}x').children[0]?.pos?.endColumn
45
+ // assert.equal(engineColumnUnit(), endColumn === 3 ? 'codepoint' : 'utf16')
46
+ //
47
+ // Both sides read the same value through the same expression, so they agreed
48
+ // for every value the engine can return - including `undefined`, where both
49
+ // take the `utf16` branch and the "answer" is the catch-all rather than a
50
+ // measurement. Two mutations, both measured against the old assertion, both
51
+ // leaving the whole suite green at 134 of 134:
52
+ //
53
+ // COLUMN_PROBE = 'abc' a BMP-only probe has the same end column under
54
+ // either unit, so the classifier can no longer tell
55
+ // them apart. The test reparsed its own emoji probe
56
+ // and never saw it.
57
+ // the classifier reads a property that does not exist, so every
58
+ // classification is the fallback. The test reparsed
59
+ // and got a real number, so it agreed with the
60
+ // fallback and reported nothing.
61
+ //
62
+ // What follows checks three things separately, against values derived from the
63
+ // probe rather than copied from it, and consumes the classifier's own reading
64
+ // rather than making a second one.
65
+ test('the probe can tell the two units apart', () => {
66
+ // A string is indexed in UTF-16 code units and iterated in codepoints, so a
67
+ // probe whose two lengths are equal reports the same end column under either
68
+ // unit and classifies nothing. This is a property of the probe alone, with no
69
+ // engine involved.
70
+ assert.notEqual(COLUMN_PROBE.length, [...COLUMN_PROBE].length, 'the probe has no astral character, so both units give it the same end column');
71
+ // And the constant the classifier compares against is that probe's codepoint
72
+ // end column - derived here, hard-coded there.
73
+ assert.equal(CODEPOINT_PROBE_END_COLUMN, [...COLUMN_PROBE].length + 1);
74
+ });
75
+ test('the installed parser answers the probe, rather than failing into the default', () => {
76
+ // engineColumnUnit() answers `utf16` when the parse throws or the position is
77
+ // absent. That is the right thing for a server not to crash on, and the wrong
78
+ // thing to accept silently in CI: a classification nobody measured reads
79
+ // exactly like one that was.
80
+ //
81
+ // probeEndColumn() rather than a reparse here: this is the reading the
82
+ // classifier actually makes, so a classifier that stops reading a position
83
+ // fails this. A reparse would agree with the fallback and report nothing.
84
+ const endColumn = probeEndColumn();
85
+ assert.equal(typeof endColumn, 'number', 'the installed engine placed no position on the probe, so the unit below is a default, not a reading');
86
+ // Only two answers are possible for this probe, one per unit. Anything else
87
+ // means the engine is not counting either of the units this server knows how
88
+ // to convert between.
89
+ assert.ok(endColumn === [...COLUMN_PROBE].length + 1 || endColumn === COLUMN_PROBE.length + 1, `the probe's end column is ${endColumn}, which is neither its codepoint length + 1 ` +
90
+ `(${[...COLUMN_PROBE].length + 1}) nor its UTF-16 length + 1 (${COLUMN_PROBE.length + 1})`);
91
+ assert.equal(engineColumnUnit(), endColumn === [...COLUMN_PROBE].length + 1 ? 'codepoint' : 'utf16');
92
+ });
93
+ test('an emoji before a construct does not shift its hover range', () => {
94
+ const hover = hoverAt(LINE, { line: 0, character: BOLD_START + 1 });
95
+ assert.ok(hover, 'expected a hover inside the bold span');
96
+ assert.match(hoverText(hover), /Bold/);
97
+ assert.deepEqual(hover.range, {
98
+ start: { line: 0, character: BOLD_START },
99
+ end: { line: 0, character: BOLD_END },
100
+ });
101
+ });
102
+ test('a cursor placed by UTF-16 character finds the node the client pointed at', () => {
103
+ // The character an editor sends counts UTF-16 units. Compared against a
104
+ // codepoint column without converting, this cursor lands one position early
105
+ // and hovers the surrounding text instead of the bold span.
106
+ const hover = hoverAt(LINE, { line: 0, character: BOLD_END - 2 });
107
+ assert.ok(hover);
108
+ assert.match(hoverText(hover), /Bold/);
109
+ });
110
+ test('semantic tokens land on the UTF-16 columns the client indexes by', () => {
111
+ const tokens = semanticTokens(LINE);
112
+ const bold = tokens.find((token) => token.character === BOLD_START);
113
+ assert.ok(bold, `expected a token at character ${BOLD_START}, got ${JSON.stringify(tokens)}`);
114
+ assert.equal(bold.length, BOLD_END - BOLD_START);
115
+ });
116
+ test('both parser readings map the same construct to the same LSP character', () => {
117
+ // The installed parser can only show one reading, and it is the one whose
118
+ // conversion is the identity - so the other branch is driven explicitly
119
+ // rather than left to run for the first time after a dependency bump.
120
+ // In `LINE` the opening `*` is codepoint column 3 and UTF-16 column 4,
121
+ // because the emoji is one codepoint and two code units.
122
+ try {
123
+ setEngineColumnUnit('codepoint');
124
+ assert.equal(astColumnToCharacter(LINE, 3), BOLD_START);
125
+ assert.equal(characterToAstColumn(LINE, BOLD_START), 3);
126
+ setEngineColumnUnit('utf16');
127
+ assert.equal(astColumnToCharacter(LINE, 4), BOLD_START);
128
+ assert.equal(characterToAstColumn(LINE, BOLD_START), 4);
129
+ }
130
+ finally {
131
+ setEngineColumnUnit(undefined);
132
+ }
133
+ });
134
+ test('a BMP-only document is unaffected either way', () => {
135
+ const line = 'a *bold* tail';
136
+ const hover = hoverAt(line, { line: 0, character: 3 });
137
+ assert.ok(hover);
138
+ assert.deepEqual(hover.range, {
139
+ start: { line: 0, character: line.indexOf('*') },
140
+ end: { line: 0, character: line.lastIndexOf('*') + 1 },
141
+ });
142
+ });
143
+ //# sourceMappingURL=position-encoding.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position-encoding.test.js","sourceRoot":"","sources":["../src/position-encoding.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,EACZ,cAAc,GACf,MAAM,eAAe,CAAA;AAGtB,SAAS,SAAS,CAAC,KAAY;IAC7B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAA8B,CAAA;I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,CAAA"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Converts between the units Carve positions and LSP positions count.
3
+ *
4
+ * A Carve AST position counts UNICODE CODEPOINTS (spec PART 12 §4, chosen so
5
+ * an index always lands on a character boundary). An LSP position counts
6
+ * UTF-16 code units unless the client and server negotiate `positionEncoding`,
7
+ * which this server does not do, so UTF-16 is what every client here expects.
8
+ *
9
+ * The two units agree on the entire BMP and diverge on every astral character:
10
+ * one emoji earlier in the line shifts every LSP column after it by one. So a
11
+ * position read off the AST cannot be handed to a client, nor a position from
12
+ * a client compared against the AST, without passing through here.
13
+ */
14
+ /**
15
+ * A 1-based codepoint column, as an AST position reports it, to the 0-based
16
+ * UTF-16 character an LSP range carries.
17
+ */
18
+ export declare function codepointColumnToUtf16(lineText: string, column: number): number;
19
+ /**
20
+ * The 0-based UTF-16 character an LSP request carries, to the 1-based codepoint
21
+ * column an AST position can be compared against.
22
+ *
23
+ * A character index pointing into the middle of a surrogate pair resolves to
24
+ * the column after that pair. There is no column for half a character, and a
25
+ * client only produces one by placing a cursor inside one.
26
+ */
27
+ export declare function utf16CharToCodepointColumn(lineText: string, character: number): number;
28
+ /**
29
+ * The document's lines, line endings normalized, indexed 0-based - the form
30
+ * both conversions above need to see a line's characters.
31
+ */
32
+ export declare function sourceLines(source: string): string[];
33
+ /**
34
+ * Which unit the installed parser's columns are in.
35
+ *
36
+ * This is not a constant, because the dependency range spans both answers.
37
+ * Positions arrived in @markup-carve/carve counting UTF-16 code units, which
38
+ * is what a JavaScript string is indexed by; carve-js#447 then made them count
39
+ * codepoints, to conform to the spec. Both satisfy `^0.1.2`, so a build of this
40
+ * server installed today and the same build installed after that release are
41
+ * handed different numbers for the same document, and nothing in the package
42
+ * metadata distinguishes them.
43
+ *
44
+ * Rather than guess, ask: one astral character is two UTF-16 code units and one
45
+ * codepoint, so a two-character probe reports a different end column under each
46
+ * unit. The answer is cached - it cannot change within a process.
47
+ */
48
+ export declare const COLUMN_PROBE = "\uD83D\uDE00x";
49
+ export declare const CODEPOINT_PROBE_END_COLUMN = 3;
50
+ /**
51
+ * The raw reading the classification is made from: the probe's end column as
52
+ * the installed parser reports it, or `undefined` when the parser cannot answer
53
+ * at all.
54
+ *
55
+ * Split out and exported so the guard test can consume THE READING the
56
+ * classifier uses, instead of computing its own copy of it. A test that reparses
57
+ * the probe itself agrees with `engineColumnUnit` for every value including
58
+ * `undefined`, so it cannot see the difference between a measurement and the
59
+ * fallback below - which is the only thing worth checking here.
60
+ */
61
+ export declare function probeEndColumn(): number | undefined;
62
+ export declare function engineColumnUnit(): 'codepoint' | 'utf16';
63
+ /**
64
+ * Test seam: pin the unit, or pass `undefined` to probe again.
65
+ *
66
+ * The installed parser can only demonstrate one of the two readings, and it is
67
+ * the one whose conversion is the identity - so without this the codepoint
68
+ * branch would ship untested and unrun until a dependency bump made it live.
69
+ */
70
+ export declare function setEngineColumnUnit(unit: 'codepoint' | 'utf16' | undefined): void;
71
+ /**
72
+ * A 1-based column as the installed parser reports it, to the 0-based UTF-16
73
+ * character an LSP range carries. Use this rather than the raw conversion:
74
+ * under a UTF-16 parser the columns already are LSP characters, and converting
75
+ * them would introduce the very shift it is meant to remove.
76
+ */
77
+ export declare function astColumnToCharacter(lineText: string, column: number): number;
78
+ /**
79
+ * The 0-based UTF-16 character an LSP request carries, to the 1-based column
80
+ * the installed parser's positions can be compared against.
81
+ */
82
+ export declare function characterToAstColumn(lineText: string, character: number): number;
@@ -0,0 +1,137 @@
1
+ import { parse } from '@markup-carve/carve';
2
+ /**
3
+ * Converts between the units Carve positions and LSP positions count.
4
+ *
5
+ * A Carve AST position counts UNICODE CODEPOINTS (spec PART 12 §4, chosen so
6
+ * an index always lands on a character boundary). An LSP position counts
7
+ * UTF-16 code units unless the client and server negotiate `positionEncoding`,
8
+ * which this server does not do, so UTF-16 is what every client here expects.
9
+ *
10
+ * The two units agree on the entire BMP and diverge on every astral character:
11
+ * one emoji earlier in the line shifts every LSP column after it by one. So a
12
+ * position read off the AST cannot be handed to a client, nor a position from
13
+ * a client compared against the AST, without passing through here.
14
+ */
15
+ /**
16
+ * A 1-based codepoint column, as an AST position reports it, to the 0-based
17
+ * UTF-16 character an LSP range carries.
18
+ */
19
+ export function codepointColumnToUtf16(lineText, column) {
20
+ if (column <= 1)
21
+ return 0;
22
+ let codepointColumn = 1;
23
+ let index = 0;
24
+ while (index < lineText.length && codepointColumn < column) {
25
+ index += (lineText.codePointAt(index) ?? 0) > 0xffff ? 2 : 1;
26
+ codepointColumn++;
27
+ }
28
+ // A column past the line's last character is normal: end columns are
29
+ // exclusive, so a construct ending the line reports length + 1. Anything
30
+ // further past the end keeps its distance rather than collapsing onto it,
31
+ // so a range can never come back inverted.
32
+ return index + Math.max(0, column - codepointColumn);
33
+ }
34
+ /**
35
+ * The 0-based UTF-16 character an LSP request carries, to the 1-based codepoint
36
+ * column an AST position can be compared against.
37
+ *
38
+ * A character index pointing into the middle of a surrogate pair resolves to
39
+ * the column after that pair. There is no column for half a character, and a
40
+ * client only produces one by placing a cursor inside one.
41
+ */
42
+ export function utf16CharToCodepointColumn(lineText, character) {
43
+ let codepointColumn = 1;
44
+ let index = 0;
45
+ while (index < lineText.length && index < character) {
46
+ index += (lineText.codePointAt(index) ?? 0) > 0xffff ? 2 : 1;
47
+ codepointColumn++;
48
+ }
49
+ return codepointColumn + Math.max(0, character - index);
50
+ }
51
+ /**
52
+ * The document's lines, line endings normalized, indexed 0-based - the form
53
+ * both conversions above need to see a line's characters.
54
+ */
55
+ export function sourceLines(source) {
56
+ return source.replace(/\r\n?/g, '\n').split('\n');
57
+ }
58
+ /**
59
+ * Which unit the installed parser's columns are in.
60
+ *
61
+ * This is not a constant, because the dependency range spans both answers.
62
+ * Positions arrived in @markup-carve/carve counting UTF-16 code units, which
63
+ * is what a JavaScript string is indexed by; carve-js#447 then made them count
64
+ * codepoints, to conform to the spec. Both satisfy `^0.1.2`, so a build of this
65
+ * server installed today and the same build installed after that release are
66
+ * handed different numbers for the same document, and nothing in the package
67
+ * metadata distinguishes them.
68
+ *
69
+ * Rather than guess, ask: one astral character is two UTF-16 code units and one
70
+ * codepoint, so a two-character probe reports a different end column under each
71
+ * unit. The answer is cached - it cannot change within a process.
72
+ */
73
+ // Exported so the guard test drives THE PROBE rather than a copy of it. A test
74
+ // that retypes the probe string agrees with this function for every value the
75
+ // engine can return, including `undefined`, and goes on agreeing after the
76
+ // probe here is changed to something that cannot tell the two units apart -
77
+ // which is the whole failure it is supposed to report.
78
+ export const COLUMN_PROBE = '\u{1F600}x';
79
+ export const CODEPOINT_PROBE_END_COLUMN = 3;
80
+ let cachedUnit;
81
+ /**
82
+ * The raw reading the classification is made from: the probe's end column as
83
+ * the installed parser reports it, or `undefined` when the parser cannot answer
84
+ * at all.
85
+ *
86
+ * Split out and exported so the guard test can consume THE READING the
87
+ * classifier uses, instead of computing its own copy of it. A test that reparses
88
+ * the probe itself agrees with `engineColumnUnit` for every value including
89
+ * `undefined`, so it cannot see the difference between a measurement and the
90
+ * fallback below - which is the only thing worth checking here.
91
+ */
92
+ export function probeEndColumn() {
93
+ try {
94
+ return parse(COLUMN_PROBE).children[0]?.pos?.endColumn;
95
+ }
96
+ catch {
97
+ return undefined;
98
+ }
99
+ }
100
+ export function engineColumnUnit() {
101
+ if (cachedUnit)
102
+ return cachedUnit;
103
+ // A parser that cannot answer gets the reading that needs no conversion,
104
+ // which is what every released version has done so far. That default is right
105
+ // for a server that must not crash on an unexpected engine, and wrong to
106
+ // accept silently in CI, so a test asserts the probe was actually answered.
107
+ const endColumn = probeEndColumn();
108
+ cachedUnit = endColumn === CODEPOINT_PROBE_END_COLUMN ? 'codepoint' : 'utf16';
109
+ return cachedUnit;
110
+ }
111
+ /**
112
+ * Test seam: pin the unit, or pass `undefined` to probe again.
113
+ *
114
+ * The installed parser can only demonstrate one of the two readings, and it is
115
+ * the one whose conversion is the identity - so without this the codepoint
116
+ * branch would ship untested and unrun until a dependency bump made it live.
117
+ */
118
+ export function setEngineColumnUnit(unit) {
119
+ cachedUnit = unit;
120
+ }
121
+ /**
122
+ * A 1-based column as the installed parser reports it, to the 0-based UTF-16
123
+ * character an LSP range carries. Use this rather than the raw conversion:
124
+ * under a UTF-16 parser the columns already are LSP characters, and converting
125
+ * them would introduce the very shift it is meant to remove.
126
+ */
127
+ export function astColumnToCharacter(lineText, column) {
128
+ return engineColumnUnit() === 'codepoint' ? codepointColumnToUtf16(lineText, column) : column - 1;
129
+ }
130
+ /**
131
+ * The 0-based UTF-16 character an LSP request carries, to the 1-based column
132
+ * the installed parser's positions can be compared against.
133
+ */
134
+ export function characterToAstColumn(lineText, character) {
135
+ return engineColumnUnit() === 'codepoint' ? utf16CharToCodepointColumn(lineText, character) : character + 1;
136
+ }
137
+ //# sourceMappingURL=position.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.js","sourceRoot":"","sources":["../src/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAE3C;;;;;;;;;;;;GAYG;AAEH;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAAgB,EAAE,MAAc;IACrE,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IAEzB,IAAI,eAAe,GAAG,CAAC,CAAA;IACvB,IAAI,KAAK,GAAG,CAAC,CAAA;IACb,OAAO,KAAK,GAAG,QAAQ,CAAC,MAAM,IAAI,eAAe,GAAG,MAAM,EAAE,CAAC;QAC3D,KAAK,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5D,eAAe,EAAE,CAAA;IACnB,CAAC;IAED,qEAAqE;IACrE,yEAAyE;IACzE,0EAA0E;IAC1E,2CAA2C;IAC3C,OAAO,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,eAAe,CAAC,CAAA;AACtD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E;IAC9E,yEAAyE;IACzE,4EAA4E;IAC5E,MAAM,SAAS,GAAG,cAAc,EAAE,CAAA;IAClC,UAAU,GAAG,SAAS,KAAK,0BAA0B,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAA;IAE7E,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAuC;IACzE,UAAU,GAAG,IAAI,CAAA;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB,EAAE,MAAc;IACnE,OAAO,gBAAgB,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,sBAAsB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAA;AACnG,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAgB,EAAE,SAAiB;IACtE,OAAO,gBAAgB,EAAE,KAAK,WAAW,CAAC,CAAC,CAAC,0BAA0B,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,GAAG,CAAC,CAAA;AAC7G,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,61 @@
1
+ import assert from 'node:assert/strict';
2
+ import test from 'node:test';
3
+ import { codepointColumnToUtf16, sourceLines, utf16CharToCodepointColumn } from './position.js';
4
+ // An emoji is two UTF-16 code units and one codepoint, so every column after it
5
+ // differs between the two units. Everything below that line is BMP-only, where
6
+ // the two agree and the conversion has to stay the identity.
7
+ test('a BMP-only line converts as the identity', () => {
8
+ const line = 'a *b* c';
9
+ for (let column = 1; column <= line.length + 1; column++) {
10
+ assert.equal(codepointColumnToUtf16(line, column), column - 1);
11
+ }
12
+ for (let character = 0; character <= line.length; character++) {
13
+ assert.equal(utf16CharToCodepointColumn(line, character), character + 1);
14
+ }
15
+ });
16
+ test('an astral character shifts every column after it', () => {
17
+ // The `*` sits at codepoint column 3 and UTF-16 character 3, because the
18
+ // emoji occupies one codepoint and two code units.
19
+ const line = '\u{1F600} *b*';
20
+ assert.equal(line.indexOf('*'), 3);
21
+ assert.equal(codepointColumnToUtf16(line, 1), 0);
22
+ assert.equal(codepointColumnToUtf16(line, 2), 2);
23
+ assert.equal(codepointColumnToUtf16(line, 3), 3);
24
+ assert.equal(codepointColumnToUtf16(line, 6), 6);
25
+ assert.equal(utf16CharToCodepointColumn(line, 0), 1);
26
+ assert.equal(utf16CharToCodepointColumn(line, 2), 2);
27
+ assert.equal(utf16CharToCodepointColumn(line, 3), 3);
28
+ assert.equal(utf16CharToCodepointColumn(line, 6), 6);
29
+ });
30
+ test('the two conversions round-trip through each other', () => {
31
+ const line = 'x\u{1F600}y\u{1F1E9}\u{1F1EA}z';
32
+ for (let column = 1; column <= 7; column++) {
33
+ assert.equal(utf16CharToCodepointColumn(line, codepointColumnToUtf16(line, column)), column);
34
+ }
35
+ });
36
+ test('an exclusive end column lands on the end of the line', () => {
37
+ const line = '\u{1F600}ab';
38
+ // Three codepoints, so the exclusive end column is 4 and the UTF-16 end is
39
+ // the string's length.
40
+ assert.equal(codepointColumnToUtf16(line, 4), line.length);
41
+ assert.equal(codepointColumnToUtf16(line, 4), 4);
42
+ });
43
+ test('a column past the end keeps its distance rather than collapsing', () => {
44
+ // Ranges are built from two converted columns; clamping both to the end
45
+ // would silently produce an empty range where the parser reported a span.
46
+ const line = 'ab';
47
+ assert.equal(codepointColumnToUtf16(line, 5), 4);
48
+ assert.equal(utf16CharToCodepointColumn(line, 5), 6);
49
+ });
50
+ test('a character inside a surrogate pair resolves past it', () => {
51
+ const line = '\u{1F600}a';
52
+ assert.equal(utf16CharToCodepointColumn(line, 1), 2);
53
+ });
54
+ test('an empty line converts without moving', () => {
55
+ assert.equal(codepointColumnToUtf16('', 1), 0);
56
+ assert.equal(utf16CharToCodepointColumn('', 0), 1);
57
+ });
58
+ test('lines are split on every line ending form', () => {
59
+ assert.deepEqual(sourceLines('a\r\nb\rc\nd'), ['a', 'b', 'c', 'd']);
60
+ });
61
+ //# sourceMappingURL=position.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.test.js","sourceRoot":"","sources":["../src/position.test.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAA;AACvC,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAE/F,gFAAgF;AAChF,+EAA+E;AAC/E,6DAA6D;AAE7D,IAAI,CAAC,0CAA0C,EAAE,GAAG,EAAE;IACpD,MAAM,IAAI,GAAG,SAAS,CAAA;IACtB,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAA;IAChE,CAAC;IACD,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,IAAI,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC;QAC9D,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,CAAA;IAC1E,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC5D,yEAAyE;IACzE,mDAAmD;IACnD,MAAM,IAAI,GAAG,eAAe,CAAA;IAC5B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAA;IAElC,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAChD,MAAM,CAAC,KAAK,CA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,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAClD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,iEAAiE,EAAE,GAAG,EAAE;IAC3E,wEAAwE;IACxE,0EAA0E;IAC1E,MAAM,IAAI,GAAG,IAAI,CAAA;IACjB,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAChD,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACtD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAChE,MAAM,IAAI,GAAG,YAAY,CAAA;IACzB,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACtD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACjD,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;IAC9C,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AACpD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACrD,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AACrE,CAAC,CAAC,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { parse, resolve } from '@markup-carve/carve';
2
+ import { smartPunctuationText } from './inline-text.js';
2
3
  /**
3
4
  * Find-references for Carve constructs (same-document scope).
4
5
  *
@@ -400,6 +401,8 @@ function headingPlainText(nodes) {
400
401
  // to the heading text used for cross-reference and rename matching.
401
402
  else if (node.type === 'literal_inline')
402
403
  out += node.content;
404
+ else
405
+ out += smartPunctuationText(node);
403
406
  }
404
407
  return out.trim();
405
408
  }