stan-language-server 0.2.0-beta.1 → 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/README.md +15 -10
- package/dist/constants/index.d.ts +1 -0
- package/dist/handlers/compilation/compilation.d.ts +8 -3
- package/dist/handlers/compilation/includes.d.ts +9 -2
- package/dist/handlers/diagnostics.d.ts +3 -1
- package/dist/handlers/formatting.d.ts +5 -2
- package/dist/handlers/hover.d.ts +1 -0
- package/dist/handlers/index.d.ts +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +385 -89270
- package/dist/types/common.d.ts +2 -0
- package/dist/types/index.d.ts +0 -1
- package/package.json +5 -4
- package/dist/__tests__/compiler.test.d.ts +0 -1
- package/dist/__tests__/handlers/formatting.test.d.ts +0 -1
- package/dist/__tests__/includes.test.d.ts +0 -1
- package/dist/__tests__/language/formatting/integration.test.d.ts +0 -1
- package/dist/language/formatting/index.d.ts +0 -1
- package/dist/language/formatting/provider.d.ts +0 -2
- package/dist/server/cli.js +0 -89754
- package/dist/stanc/compiler.d.ts +0 -9
- package/dist/stanc/includes.d.ts +0 -10
- package/dist/stanc/provider.d.ts +0 -2
- package/dist/stanc/stanc.d.ts +0 -2
- package/dist/types/formatting.d.ts +0 -26
- package/dist/types/index.js +0 -11
package/README.md
CHANGED
|
@@ -29,26 +29,31 @@ bun build server.ts --compile --outfile stan-language-server
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
## Configuration
|
|
32
|
+
|
|
32
33
|
### Sublime Text 4
|
|
33
34
|
|
|
34
35
|
```json
|
|
35
36
|
{
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
"clients": {
|
|
38
|
+
"stan-lsp": {
|
|
39
|
+
"enabled": true,
|
|
40
|
+
"command": ["/YOUR/PATH/TO/stan-language-server", "--stdio"],
|
|
41
|
+
"selector": "source.stan | source.stanfunctions",
|
|
42
|
+
"initializationOptions": {},
|
|
43
|
+
"settings": {
|
|
44
|
+
"stan-language-server": { "includePaths": [], "maxLineLength": 78 }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
44
47
|
}
|
|
48
|
+
|
|
45
49
|
```
|
|
46
50
|
|
|
47
51
|
### Emacs (eglot)
|
|
48
52
|
|
|
49
53
|
Assuming you are using stan-ts-mode:
|
|
54
|
+
|
|
50
55
|
```elisp
|
|
51
56
|
(with-eval-after-load 'eglot
|
|
52
|
-
(add-to-list 'eglot-server-programs
|
|
53
|
-
'(stan-ts-mode . ("/YOUR/PATH/TO/stan-language-server"))))
|
|
57
|
+
(add-to-list 'eglot-server-programs
|
|
58
|
+
'(stan-ts-mode . ("/YOUR/PATH/TO/stan-language-server" "--stdio"))))
|
|
54
59
|
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SERVER_ID = "stan-language-server";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
2
|
-
import type
|
|
3
|
-
import type { StancReturn } from "../../types/common";
|
|
4
|
-
export
|
|
2
|
+
import { type TextDocuments, type WorkspaceFolder, type RemoteConsole } from "vscode-languageserver";
|
|
3
|
+
import type { FileSystemReader, StancReturn } from "../../types/common";
|
|
4
|
+
export interface Settings {
|
|
5
|
+
maxLineLength: number;
|
|
6
|
+
includePaths: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare const defaultSettings: Settings;
|
|
9
|
+
export declare function handleCompilation(document: TextDocument, documentManager: TextDocuments<TextDocument>, workspaceFolders: WorkspaceFolder[], settings: Settings, logger: RemoteConsole, reader?: FileSystemReader): Promise<StancReturn>;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { TextDocuments, WorkspaceFolder, type RemoteConsole } from "vscode-languageserver";
|
|
2
2
|
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
-
import
|
|
4
|
-
export
|
|
3
|
+
import type { FileSystemReader } from "../../types";
|
|
4
|
+
export type Filename = string;
|
|
5
|
+
export type FileContent = string;
|
|
6
|
+
export type FilePathError = {
|
|
7
|
+
msg: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getFilenames(fileContent: string): Filename[];
|
|
10
|
+
export declare function isFilePathError(value: unknown): value is FilePathError;
|
|
11
|
+
export declare function handleIncludes(document: TextDocument, documentManager: TextDocuments<TextDocument>, workspaceFolders: WorkspaceFolder[], includePaths: string[], logger: RemoteConsole, reader?: FileSystemReader): Promise<Record<Filename, FileContent>>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Diagnostic, TextDocuments, WorkspaceFolder, type DocumentDiagnosticParams, type RemoteConsole } from "vscode-languageserver";
|
|
2
2
|
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
-
|
|
3
|
+
import { type Settings } from "./compilation/compilation";
|
|
4
|
+
import type { FileSystemReader } from "../types";
|
|
5
|
+
export declare function handleDiagnostics(params: DocumentDiagnosticParams, documents: TextDocuments<TextDocument>, workspaceFolders: WorkspaceFolder[], settings: Settings, logger: RemoteConsole, reader?: FileSystemReader): Promise<Diagnostic[]>;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { DocumentFormattingParams, RemoteConsole, TextDocuments, TextEdit, WorkspaceFolder } from "vscode-languageserver";
|
|
2
2
|
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { type Settings } from "./compilation/compilation";
|
|
4
|
+
import type { FileSystemReader } from "../types";
|
|
5
|
+
export declare function handleFormatting(params: DocumentFormattingParams, documents: TextDocuments<TextDocument>, workspaceFolders: WorkspaceFolder[], settings: Settings, logger: RemoteConsole, reader?: FileSystemReader): Promise<TextEdit[] | {
|
|
6
|
+
errors: string[];
|
|
7
|
+
}>;
|
package/dist/handlers/hover.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HoverParams, Hover, MarkupContent } from "vscode-languageserver";
|
|
2
2
|
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
+
export declare const manual_functions: string[];
|
|
3
4
|
type MarkupLookupMap = Map<string, MarkupContent>;
|
|
4
5
|
type GetMarkupLookupMapFn = () => MarkupLookupMap;
|
|
5
6
|
export declare const handleHover: (getMarkupLookupFn: GetMarkupLookupMapFn) => (document: TextDocument, params: HoverParams) => Promise<Hover | null>;
|
package/dist/handlers/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { handleCompletion } from "./completion";
|
|
2
2
|
export { handleDiagnostics } from "./diagnostics";
|
|
3
3
|
export { default as handleHover } from "./hover";
|
|
4
|
-
export { handleFormatting
|
|
4
|
+
export { handleFormatting } from "./formatting";
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { type Connection } from "vscode-languageserver/node";
|
|
2
|
-
|
|
2
|
+
import { type FileSystemReader } from "../types/common.ts";
|
|
3
|
+
declare const startLanguageServer: (connection: Connection, reader?: FileSystemReader) => void;
|
|
3
4
|
export default startLanguageServer;
|