UNPKG

2.93 kBTypeScriptView Raw
1import { Range } from 'vscode-languageserver-types';
2export declare class Variable {
3 private readonly name;
4 private readonly nameRange;
5 private readonly range;
6 private readonly modifier;
7 private readonly modifierRange;
8 private readonly substitutionParameter;
9 private readonly substitutionRange;
10 private readonly defined;
11 private readonly buildVariable;
12 private readonly stringValue;
13 constructor(name: string, nameRange: Range, range: Range, modifier: string | null, modifierRange: Range | null, substitutionParameter: string | null, substitutionRange: Range | null, defined: boolean, buildVariable: boolean, stringValue: string);
14 toString(): string;
15 getName(): string;
16 getNameRange(): Range;
17 /**
18 * Returns the range of the entire variable. This includes the symbols for
19 * the declaration of the variable such as the $, {, and } symbols.
20 *
21 * @return the range in the document that this variable encompasses in its
22 * entirety
23 */
24 getRange(): Range;
25 /**
26 * Returns the modifier character that has been set for
27 * specifying how this variable should be expanded and resolved.
28 * If this variable is ${variable:+value} then the modifier
29 * character is '+'. Will be the empty string if the variable is
30 * declared as ${variable:}. Otherwise, will be null if this
31 * variable will not use variable substitution at all (such as
32 * ${variable} or $variable).
33 *
34 * @return this variable's modifier character, or the empty
35 * string if it does not have one, or null if this
36 * variable will not use variable substitution
37 */
38 getModifier(): string | null;
39 getModifierRange(): Range | null;
40 /**
41 * Returns the parameter that will be used for substitution if
42 * this variable uses modifiers to define how its value should be
43 * resolved. If this variable is ${variable:+value} then the
44 * substitution value will be 'value'. Will be the empty string
45 * if the variable is declared as ${variable:+} or some other
46 * variant where the only thing that follows the modifier
47 * character (excluding considerations of escape characters and
48 * so on) is the variable's closing bracket. May be null if this
49 * variable does not have a modifier character defined (such as
50 * ${variable} or $variable).
51 *
52 * @return this variable's substitution parameter, or the empty
53 * string if it does not have one, or null if there is
54 * not one defined
55 */
56 getSubstitutionParameter(): string | null;
57 getSubstitutionRange(): Range | null;
58 /**
59 * Returns whether this variable has been defined or not.
60 *
61 * @return true if this variable has been defined, false otherwise
62 */
63 isDefined(): boolean;
64 isBuildVariable(): boolean;
65 isEnvironmentVariable(): boolean;
66}