@arcgis/arcade-languageservice 5.2.0-next.91 → 5.2.0-next.94
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/dist/arcade-language-service.d.ts +22 -0
- package/dist/index.d.ts +6 -1591
- package/dist/index.js +817 -2721
- package/dist/services/api-context.d.ts +7 -0
- package/dist/services/api-diagnostic.d.ts +62 -0
- package/dist/services/arcade-formatting/arcade-formatting.d.ts +18 -0
- package/dist/services/arcade-formatting/index.d.ts +2 -0
- package/dist/services/arcade-formatting/options.d.ts +28 -0
- package/dist/services/languageKeywords.d.ts +7 -0
- package/package.json +3 -2
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ApiContext } from "@arcgis/languages-api-utils";
|
|
2
|
+
import type { FormattingOptions } from "./arcade-formatting/options.js";
|
|
3
|
+
|
|
4
|
+
export interface ArcadeApiContext extends ApiContext {
|
|
5
|
+
/** Options to control how the script should be formatted */
|
|
6
|
+
formattingOptions?: FormattingOptions;
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type * as Parser from "@arcgis/arcade-parser";
|
|
2
|
+
import type { Range, DiagnosticSeverity } from "vscode-languageserver-types";
|
|
3
|
+
|
|
4
|
+
export { DiagnosticSeverity } from "vscode-languageserver-types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the data associated with a diagnostic.
|
|
8
|
+
* For example in case of an error associated to an identifier,
|
|
9
|
+
* the DiagnosticData will contain a key 'identifier' and its value.
|
|
10
|
+
*/
|
|
11
|
+
export type DiagnosticData = Record<string, number | string>;
|
|
12
|
+
|
|
13
|
+
/** The combined diagnostic codes */
|
|
14
|
+
export type DiagnosticCodes = Parser.DiagnosticCodes | ValidationDiagnosticCodes;
|
|
15
|
+
|
|
16
|
+
/** Represents a diagnostic, such as a parsing error or warning. */
|
|
17
|
+
export interface Diagnostic {
|
|
18
|
+
/** The range at which the message applies */
|
|
19
|
+
range: Range;
|
|
20
|
+
/**
|
|
21
|
+
* The diagnostic's severity. Can be omitted. If omitted it is up to the
|
|
22
|
+
* client to interpret diagnostics as error, warning, info or hint.
|
|
23
|
+
*/
|
|
24
|
+
severity?: DiagnosticSeverity;
|
|
25
|
+
/** The diagnostic's code. */
|
|
26
|
+
code: DiagnosticCodes;
|
|
27
|
+
/** The diagnostic's message. It usually appears in the user interface */
|
|
28
|
+
message: string;
|
|
29
|
+
/**
|
|
30
|
+
* A data entry field that is preserved between a `textDocument/publishDiagnostics`
|
|
31
|
+
* notification and `textDocument/codeAction` request.
|
|
32
|
+
*/
|
|
33
|
+
data?: DiagnosticData | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const ValidationDiagnosticCodes: {
|
|
37
|
+
readonly AlreadyDefined: "AlreadyDefined";
|
|
38
|
+
readonly ApiConflict: "ApiConflict";
|
|
39
|
+
readonly AssignedNeverUsed: "AssignedNeverUsed";
|
|
40
|
+
readonly DefinedNeverAssigned: "DefinedNeverAssigned";
|
|
41
|
+
readonly DefinedNeverUsed: "DefinedNeverUsed";
|
|
42
|
+
readonly EmptyBlockStatement: "EmptyBlockStatement";
|
|
43
|
+
readonly ExecutionError: "ExecutionError";
|
|
44
|
+
readonly InvalidApiFunctionUsage: "InvalidApiFunctionUsage";
|
|
45
|
+
readonly InvalidConstantIdentifier: "InvalidConstantIdentifier";
|
|
46
|
+
readonly InvalidPropertyIdentifier: "InvalidPropertyIdentifier";
|
|
47
|
+
readonly NoArgumentExpected: "NoArgumentExpected";
|
|
48
|
+
readonly NotADictionary: "NotADictionary";
|
|
49
|
+
readonly NotDefined: "NotDefined";
|
|
50
|
+
readonly NotEnoughArguments: "NotEnoughArguments";
|
|
51
|
+
readonly ProfileVariablesAreImmutable: "ProfileVariablesAreImmutable";
|
|
52
|
+
readonly ProfileVariablesConflict: "ProfileVariablesConflict";
|
|
53
|
+
readonly ReservedKeyword: "ReservedKeyword";
|
|
54
|
+
readonly TooManyArguments: "TooManyArguments";
|
|
55
|
+
readonly UnexpectedEmptyFunction: "UnexpectedEmptyFunction";
|
|
56
|
+
readonly UnexpectedPropertyIdentifier: "UnexpectedPropertyIdentifier";
|
|
57
|
+
readonly UnknownPropertyIdentifier: "UnknownPropertyIdentifier";
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type ValidationDiagnosticCodes = (typeof ValidationDiagnosticCodes)[keyof typeof ValidationDiagnosticCodes];
|
|
61
|
+
|
|
62
|
+
export const DiagnosticMessages: Record<Parser.DiagnosticCodes | ValidationDiagnosticCodes, string>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TextDocument } from "vscode-languageserver-textdocument";
|
|
2
|
+
import type { TextEdit } from "vscode-languageserver-types";
|
|
3
|
+
import type { ArcadeApiContext } from "../api-context.js";
|
|
4
|
+
import type { FormattingOptions } from "./options.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param document
|
|
8
|
+
* @param context
|
|
9
|
+
*/
|
|
10
|
+
export function arcadeFormat(document: TextDocument, context?: ArcadeApiContext): TextEdit[];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Format code using options.
|
|
14
|
+
*
|
|
15
|
+
* @param script
|
|
16
|
+
* @param options
|
|
17
|
+
*/
|
|
18
|
+
export function format(script: string, options?: FormattingOptions): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Describes the formatting options */
|
|
2
|
+
export interface FormattingOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Number of spaces the formatter should use for indentation.
|
|
5
|
+
* If you do not pass this option explicitly, it will be
|
|
6
|
+
* (quite reliably!) inferred from the original code.
|
|
7
|
+
*
|
|
8
|
+
* @default 2
|
|
9
|
+
*/
|
|
10
|
+
indentWidth?: number;
|
|
11
|
+
/**
|
|
12
|
+
* Some of the formatter code (such as that for printing function
|
|
13
|
+
* parameter lists) makes a valiant attempt to prevent really long
|
|
14
|
+
* lines. You can adjust the limit by changing this option; however,
|
|
15
|
+
* there is no guarantee that line length will fit inside this limit.
|
|
16
|
+
*
|
|
17
|
+
* @default 80
|
|
18
|
+
*/
|
|
19
|
+
wrapColumn?: number;
|
|
20
|
+
/**
|
|
21
|
+
* If you want to override the quotes used in string literals, specify
|
|
22
|
+
* either "single", "double", or "auto" here ("auto" will select the one
|
|
23
|
+
* which results in the shorter literal) Otherwise, use double quotes.
|
|
24
|
+
*
|
|
25
|
+
* @default null
|
|
26
|
+
*/
|
|
27
|
+
quote?: "auto" | "double" | "single" | null;
|
|
28
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/arcade-languageservice",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.94",
|
|
4
4
|
"description": "Arcade Language Service",
|
|
5
5
|
"homepage": "https://developers.arcgis.com/javascript/latest/",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
],
|
|
13
13
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@arcgis/
|
|
15
|
+
"@arcgis/arcade-parser": "5.2.0-next.94",
|
|
16
|
+
"@arcgis/languages-api-utils": "5.2.0-next.94",
|
|
16
17
|
"tslib": "^2.8.1",
|
|
17
18
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
18
19
|
"vscode-languageserver-types": "^3.17.5"
|