stan-language-server 0.1.0 → 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/__tests__/handlers/compilation.test.d.ts +1 -0
- package/dist/__tests__/handlers/diagnostics.test.d.ts +1 -0
- package/dist/__tests__/handlers/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/constants/index.d.ts +1 -0
- package/dist/handlers/compilation/compilation.d.ts +9 -0
- package/dist/handlers/compilation/includes.d.ts +11 -0
- package/dist/handlers/completion.d.ts +3 -0
- package/dist/handlers/diagnostics.d.ts +5 -0
- package/dist/handlers/formatting.d.ts +7 -0
- package/dist/handlers/hover.d.ts +8 -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/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/index.d.ts +4 -0
- package/dist/server/index.js +865 -0
- package/dist/types/common.d.ts +19 -0
- package/dist/types/completion.d.ts +15 -0
- package/dist/types/diagnostics.d.ts +18 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +19 -8
- package/dist/server.js +0 -89754
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SERVER_ID = "stan-language-server";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
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>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TextDocuments, WorkspaceFolder, type RemoteConsole } from "vscode-languageserver";
|
|
2
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
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>>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type CompletionParams, TextDocuments, CompletionItem } from "vscode-languageserver";
|
|
2
|
+
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
+
export declare function handleCompletion(params: CompletionParams, documents: TextDocuments<TextDocument>): CompletionItem[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Diagnostic, TextDocuments, WorkspaceFolder, type DocumentDiagnosticParams, type RemoteConsole } from "vscode-languageserver";
|
|
2
|
+
import { TextDocument } from "vscode-languageserver-textdocument";
|
|
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[]>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DocumentFormattingParams, RemoteConsole, TextDocuments, TextEdit, WorkspaceFolder } from "vscode-languageserver";
|
|
2
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
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
|
+
}>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HoverParams, Hover, MarkupContent } from "vscode-languageserver";
|
|
2
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
3
|
+
export declare const manual_functions: string[];
|
|
4
|
+
type MarkupLookupMap = Map<string, MarkupContent>;
|
|
5
|
+
type GetMarkupLookupMapFn = () => MarkupLookupMap;
|
|
6
|
+
export declare const handleHover: (getMarkupLookupFn: GetMarkupLookupMapFn) => (document: TextDocument, params: HoverParams) => Promise<Hover | null>;
|
|
7
|
+
declare const _default: (document: TextDocument, params: HoverParams) => Promise<Hover | null>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import TrieSearch, { type TrieSearchOptions } from "trie-search";
|
|
2
|
+
import type { Searchable, Position } from "../../types/completion";
|
|
3
|
+
export declare const getSearchableItems: <T extends Searchable>(xs: T[], options?: TrieSearchOptions<T>) => TrieSearch<T>;
|
|
4
|
+
export declare const getTextUpToCursor: (text: string, position: Position) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Range } from "../../types/diagnostics";
|
|
2
|
+
declare function rangeFromMessage(message: string): Range | undefined;
|
|
3
|
+
declare function getWarningMessage(message: string): string;
|
|
4
|
+
declare function getErrorMessage(message: string): string;
|
|
5
|
+
export { rangeFromMessage, getWarningMessage, getErrorMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tryDistributionHover: (text: string, beginningOfWord: number, endOfWord: number) => string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const tryFunctionHover: (text: string, beginningOfWord: number, endOfWord: number) => string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { provideHover } from "./provider";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function provideHover(text: string, beginningOfWord: number, endOfWord: number): string | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const isWordChar: (char: string) => boolean;
|
|
2
|
+
export declare const isWhitespace: (char: string) => char is " " | "\n" | "\t" | "\r";
|
|
3
|
+
export declare const previousWordBoundary: (text: string, pos: number) => number;
|
|
4
|
+
export declare const wordUntilNextParenthesis: (text: string, pos: number) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|