@nvl/sveltex-math-language-server 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 +111 -0
- package/bin/server.js +11 -0
- package/dist/core/commands.d.ts +104 -0
- package/dist/core/commands.js +94 -0
- package/dist/core/context.d.ts +66 -0
- package/dist/core/context.js +152 -0
- package/dist/core/describe.d.ts +24 -0
- package/dist/core/describe.js +144 -0
- package/dist/core/features.d.ts +24 -0
- package/dist/core/features.js +140 -0
- package/dist/core/server.d.ts +24 -0
- package/dist/core/server.js +93 -0
- package/dist/data/commands.generated.d.ts +13 -0
- package/dist/data/commands.generated.js +13975 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +39 -0
- package/package.json +75 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { createServer, resolveBackend } from './core/server.js';
|
|
2
|
+
export type { MathLspBackend, MathCommand, CommandCategory, } from './core/commands.js';
|
|
3
|
+
export { CommandTable, createCommandTable } from './core/commands.js';
|
|
4
|
+
export { computeCompletion, computeHover } from './core/features.js';
|
|
5
|
+
export { commandAtCaret, completionContextAt, type CommandAtCaret, type CompletionContext, } from './core/context.js';
|
|
6
|
+
export { describeCommand, hoverMarkdown } from './core/describe.js';
|
|
7
|
+
export { KATEX_COMMANDS, MATHJAX_COMMANDS } from './data/commands.generated.js';
|
|
8
|
+
/**
|
|
9
|
+
* Starts the SvelTeX math language server over stdio.
|
|
10
|
+
*
|
|
11
|
+
* Creates an LSP connection bound to the current process's standard streams,
|
|
12
|
+
* wires it up with {@link createServer}, and begins listening. The returned
|
|
13
|
+
* promise never resolves under normal operation — the process lives as long as
|
|
14
|
+
* the connection does.
|
|
15
|
+
*/
|
|
16
|
+
export declare function startServer(): void;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// File description: Public entry point of `@nvl/sveltex-math-language-server`.
|
|
2
|
+
//
|
|
3
|
+
// Two things are exported:
|
|
4
|
+
//
|
|
5
|
+
// - `createServer(connection)` — the transport-agnostic core. A host that
|
|
6
|
+
// already owns an LSP `Connection` (e.g. a test harness, or an editor that
|
|
7
|
+
// runs the server in-process) calls this directly.
|
|
8
|
+
//
|
|
9
|
+
// - `startServer()` — a stdio convenience wrapper: it creates a connection on
|
|
10
|
+
// `process.stdin`/`process.stdout`, hands it to `createServer`, and starts
|
|
11
|
+
// listening. This is what `bin/server.js` invokes.
|
|
12
|
+
//
|
|
13
|
+
// The pure command-table and feature APIs are re-exported too, so consumers
|
|
14
|
+
// (and `@nvl/sveltex-language-server`) can reuse them without spawning a child.
|
|
15
|
+
// The Node-flavoured `createConnection(options?)` lives in the package's node
|
|
16
|
+
// entry point. `vscode-languageserver`'s `typings` field points at the common
|
|
17
|
+
// (browser) API, so importing the concrete node file path surfaces the correct
|
|
18
|
+
// overload under `Node16` module resolution.
|
|
19
|
+
import { ProposedFeatures, createConnection, } from 'vscode-languageserver/lib/node/main.js';
|
|
20
|
+
import { createServer } from './core/server.js';
|
|
21
|
+
export { createServer, resolveBackend } from './core/server.js';
|
|
22
|
+
export { CommandTable, createCommandTable } from './core/commands.js';
|
|
23
|
+
export { computeCompletion, computeHover } from './core/features.js';
|
|
24
|
+
export { commandAtCaret, completionContextAt, } from './core/context.js';
|
|
25
|
+
export { describeCommand, hoverMarkdown } from './core/describe.js';
|
|
26
|
+
export { KATEX_COMMANDS, MATHJAX_COMMANDS } from './data/commands.generated.js';
|
|
27
|
+
/**
|
|
28
|
+
* Starts the SvelTeX math language server over stdio.
|
|
29
|
+
*
|
|
30
|
+
* Creates an LSP connection bound to the current process's standard streams,
|
|
31
|
+
* wires it up with {@link createServer}, and begins listening. The returned
|
|
32
|
+
* promise never resolves under normal operation — the process lives as long as
|
|
33
|
+
* the connection does.
|
|
34
|
+
*/
|
|
35
|
+
export function startServer() {
|
|
36
|
+
const connection = createConnection(ProposedFeatures.all);
|
|
37
|
+
createServer(connection);
|
|
38
|
+
connection.listen();
|
|
39
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nvl/sveltex-math-language-server",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Language Server Protocol implementation for TeX math (KaTeX / MathJax) inside SvelTeX documents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": {
|
|
8
|
+
"name": "N. V. Lang",
|
|
9
|
+
"email": "npm@nvlang.dev",
|
|
10
|
+
"url": "https://nvlang.dev/"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/nvlang/sveltex.git",
|
|
15
|
+
"directory": "packages/sveltex-math-language-server"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/nvlang/sveltex/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://sveltex.dev",
|
|
21
|
+
"keywords": [
|
|
22
|
+
"sveltex",
|
|
23
|
+
"tex",
|
|
24
|
+
"latex",
|
|
25
|
+
"math",
|
|
26
|
+
"katex",
|
|
27
|
+
"mathjax",
|
|
28
|
+
"lsp",
|
|
29
|
+
"language-server"
|
|
30
|
+
],
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"default": "./dist/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./bin/server.js": "./bin/server.js",
|
|
39
|
+
"./package.json": "./package.json"
|
|
40
|
+
},
|
|
41
|
+
"bin": {
|
|
42
|
+
"sveltex-math-language-server": "bin/server.js"
|
|
43
|
+
},
|
|
44
|
+
"files": [
|
|
45
|
+
"dist",
|
|
46
|
+
"bin",
|
|
47
|
+
"package.json",
|
|
48
|
+
"LICENSE",
|
|
49
|
+
"README.md"
|
|
50
|
+
],
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=16"
|
|
53
|
+
},
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"vscode-languageserver": "^9.0.1",
|
|
56
|
+
"vscode-languageserver-protocol": "^3.17.5",
|
|
57
|
+
"vscode-languageserver-textdocument": "^1.0.12"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@mathjax/src": "^4.1.2",
|
|
61
|
+
"@types/node": "^24.10.15",
|
|
62
|
+
"katex": "^0.16.47",
|
|
63
|
+
"tslib": "^2.8.1",
|
|
64
|
+
"tsx": "^4.22.0",
|
|
65
|
+
"typescript": "^6.0.3",
|
|
66
|
+
"vitest": "^4.1.6"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"clean": "rimraf coverage dist tmp",
|
|
70
|
+
"generate": "tsx scripts/generate-commands.ts",
|
|
71
|
+
"build": "pnpm run clean && tsc -p tsconfig.json",
|
|
72
|
+
"lint": "eslint . && tsc -p tsconfig.json --noEmit",
|
|
73
|
+
"test": "vitest run"
|
|
74
|
+
}
|
|
75
|
+
}
|