stan-language-server 0.1.0-beta.13 → 0.2.0-beta.1
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/CHANGELOG.md +30 -145
- package/README.md +9 -1
- package/dist/__tests__/compiler.test.d.ts +1 -0
- package/dist/__tests__/handlers/compilation.test.d.ts +1 -0
- package/dist/__tests__/handlers/diagnostics.test.d.ts +1 -0
- package/dist/__tests__/handlers/formatting.test.d.ts +1 -0
- package/dist/__tests__/handlers/includes.test.d.ts +1 -0
- package/dist/__tests__/includes.test.d.ts +1 -0
- package/dist/__tests__/language/completion/providers/constraints.test.d.ts +1 -0
- package/dist/__tests__/language/completion/providers/datatypes.test.d.ts +1 -0
- package/dist/__tests__/language/completion/providers/distributions.test.d.ts +1 -0
- package/dist/__tests__/language/completion/providers/functions.test.d.ts +1 -0
- package/dist/__tests__/language/completion/providers/keywords.test.d.ts +1 -0
- package/dist/__tests__/language/completion/util.test.d.ts +1 -0
- package/dist/__tests__/language/diagnostics/linter.test.d.ts +1 -0
- package/dist/__tests__/language/formatting/integration.test.d.ts +1 -0
- package/dist/handlers/compilation/compilation.d.ts +4 -0
- package/dist/handlers/compilation/includes.d.ts +4 -0
- package/dist/handlers/completion.d.ts +3 -0
- package/dist/handlers/diagnostics.d.ts +3 -0
- package/dist/handlers/formatting.d.ts +4 -0
- package/dist/handlers/hover.d.ts +7 -0
- package/dist/handlers/index.d.ts +4 -0
- package/dist/language/completion/providers/constraints.d.ts +3 -0
- package/dist/language/completion/providers/datatypes.d.ts +3 -0
- package/dist/language/completion/providers/distributions.d.ts +2 -0
- package/dist/language/completion/providers/functions.d.ts +2 -0
- package/dist/language/completion/providers/keywords.d.ts +2 -0
- package/dist/language/completion/util.d.ts +4 -0
- package/dist/language/diagnostics/index.d.ts +2 -0
- package/dist/language/diagnostics/linter.d.ts +5 -0
- package/dist/language/diagnostics/provider.d.ts +3 -0
- package/dist/language/formatting/index.d.ts +1 -0
- package/dist/language/formatting/provider.d.ts +2 -0
- package/dist/language/hover/distributions.d.ts +1 -0
- package/dist/language/hover/functions.d.ts +1 -0
- package/dist/language/hover/index.d.ts +1 -0
- package/dist/language/hover/provider.d.ts +1 -0
- package/dist/language/hover/util.d.ts +4 -0
- package/dist/server/cli.d.ts +1 -0
- package/dist/{server.js → server/cli.js} +15 -15
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.js +89750 -0
- package/dist/stanc/compiler.d.ts +9 -0
- package/dist/stanc/includes.d.ts +10 -0
- package/dist/stanc/provider.d.ts +2 -0
- package/dist/stanc/stanc.d.ts +2 -0
- package/dist/types/common.d.ts +17 -0
- package/dist/types/completion.d.ts +15 -0
- package/dist/types/diagnostics.d.ts +18 -0
- package/dist/types/formatting.d.ts +26 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +11 -0
- package/package.json +18 -8
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
2
|
+
import { type FileContent, type Filename, type FilePathError } from "./includes";
|
|
3
|
+
import type { StancReturn } from "../types/common";
|
|
4
|
+
type GetIncludesFunction = (fileContent: FileContent) => Promise<Record<Filename, FileContent | FilePathError>>;
|
|
5
|
+
export declare const compile: (getIncludesFn: GetIncludesFunction) => (document: TextDocument, args?: string[]) => Promise<StancReturn>;
|
|
6
|
+
export declare function getMathSignatures(): string;
|
|
7
|
+
export declare function getMathDistributions(): string;
|
|
8
|
+
declare const _default: (document: TextDocument, args?: string[]) => Promise<StancReturn>;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Filename = string;
|
|
2
|
+
export type FileContent = string;
|
|
3
|
+
export type FilePathError = {
|
|
4
|
+
msg: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function getFilenames(fileContent: string): Filename[];
|
|
7
|
+
export declare function isFilePathError(value: unknown): value is FilePathError;
|
|
8
|
+
export declare const getIncludes: (readFileFn: (filename: string) => Promise<string>) => (fileContent: FileContent) => Promise<Record<Filename, FileContent>>;
|
|
9
|
+
declare const _default: (fileContent: FileContent) => Promise<Record<Filename, FileContent>>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Position {
|
|
2
|
+
line: number;
|
|
3
|
+
character: number;
|
|
4
|
+
}
|
|
5
|
+
type StancSuccess = {
|
|
6
|
+
errors: undefined;
|
|
7
|
+
result: string;
|
|
8
|
+
warnings?: string[];
|
|
9
|
+
};
|
|
10
|
+
type StancFailure = {
|
|
11
|
+
errors: string[];
|
|
12
|
+
result: undefined;
|
|
13
|
+
warnings?: string[];
|
|
14
|
+
};
|
|
15
|
+
export type StancReturn = StancSuccess | StancFailure;
|
|
16
|
+
export type StancFunction = (filename: string, code: string, options: string[], includes?: Record<string, string>) => StancReturn;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Position } from "./common";
|
|
2
|
+
export type { Position };
|
|
3
|
+
export interface Searchable {
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Distribution extends Searchable {
|
|
7
|
+
}
|
|
8
|
+
export interface StanFunction extends Searchable {
|
|
9
|
+
}
|
|
10
|
+
export interface Keyword extends Searchable {
|
|
11
|
+
}
|
|
12
|
+
export interface Datatype extends Searchable {
|
|
13
|
+
}
|
|
14
|
+
export interface Constraint extends Searchable {
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Position } from "./common";
|
|
2
|
+
export type { Position };
|
|
3
|
+
export interface Range {
|
|
4
|
+
start: Position;
|
|
5
|
+
end: Position;
|
|
6
|
+
}
|
|
7
|
+
export declare enum DiagnosticSeverity {
|
|
8
|
+
Error = 1,
|
|
9
|
+
Warning = 2,
|
|
10
|
+
Information = 3,
|
|
11
|
+
Hint = 4
|
|
12
|
+
}
|
|
13
|
+
export interface StanDiagnostic {
|
|
14
|
+
range: Range;
|
|
15
|
+
severity: DiagnosticSeverity;
|
|
16
|
+
message: string;
|
|
17
|
+
source?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface FormattingOptions {
|
|
2
|
+
/** Maximum line length for formatted code */
|
|
3
|
+
maxLineLength?: number;
|
|
4
|
+
/** Whether to canonicalize deprecations */
|
|
5
|
+
canonicalizeDeprecations?: boolean;
|
|
6
|
+
/** Whether to allow undefined functions */
|
|
7
|
+
allowUndefined?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface FormattingResult {
|
|
10
|
+
/** Whether formatting was successful */
|
|
11
|
+
success: boolean;
|
|
12
|
+
/** The formatted code if successful */
|
|
13
|
+
formattedCode?: string;
|
|
14
|
+
/** Error messages if formatting failed */
|
|
15
|
+
errors?: string[];
|
|
16
|
+
/** Warning messages from the formatter */
|
|
17
|
+
warnings?: string[];
|
|
18
|
+
}
|
|
19
|
+
export interface FormattingContext {
|
|
20
|
+
/** The filename being formatted */
|
|
21
|
+
filename: string;
|
|
22
|
+
/** The content to format */
|
|
23
|
+
content: string;
|
|
24
|
+
/** Include file contents */
|
|
25
|
+
includes?: Record<string, string>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/types/diagnostics.ts
|
|
2
|
+
var DiagnosticSeverity;
|
|
3
|
+
((DiagnosticSeverity2) => {
|
|
4
|
+
DiagnosticSeverity2[DiagnosticSeverity2["Error"] = 1] = "Error";
|
|
5
|
+
DiagnosticSeverity2[DiagnosticSeverity2["Warning"] = 2] = "Warning";
|
|
6
|
+
DiagnosticSeverity2[DiagnosticSeverity2["Information"] = 3] = "Information";
|
|
7
|
+
DiagnosticSeverity2[DiagnosticSeverity2["Hint"] = 4] = "Hint";
|
|
8
|
+
})(DiagnosticSeverity ||= {});
|
|
9
|
+
export {
|
|
10
|
+
DiagnosticSeverity
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stan-language-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-beta.1",
|
|
4
4
|
"description": "Language Server Protocol implementation for the Stan probabilistic programming language",
|
|
5
|
-
"main": "dist/server.js",
|
|
6
|
-
"module": "src/server.ts",
|
|
5
|
+
"main": "dist/server/index.js",
|
|
6
|
+
"module": "src/server/index.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"bin": {
|
|
9
|
-
"stan-language-server": "
|
|
9
|
+
"stan-language-server": "dist/server/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/server/index.js",
|
|
14
|
+
"types": "./dist/server/index.d.ts"
|
|
15
|
+
},
|
|
16
|
+
"./types": {
|
|
17
|
+
"import": "./dist/types/index.js",
|
|
18
|
+
"types": "./dist/types/index.d.ts"
|
|
19
|
+
}
|
|
10
20
|
},
|
|
11
21
|
"files": [
|
|
12
22
|
"dist/**/*",
|
|
@@ -36,8 +46,8 @@
|
|
|
36
46
|
"node": ">=18.0.0"
|
|
37
47
|
},
|
|
38
48
|
"scripts": {
|
|
39
|
-
"build": "bun build src/server.ts --outdir dist --target node --format esm",
|
|
40
|
-
"build:binary": "bun build src/server.ts --compile --outfile
|
|
49
|
+
"build": "bun build src/server/cli.ts --outdir dist/server --target node --format esm && bun build src/server/index.ts --outdir dist/server --target node --format esm && bun build src/types/index.ts --outdir dist/types --target node --format esm && tsc --emitDeclarationOnly --outDir dist",
|
|
50
|
+
"build:binary": "bun build src/server/cli.ts --compile --outfile bin/stan-language-server",
|
|
41
51
|
"prepublishOnly": "bun run build",
|
|
42
52
|
"version:set": "bun run scripts/set-version.ts",
|
|
43
53
|
"publish:npm": "npm publish --access public --provenance",
|
|
@@ -50,11 +60,11 @@
|
|
|
50
60
|
"typecheck": "tsc --noEmit",
|
|
51
61
|
"check": "bun run lint && bun run typecheck",
|
|
52
62
|
"test": "bun test",
|
|
53
|
-
"dev": "bun run src/server.ts"
|
|
63
|
+
"dev": "bun run src/server/cli.ts"
|
|
54
64
|
},
|
|
55
65
|
"devDependencies": {
|
|
56
66
|
"@types/bun": "latest",
|
|
57
|
-
"@types/node": "24.
|
|
67
|
+
"@types/node": "24.4.0",
|
|
58
68
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
59
69
|
"@typescript-eslint/parser": "^8.0.0",
|
|
60
70
|
"eslint": "^9.0.0",
|