runescript-lsp 0.0.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.
Files changed (192) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -0
  3. package/dist/cache/CompletionCache.d.ts +15 -0
  4. package/dist/cache/CompletionCache.js +58 -0
  5. package/dist/cache/CompletionCache.js.map +1 -0
  6. package/dist/cache/FileCache.d.ts +25 -0
  7. package/dist/cache/FileCache.js +101 -0
  8. package/dist/cache/FileCache.js.map +1 -0
  9. package/dist/cache/IdCache.d.ts +28 -0
  10. package/dist/cache/IdCache.js +47 -0
  11. package/dist/cache/IdCache.js.map +1 -0
  12. package/dist/cache/SymbolCache.d.ts +76 -0
  13. package/dist/cache/SymbolCache.js +205 -0
  14. package/dist/cache/SymbolCache.js.map +1 -0
  15. package/dist/cache/Trie.d.ts +22 -0
  16. package/dist/cache/Trie.js +122 -0
  17. package/dist/cache/Trie.js.map +1 -0
  18. package/dist/cache/WorkspaceCache.d.ts +32 -0
  19. package/dist/cache/WorkspaceCache.js +60 -0
  20. package/dist/cache/WorkspaceCache.js.map +1 -0
  21. package/dist/cache/cacheManager.d.ts +16 -0
  22. package/dist/cache/cacheManager.js +47 -0
  23. package/dist/cache/cacheManager.js.map +1 -0
  24. package/dist/handler/colorProvider.d.ts +2 -0
  25. package/dist/handler/colorProvider.js +103 -0
  26. package/dist/handler/colorProvider.js.map +1 -0
  27. package/dist/handler/commands.d.ts +6 -0
  28. package/dist/handler/commands.js +25 -0
  29. package/dist/handler/commands.js.map +1 -0
  30. package/dist/handler/completion.d.ts +3 -0
  31. package/dist/handler/completion.js +25 -0
  32. package/dist/handler/completion.js.map +1 -0
  33. package/dist/handler/definition.d.ts +2 -0
  34. package/dist/handler/definition.js +20 -0
  35. package/dist/handler/definition.js.map +1 -0
  36. package/dist/handler/fileEvents.d.ts +3 -0
  37. package/dist/handler/fileEvents.js +107 -0
  38. package/dist/handler/fileEvents.js.map +1 -0
  39. package/dist/handler/gitEvents.d.ts +6 -0
  40. package/dist/handler/gitEvents.js +22 -0
  41. package/dist/handler/gitEvents.js.map +1 -0
  42. package/dist/handler/hover.d.ts +2 -0
  43. package/dist/handler/hover.js +125 -0
  44. package/dist/handler/hover.js.map +1 -0
  45. package/dist/handler/references.d.ts +2 -0
  46. package/dist/handler/references.js +33 -0
  47. package/dist/handler/references.js.map +1 -0
  48. package/dist/handler/rename.d.ts +2 -0
  49. package/dist/handler/rename.js +6 -0
  50. package/dist/handler/rename.js.map +1 -0
  51. package/dist/handler/semanticTokens.d.ts +4 -0
  52. package/dist/handler/semanticTokens.js +40 -0
  53. package/dist/handler/semanticTokens.js.map +1 -0
  54. package/dist/handler/settingsEvents.d.ts +2 -0
  55. package/dist/handler/settingsEvents.js +11 -0
  56. package/dist/handler/settingsEvents.js.map +1 -0
  57. package/dist/handler/signatureHelp.d.ts +2 -0
  58. package/dist/handler/signatureHelp.js +6 -0
  59. package/dist/handler/signatureHelp.js.map +1 -0
  60. package/dist/handler/workspaceEvents.d.ts +2 -0
  61. package/dist/handler/workspaceEvents.js +30 -0
  62. package/dist/handler/workspaceEvents.js.map +1 -0
  63. package/dist/manager.d.ts +6 -0
  64. package/dist/manager.js +126 -0
  65. package/dist/manager.js.map +1 -0
  66. package/dist/parser/configParser.d.ts +29 -0
  67. package/dist/parser/configParser.js +216 -0
  68. package/dist/parser/configParser.js.map +1 -0
  69. package/dist/parser/constantParser.d.ts +14 -0
  70. package/dist/parser/constantParser.js +40 -0
  71. package/dist/parser/constantParser.js.map +1 -0
  72. package/dist/parser/dbtableParser.d.ts +18 -0
  73. package/dist/parser/dbtableParser.js +114 -0
  74. package/dist/parser/dbtableParser.js.map +1 -0
  75. package/dist/parser/packParser.d.ts +11 -0
  76. package/dist/parser/packParser.js +13 -0
  77. package/dist/parser/packParser.js.map +1 -0
  78. package/dist/parser/parser.d.ts +44 -0
  79. package/dist/parser/parser.js +34 -0
  80. package/dist/parser/parser.js.map +1 -0
  81. package/dist/parser/runescriptParser.d.ts +13 -0
  82. package/dist/parser/runescriptParser.js +28 -0
  83. package/dist/parser/runescriptParser.js.map +1 -0
  84. package/dist/public/commands.d.ts +1 -0
  85. package/dist/public/commands.js +2 -0
  86. package/dist/public/commands.js.map +1 -0
  87. package/dist/public/settings.d.ts +2 -0
  88. package/dist/public/settings.js +2 -0
  89. package/dist/public/settings.js.map +1 -0
  90. package/dist/public/types.d.ts +2 -0
  91. package/dist/public/types.js +2 -0
  92. package/dist/public/types.js.map +1 -0
  93. package/dist/resolver/configResolver.d.ts +2 -0
  94. package/dist/resolver/configResolver.js +102 -0
  95. package/dist/resolver/configResolver.js.map +1 -0
  96. package/dist/resolver/constantResolver.d.ts +2 -0
  97. package/dist/resolver/constantResolver.js +37 -0
  98. package/dist/resolver/constantResolver.js.map +1 -0
  99. package/dist/resolver/dbtableResolver.d.ts +2 -0
  100. package/dist/resolver/dbtableResolver.js +28 -0
  101. package/dist/resolver/dbtableResolver.js.map +1 -0
  102. package/dist/resolver/packResolver.d.ts +2 -0
  103. package/dist/resolver/packResolver.js +32 -0
  104. package/dist/resolver/packResolver.js.map +1 -0
  105. package/dist/resolver/resolver.d.ts +15 -0
  106. package/dist/resolver/resolver.js +95 -0
  107. package/dist/resolver/resolver.js.map +1 -0
  108. package/dist/resolver/runescriptResolver.d.ts +2 -0
  109. package/dist/resolver/runescriptResolver.js +347 -0
  110. package/dist/resolver/runescriptResolver.js.map +1 -0
  111. package/dist/resource/configKeys.d.ts +21 -0
  112. package/dist/resource/configKeys.js +86 -0
  113. package/dist/resource/configKeys.js.map +1 -0
  114. package/dist/resource/enum/displayItems.d.ts +13 -0
  115. package/dist/resource/enum/displayItems.js +23 -0
  116. package/dist/resource/enum/displayItems.js.map +1 -0
  117. package/dist/resource/enum/fileTypes.d.ts +26 -0
  118. package/dist/resource/enum/fileTypes.js +28 -0
  119. package/dist/resource/enum/fileTypes.js.map +1 -0
  120. package/dist/resource/enum/languages.d.ts +25 -0
  121. package/dist/resource/enum/languages.js +27 -0
  122. package/dist/resource/enum/languages.js.map +1 -0
  123. package/dist/resource/enum/regex.d.ts +24 -0
  124. package/dist/resource/enum/regex.js +25 -0
  125. package/dist/resource/enum/regex.js.map +1 -0
  126. package/dist/resource/enum/semanticTokens.d.ts +24 -0
  127. package/dist/resource/enum/semanticTokens.js +26 -0
  128. package/dist/resource/enum/semanticTokens.js.map +1 -0
  129. package/dist/resource/enum/symbolTypes.d.ts +49 -0
  130. package/dist/resource/enum/symbolTypes.js +51 -0
  131. package/dist/resource/enum/symbolTypes.js.map +1 -0
  132. package/dist/resource/enum/types.d.ts +47 -0
  133. package/dist/resource/enum/types.js +49 -0
  134. package/dist/resource/enum/types.js.map +1 -0
  135. package/dist/resource/scriptTriggers.d.ts +8 -0
  136. package/dist/resource/scriptTriggers.js +72 -0
  137. package/dist/resource/scriptTriggers.js.map +1 -0
  138. package/dist/resource/symbolConfig.d.ts +10 -0
  139. package/dist/resource/symbolConfig.js +234 -0
  140. package/dist/resource/symbolConfig.js.map +1 -0
  141. package/dist/resource/symbolPostProcessors.d.ts +15 -0
  142. package/dist/resource/symbolPostProcessors.js +70 -0
  143. package/dist/resource/symbolPostProcessors.js.map +1 -0
  144. package/dist/server.d.ts +1 -0
  145. package/dist/server.js +110 -0
  146. package/dist/server.js.map +1 -0
  147. package/dist/types.d.ts +214 -0
  148. package/dist/types.js +6 -0
  149. package/dist/types.js.map +1 -0
  150. package/dist/utils/cacheUtils.d.ts +12 -0
  151. package/dist/utils/cacheUtils.js +26 -0
  152. package/dist/utils/cacheUtils.js.map +1 -0
  153. package/dist/utils/connectionUtils.d.ts +3 -0
  154. package/dist/utils/connectionUtils.js +8 -0
  155. package/dist/utils/connectionUtils.js.map +1 -0
  156. package/dist/utils/diagnosticsUtils.d.ts +4 -0
  157. package/dist/utils/diagnosticsUtils.js +11 -0
  158. package/dist/utils/diagnosticsUtils.js.map +1 -0
  159. package/dist/utils/documentUtils.d.ts +5 -0
  160. package/dist/utils/documentUtils.js +14 -0
  161. package/dist/utils/documentUtils.js.map +1 -0
  162. package/dist/utils/fileUtils.d.ts +42 -0
  163. package/dist/utils/fileUtils.js +82 -0
  164. package/dist/utils/fileUtils.js.map +1 -0
  165. package/dist/utils/handlerUtils.d.ts +1 -0
  166. package/dist/utils/handlerUtils.js +5 -0
  167. package/dist/utils/handlerUtils.js.map +1 -0
  168. package/dist/utils/highlightUtils.d.ts +7 -0
  169. package/dist/utils/highlightUtils.js +52 -0
  170. package/dist/utils/highlightUtils.js.map +1 -0
  171. package/dist/utils/initUtils.d.ts +3 -0
  172. package/dist/utils/initUtils.js +18 -0
  173. package/dist/utils/initUtils.js.map +1 -0
  174. package/dist/utils/logger.d.ts +11 -0
  175. package/dist/utils/logger.js +38 -0
  176. package/dist/utils/logger.js.map +1 -0
  177. package/dist/utils/progressUtils.d.ts +7 -0
  178. package/dist/utils/progressUtils.js +31 -0
  179. package/dist/utils/progressUtils.js.map +1 -0
  180. package/dist/utils/resolverUtils.d.ts +17 -0
  181. package/dist/utils/resolverUtils.js +97 -0
  182. package/dist/utils/resolverUtils.js.map +1 -0
  183. package/dist/utils/settingsUtils.d.ts +19 -0
  184. package/dist/utils/settingsUtils.js +88 -0
  185. package/dist/utils/settingsUtils.js.map +1 -0
  186. package/dist/utils/symbolBuilder.d.ts +10 -0
  187. package/dist/utils/symbolBuilder.js +135 -0
  188. package/dist/utils/symbolBuilder.js.map +1 -0
  189. package/dist/utils/workspaceUtils.d.ts +11 -0
  190. package/dist/utils/workspaceUtils.js +52 -0
  191. package/dist/utils/workspaceUtils.js.map +1 -0
  192. package/package.json +51 -0
@@ -0,0 +1,214 @@
1
+ import type { Range } from "vscode-languageserver";
2
+ import type { ConfigVarArgSrc } from "./resource/configKeys.js";
3
+ import type { DisplayItem } from "./resource/enum/displayItems.js";
4
+ import type { FileType } from "./resource/enum/fileTypes.js";
5
+ import type { Language } from "./resource/enum/languages.js";
6
+ import type { SemanticTokenType } from "./resource/enum/semanticTokens.js";
7
+ import type { SymbolType } from "./resource/enum/symbolTypes.js";
8
+ import type { Type } from "./resource/enum/types.js";
9
+ export type ConfigKey = string;
10
+ export type SymbolKey = string;
11
+ export type FileKey = string;
12
+ export interface FileInfo {
13
+ name: string;
14
+ type: FileType;
15
+ uri: string;
16
+ fsPath: string;
17
+ workspace: string;
18
+ isMonitored: boolean;
19
+ isOpen: () => boolean;
20
+ }
21
+ /**
22
+ * The MatchType is the config that controls how symbols are built, cached, and displayed
23
+ */
24
+ export interface SymbolConfig {
25
+ /** The type of symbol this config is for */
26
+ symbolType: SymbolType;
27
+ /** The types which can correspond to a matchtype (ex: [namedobj, obj] are types for the OBJ matchType) */
28
+ types: Type[];
29
+ /** The file types where a matchType can be defined/declared */
30
+ fileTypes?: FileType[];
31
+ /** Override the color this type will show up as by assigning it to a semantic token type */
32
+ semanticTokenConfig?: {
33
+ declaration?: SemanticTokenType;
34
+ reference?: SemanticTokenType;
35
+ };
36
+ /** Whether or not symbols of this match type should be cached */
37
+ cache: boolean;
38
+ /** Whether or not this match type can be a callable or have parameters (like PROC, LOC, COMMAND...) */
39
+ callable?: boolean;
40
+ /** Whether or not symbols of this type have only references (no definition/declaration). Used mainly for symbols which refer to a file, like synths. */
41
+ referenceOnly?: boolean;
42
+ /** Whether or not symbols of this type should be allowed to be renamed (code change) */
43
+ allowRename: boolean;
44
+ /** Whether or not symbols declaration file name can be renamed (actual file rename) */
45
+ renameFile?: boolean;
46
+ /** Whether or not symbols of this type is no operation (used for finding matches and terminating matching early, but not ever cached or displayed) */
47
+ noop?: boolean;
48
+ /** The config settings for the hover display of symbols of this type */
49
+ hoverConfig?: HoverConfig;
50
+ /** The comparison type that is *always* used for this matchType, if it has multiple possible comparison types such as constants, handle that in the symbol instead */
51
+ comparisonType?: Type;
52
+ qualifiedName?: boolean;
53
+ /** Function that is executed after symbols of this type have been created (allows for more dynamic runtime info with full context to be tied to an symbol) */
54
+ postProcessor?: PostProcessor;
55
+ }
56
+ /**
57
+ * Config which controls how the hover display is built
58
+ */
59
+ export interface HoverConfig {
60
+ /** Hover items shown for declarations of a matchType */
61
+ declarationItems?: DisplayItem[];
62
+ /** Hover items shown for references of a matchType */
63
+ referenceItems?: DisplayItem[];
64
+ /** Language used for displaying code blocks of this matchType (for proper syntax highlighting) */
65
+ language?: Language;
66
+ /** Config line items to include in code block. Undefined shows all config items (default). */
67
+ configInclusions?: string[];
68
+ }
69
+ /**
70
+ * Function format for post processors which run when an symbol is created
71
+ */
72
+ export type PostProcessor = (symbol: RunescriptSymbol) => void;
73
+ /** Data which defines info about the values a config key expects (key=value(s)) */
74
+ export interface ConfigData {
75
+ /** The config key to look for, can be a direct string or a regex to match multiple keys */
76
+ key?: string;
77
+ /** The types of the params for this config key, in order */
78
+ params: SymbolType[];
79
+ /** Words to be ignored as params if they belong to this config key */
80
+ ignoreValues?: string[];
81
+ /** If this config key has var args, this data is used by the matcher to figure out the arg match types */
82
+ varArgs?: {
83
+ /** The source of the symbol where the vararg param types are defined */
84
+ symbolSource: ConfigVarArgSrc;
85
+ /** The symbol type the symbol where the varag param types are defined */
86
+ symbolType: SymbolType;
87
+ };
88
+ }
89
+ export interface FileConfigData {
90
+ /** Direct file keys to parse (direct string value) */
91
+ directMap: Map<ConfigKey, ConfigData>;
92
+ /** Regex file keys to test the key against to decide if to parse that config row */
93
+ regexMap: Map<RegExp, ConfigData>;
94
+ }
95
+ export interface SignatureReturn {
96
+ type: Type;
97
+ symbolType: SymbolType;
98
+ }
99
+ export interface SignatureParam extends SignatureReturn {
100
+ name: string;
101
+ }
102
+ /**
103
+ * The data used to represent a signature of a proc or other type
104
+ */
105
+ export interface Signature {
106
+ /** The parameters for the signature */
107
+ params: SignatureParam[];
108
+ /** The return types for the signature */
109
+ returns: SignatureReturn[];
110
+ getParamsDisplayText: () => string;
111
+ getReturnsDisplayText: () => string;
112
+ }
113
+ /**
114
+ * The definition of a runescript symbol
115
+ * This stores all of the data necessary for the core functions of the extension
116
+ * (finding references, going to definitions, showing hover display info, etc...)
117
+ */
118
+ export interface RunescriptSymbol {
119
+ /** The name of a symbol */
120
+ name: string;
121
+ /** The type of symbol */
122
+ symbolType: SymbolType;
123
+ /** This is the pack id (such as Obj ID 1234), if it has one */
124
+ id?: string;
125
+ /** The cache key for this symbol */
126
+ cacheName?: string;
127
+ /** The location of the declaration/definition of the symbol, if it has one */
128
+ declaration?: {
129
+ fsPath: string;
130
+ ref: string;
131
+ };
132
+ /** The locations (encoded as string) of the references of the symbol */
133
+ references: Record<string, Set<string>>;
134
+ /** The file type where the symbol exists/defined in */
135
+ fileType?: string;
136
+ /** The code language the symbol should use for syntax highlighting display purposes */
137
+ language: Language;
138
+ /** For displaying the symbol info text on hover (italicized body text, always on first line of body text) */
139
+ info?: string;
140
+ /** For referencing and displaying on hover the symbol params and return types. */
141
+ signature?: Signature;
142
+ /** For holding type data about dynamic configs */
143
+ dynamicConfigTypes?: Map<number, SymbolType>;
144
+ /** Lines from the config that are saved with the symbol */
145
+ configLines?: Map<string, string[]>;
146
+ /** For displaying the symbols code block on hover */
147
+ block?: string;
148
+ /** For displaying the symbols value text on hover (plain body text, positioned below info text but above signature or code blocks) */
149
+ value?: string;
150
+ /** Any extra data tied to this symbol */
151
+ extraData?: Record<string, any>;
152
+ /** Boolean indicating if hover text should not display for this symbol */
153
+ hideDisplay?: boolean;
154
+ /** The type(s) this symbol resolves to for comparison operations */
155
+ comparisonTypes?: SymbolType[];
156
+ /** Qualifier name, if it has one */
157
+ qualifier?: string;
158
+ }
159
+ export interface ParsedWord {
160
+ text: string;
161
+ start: number;
162
+ end: number;
163
+ }
164
+ /**
165
+ * Tracks the keys of symbol declarations and references within a file
166
+ */
167
+ export interface FileSymbols {
168
+ declarations: Set<SymbolKey>;
169
+ references: Set<SymbolKey>;
170
+ }
171
+ export interface SymbolBuilderExtraItems {
172
+ info?: string;
173
+ signature?: Signature;
174
+ configLines?: Map<string, string[]>;
175
+ extraData?: Record<string, any>;
176
+ }
177
+ export interface ResolvedSymbol {
178
+ symbol: RunescriptSymbol;
179
+ symbolConfig: SymbolConfig;
180
+ declaration: boolean;
181
+ context?: Record<string, any>;
182
+ }
183
+ export interface ResolvedData {
184
+ declaration: boolean;
185
+ symbolConfig: SymbolConfig;
186
+ line: number;
187
+ symbol?: RunescriptSymbol;
188
+ name?: string;
189
+ id?: string;
190
+ context?: Record<string, any>;
191
+ extraData?: Record<string, any>;
192
+ }
193
+ /**
194
+ * A wrapper interface that holds data and the start and end positions that data is contained in
195
+ */
196
+ export interface DataRange<T> {
197
+ start: number;
198
+ end: number;
199
+ data: T;
200
+ }
201
+ export type DevModeHighlightsResponse = {
202
+ uri: string;
203
+ ranges: {
204
+ kind: HighlightKind;
205
+ range: Range;
206
+ }[];
207
+ };
208
+ export type GetDecorationsParams = {
209
+ uri: string;
210
+ };
211
+ export declare enum HighlightKind {
212
+ Symbol = "symbol",
213
+ Unknown = "unknown"
214
+ }
package/dist/types.js ADDED
@@ -0,0 +1,6 @@
1
+ export var HighlightKind;
2
+ (function (HighlightKind) {
3
+ HighlightKind["Symbol"] = "symbol";
4
+ HighlightKind["Unknown"] = "unknown";
5
+ })(HighlightKind || (HighlightKind = {}));
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA6NA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;AACrB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
@@ -0,0 +1,12 @@
1
+ import { Location, Range } from "vscode-languageserver";
2
+ import { SymbolType } from "../resource/enum/symbolTypes.js";
3
+ import { SymbolKey } from "../types.js";
4
+ export declare function resolveSymbolKey(name: string, symbolType: SymbolType): SymbolKey;
5
+ export declare function encodeReference(line: number, startIndex: number, endIndex: number): string;
6
+ export declare function decodeReference(encodedValue?: string): {
7
+ line: number;
8
+ start: number;
9
+ end: number;
10
+ } | undefined;
11
+ export declare function decodeToRange(encodedValue?: string): Range | undefined;
12
+ export declare function decodeToLocation(uri: string, encodedValue?: string): Location | undefined;
@@ -0,0 +1,26 @@
1
+ import { buildLocation, buildRange } from "./resolverUtils.js";
2
+ export function resolveSymbolKey(name, symbolType) {
3
+ return `${symbolType}=>${name}`;
4
+ }
5
+ export function encodeReference(line, startIndex, endIndex) {
6
+ return `${line}|${startIndex}|${endIndex}`;
7
+ }
8
+ export function decodeReference(encodedValue) {
9
+ if (!encodedValue)
10
+ return undefined;
11
+ const split = encodedValue.split('|');
12
+ return (split.length !== 3) ? undefined : { line: Number(split[0]), start: Number(split[1]), end: Number(split[2]) };
13
+ }
14
+ export function decodeToRange(encodedValue) {
15
+ const decoded = decodeReference(encodedValue);
16
+ if (!decoded)
17
+ return undefined;
18
+ return buildRange(decoded.start, decoded.end, decoded.line);
19
+ }
20
+ export function decodeToLocation(uri, encodedValue) {
21
+ const decoded = decodeReference(encodedValue);
22
+ if (!decoded)
23
+ return undefined;
24
+ return buildLocation(decoded.start, decoded.end, decoded.line, uri);
25
+ }
26
+ //# sourceMappingURL=cacheUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cacheUtils.js","sourceRoot":"","sources":["../../src/utils/cacheUtils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,UAAsB;IACnE,OAAO,GAAG,UAAU,KAAK,IAAI,EAAE,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,UAAkB,EAAE,QAAgB;IAChF,OAAO,GAAG,IAAI,IAAI,UAAU,IAAI,QAAQ,EAAE,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,YAAqB;IACnD,IAAI,CAAC,YAAY;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,YAAqB;IACjD,MAAM,OAAO,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,YAAqB;IACjE,MAAM,OAAO,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,OAAO,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Connection } from "vscode-languageserver/node.js";
2
+ export declare function initConnection(conn: Connection): void;
3
+ export declare function getConnection(): Connection | undefined;
@@ -0,0 +1,8 @@
1
+ let connection;
2
+ export function initConnection(conn) {
3
+ connection = conn;
4
+ }
5
+ export function getConnection() {
6
+ return connection;
7
+ }
8
+ //# sourceMappingURL=connectionUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connectionUtils.js","sourceRoot":"","sources":["../../src/utils/connectionUtils.ts"],"names":[],"mappings":"AAEA,IAAI,UAAkC,CAAC;AAEvC,MAAM,UAAU,cAAc,CAAC,IAAgB;IAC7C,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Connection, Diagnostic } from "vscode-languageserver/node.js";
2
+ export declare function initDiagnostics(conn: Connection): void;
3
+ export declare function sendDiagnostics(uri: string, diagnostics: Diagnostic[]): void;
4
+ export declare function clearDiagnostics(uri: string): void;
@@ -0,0 +1,11 @@
1
+ let connection;
2
+ export function initDiagnostics(conn) {
3
+ connection = conn;
4
+ }
5
+ export function sendDiagnostics(uri, diagnostics) {
6
+ connection?.sendDiagnostics({ uri, diagnostics });
7
+ }
8
+ export function clearDiagnostics(uri) {
9
+ connection?.sendDiagnostics({ uri, diagnostics: [] });
10
+ }
11
+ //# sourceMappingURL=diagnosticsUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnosticsUtils.js","sourceRoot":"","sources":["../../src/utils/diagnosticsUtils.ts"],"names":[],"mappings":"AAEA,IAAI,UAAkC,CAAC;AAEvC,MAAM,UAAU,eAAe,CAAC,IAAgB;IAC9C,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,WAAyB;IACpE,UAAU,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,UAAU,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { TextDocuments } from "vscode-languageserver/node.js";
2
+ import type { TextDocument } from "vscode-languageserver-textdocument";
3
+ export declare function setDocuments(inputDocs: TextDocuments<TextDocument>): void;
4
+ export declare function getDocuments(): TextDocuments<TextDocument>;
5
+ export declare function isOpenDocument(uri: string): boolean;
@@ -0,0 +1,14 @@
1
+ let documents;
2
+ export function setDocuments(inputDocs) {
3
+ documents = inputDocs;
4
+ }
5
+ export function getDocuments() {
6
+ if (!documents) {
7
+ throw new Error("Documents manager not initialized.");
8
+ }
9
+ return documents;
10
+ }
11
+ export function isOpenDocument(uri) {
12
+ return getDocuments().get(uri) !== undefined;
13
+ }
14
+ //# sourceMappingURL=documentUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentUtils.js","sourceRoot":"","sources":["../../src/utils/documentUtils.ts"],"names":[],"mappings":"AAGA,IAAI,SAAkD,CAAC;AAEvD,MAAM,UAAU,YAAY,CAAC,SAAsC;IACjE,SAAS,GAAG,SAAS,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,YAAY,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { FileInfo } from "../types.js";
2
+ import { FileType } from "../resource/enum/fileTypes.js";
3
+ /**
4
+ * Map a uri into a resolved fsPath
5
+ * @param uri the uri string that comes from the LSP file events
6
+ * @returns the resolved fsPath of the uri
7
+ */
8
+ export declare function mapUri(uri: string): string;
9
+ /**
10
+ * Returns the file contents of a uri as a string
11
+ * @param fsPath
12
+ */
13
+ export declare function getFileText(fsPath: string): Promise<string>;
14
+ /**
15
+ * Returns the file info for a uri
16
+ * @param uri the uri to get file info for
17
+ */
18
+ export declare function uriToFileInfo(uri: string): FileInfo;
19
+ /**
20
+ * Returns the file info for a uri
21
+ * @param uri the uri to get file info for
22
+ */
23
+ export declare function fsPathToFileInfo(fsPath: string): FileInfo;
24
+ export declare function fsPathToUri(fsPath: string): string;
25
+ /**
26
+ * Returns the first line of the input string
27
+ * @param input string input
28
+ */
29
+ export declare function getLineText(input: string): string;
30
+ /**
31
+ * Returns the input string converted to an array of strings, one for each line
32
+ * @param input string input
33
+ */
34
+ export declare function getLines(input: string): string[];
35
+ /**
36
+ * Files which this extension is interested in
37
+ */
38
+ export declare const monitoredFileTypes: Set<FileType>;
39
+ /**
40
+ * Checks if the file extension of the uri is in the list of monitored file types
41
+ */
42
+ export declare function isValidFile(uri: string): boolean;
@@ -0,0 +1,82 @@
1
+ import { promises as fs } from "fs";
2
+ import path from "path";
3
+ import { URI } from "vscode-uri";
4
+ import { END_OF_LINE_REGEX } from "../resource/enum/regex.js";
5
+ import { FileType } from "../resource/enum/fileTypes.js";
6
+ import { findWorkspaceFolder } from "./workspaceUtils.js";
7
+ import { isOpenDocument } from "./documentUtils.js";
8
+ import { getAllSymbolConfigs } from "../resource/symbolConfig.js";
9
+ /**
10
+ * Map a uri into a resolved fsPath
11
+ * @param uri the uri string that comes from the LSP file events
12
+ * @returns the resolved fsPath of the uri
13
+ */
14
+ export function mapUri(uri) {
15
+ return path.resolve(URI.parse(uri).fsPath);
16
+ }
17
+ /**
18
+ * Returns the file contents of a uri as a string
19
+ * @param fsPath
20
+ */
21
+ export async function getFileText(fsPath) {
22
+ return await fs.readFile(fsPath, "utf8");
23
+ }
24
+ /**
25
+ * Returns the file info for a uri
26
+ * @param uri the uri to get file info for
27
+ */
28
+ export function uriToFileInfo(uri) {
29
+ const fsPath = mapUri(uri);
30
+ const workspace = findWorkspaceFolder(fsPath) ?? 'none';
31
+ const fileSplit = fsPath.split('\\').pop().split('/').pop().split('.');
32
+ const type = fileSplit[1];
33
+ return { uri, fsPath, workspace, name: fileSplit[0], type, isMonitored: monitoredFileTypes.has(type), isOpen: () => isOpenDocument(uri) };
34
+ }
35
+ /**
36
+ * Returns the file info for a uri
37
+ * @param uri the uri to get file info for
38
+ */
39
+ export function fsPathToFileInfo(fsPath) {
40
+ const uri = URI.file(fsPath).toString();
41
+ const workspace = findWorkspaceFolder(fsPath) ?? 'none';
42
+ const fileSplit = fsPath.split('\\').pop().split('/').pop().split('.');
43
+ const type = fileSplit[1];
44
+ return { uri, fsPath, workspace, name: fileSplit[0], type, isMonitored: monitoredFileTypes.has(type), isOpen: () => isOpenDocument(uri) };
45
+ }
46
+ export function fsPathToUri(fsPath) {
47
+ return URI.file(fsPath).toString();
48
+ }
49
+ /**
50
+ * Returns the first line of the input string
51
+ * @param input string input
52
+ */
53
+ export function getLineText(input) {
54
+ const endOfLine = END_OF_LINE_REGEX.exec(input);
55
+ return !endOfLine ? input : input.substring(0, endOfLine.index);
56
+ }
57
+ /**
58
+ * Returns the input string converted to an array of strings, one for each line
59
+ * @param input string input
60
+ */
61
+ export function getLines(input) {
62
+ return input.split(END_OF_LINE_REGEX);
63
+ }
64
+ /**
65
+ * Files which this extension is interested in
66
+ */
67
+ export const monitoredFileTypes = new Set();
68
+ monitoredFileTypes.add(FileType.Pack);
69
+ getAllSymbolConfigs().filter(config => !config.referenceOnly).forEach(config => {
70
+ const fileTypes = config.fileTypes || [];
71
+ for (const fileType of fileTypes) {
72
+ monitoredFileTypes.add(fileType);
73
+ }
74
+ });
75
+ /**
76
+ * Checks if the file extension of the uri is in the list of monitored file types
77
+ */
78
+ export function isValidFile(uri) {
79
+ const ext = uri.split(/[#?]/)[0].split('.').pop()?.trim();
80
+ return ext !== undefined && monitoredFileTypes.has(ext);
81
+ }
82
+ //# sourceMappingURL=fileUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../../src/utils/fileUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CA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mBAAmB,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;IAC7E,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;IACzC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;AACH,CAAC,CAAC,CAAC;AAEH;;EAEE;AACF,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,CAAC;IAC1D,OAAO,GAAG,KAAK,SAAS,IAAI,kBAAkB,CAAC,GAAG,CAAC,GAAe,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function getLanguage(params: any): string | undefined;
@@ -0,0 +1,5 @@
1
+ import { getDocuments } from "./documentUtils.js";
2
+ export function getLanguage(params) {
3
+ return getDocuments().get(params.textDocument.uri)?.languageId;
4
+ }
5
+ //# sourceMappingURL=handlerUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handlerUtils.js","sourceRoot":"","sources":["../../src/utils/handlerUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,UAAU,WAAW,CAAC,MAAW;IACrC,OAAO,YAAY,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC;AACjE,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Connection } from "vscode-languageserver/node.js";
2
+ import { FileInfo } from "../types.js";
3
+ import { WorkspaceCache } from "../cache/WorkspaceCache.js";
4
+ export declare function initHighlights(conn: Connection): void;
5
+ export declare function sendAllHighlights(cache: WorkspaceCache): void;
6
+ export declare function clearAllHighlights(): void;
7
+ export declare function sendFileHighlights(fileInfo: FileInfo): void;
@@ -0,0 +1,52 @@
1
+ import { RequestType } from "vscode-languageserver/node.js";
2
+ import { getWorkspaceCache } from "../cache/cacheManager.js";
3
+ import { isDevMode } from "./settingsUtils.js";
4
+ import { uriToFileInfo } from "./fileUtils.js";
5
+ import { getWorkspaceFolders } from "./workspaceUtils.js";
6
+ let connection;
7
+ export function initHighlights(conn) {
8
+ connection = conn;
9
+ connection.onRequest(new RequestType("runescript/getDecorations"), async ({ uri }) => {
10
+ if (!isDevMode())
11
+ return;
12
+ const fileInfo = uriToFileInfo(uri);
13
+ const fileCache = getWorkspaceCache(fileInfo.workspace).getFileCache(fileInfo.fsPath);
14
+ const ranges = fileCache ? fileCache.getSymbolRanges() : [];
15
+ return { uri, ranges };
16
+ });
17
+ }
18
+ export function sendAllHighlights(cache) {
19
+ if (!connection || !isDevMode())
20
+ return;
21
+ for (const [_fsPath, fileCache] of cache.getFileCaches()) {
22
+ connection.sendNotification("runescript/decorations", {
23
+ uri: fileCache.getFileInfo().uri,
24
+ ranges: fileCache.getSymbolRanges()
25
+ });
26
+ }
27
+ }
28
+ export function clearAllHighlights() {
29
+ if (!connection)
30
+ return;
31
+ getWorkspaceFolders().forEach(workspace => {
32
+ for (const [_fsPath, fileCache] of getWorkspaceCache(workspace).getFileCaches()) {
33
+ connection.sendNotification("runescript/decorations", {
34
+ uri: fileCache.getFileInfo().uri,
35
+ ranges: []
36
+ });
37
+ }
38
+ });
39
+ }
40
+ export function sendFileHighlights(fileInfo) {
41
+ if (!connection || !isDevMode())
42
+ return;
43
+ const fileCache = getWorkspaceCache(fileInfo.workspace).getFileCache(fileInfo.fsPath);
44
+ if (!fileCache) {
45
+ return;
46
+ }
47
+ connection.sendNotification("runescript/decorations", {
48
+ uri: fileInfo.uri,
49
+ ranges: fileCache.getSymbolRanges()
50
+ });
51
+ }
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pD,GAAG,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG;YAChC,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE;SACpC,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC,UAAU;QAAE,OAAO;IACxB,mBAAmB,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QACxC,KAAK,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,iBAAiB,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC;YAChF,UAAW,CAAC,gBAAgB,CAAC,wBAAwB,EAAE;gBACrD,GAAG,EAAE,SAAS,CAAC,WAAW,EAAE,CAAC,GAAG;gBAChC,MAAM,EAAE,EAAE;aACX,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,QAAkB;IACnD,IAAI,CAAC,UAAU,IAAI,CAAC,SAAS,EAAE;QAAE,OAAO;IACxC,MAAM,SAAS,GAAG,iBAAiB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IACD,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,EAAE;QACpD,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM,EAAE,SAAS,CAAC,eAAe,EAAE;KACpC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function startInit(promise: Promise<void>): void;
2
+ export declare function getIsInitializing(): boolean;
3
+ export declare function getInitPromise(): Promise<void> | null;
@@ -0,0 +1,18 @@
1
+ import { log } from "./logger.js";
2
+ let isInitializing = true;
3
+ let initPromise = null;
4
+ export function startInit(promise) {
5
+ isInitializing = true;
6
+ initPromise = promise.finally(() => {
7
+ isInitializing = false;
8
+ initPromise = null;
9
+ log(`Initialization and initial workspace indexing complete`);
10
+ });
11
+ }
12
+ export function getIsInitializing() {
13
+ return isInitializing;
14
+ }
15
+ export function getInitPromise() {
16
+ return initPromise;
17
+ }
18
+ //# sourceMappingURL=initUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initUtils.js","sourceRoot":"","sources":["../../src/utils/initUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,IAAI,cAAc,GAAG,IAAI,CAAC;AAC1B,IAAI,WAAW,GAAyB,IAAI,CAAC;AAE7C,MAAM,UAAU,SAAS,CAAC,OAAsB;IAC9C,cAAc,GAAG,IAAI,CAAC;IACtB,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;QACjC,cAAc,GAAG,KAAK,CAAC;QACvB,WAAW,GAAG,IAAI,CAAC;QACnB,GAAG,CAAC,wDAAwD,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Connection } from "vscode-languageserver/node.js";
2
+ import { FileInfo } from "../types.js";
3
+ export declare function initLogger(conn: Connection): void;
4
+ export declare function log(message: string): void;
5
+ export declare function info(message: string): void;
6
+ export declare function warn(message: string): void;
7
+ export declare function error(message: string): void;
8
+ export declare function logSettingsChange(name: string, value: boolean): void;
9
+ export declare function logFileEvent(eventName: string, fileInfo: FileInfo): void;
10
+ export declare function logWorkspaceEvent(workspace: string, opened: boolean): void;
11
+ export declare function formatMs(millis: number): string;
@@ -0,0 +1,38 @@
1
+ import { isDevMode } from "./settingsUtils.js";
2
+ let connection;
3
+ export function initLogger(conn) {
4
+ connection = conn;
5
+ }
6
+ function prefix(message, type) {
7
+ return type ? `[runescript-lsp] ${type}: ${message}` : `[runescript-lsp] ${message}`;
8
+ }
9
+ export function log(message) {
10
+ if (isDevMode())
11
+ connection?.console.log(prefix(message));
12
+ }
13
+ export function info(message) {
14
+ if (isDevMode())
15
+ connection?.console.log(prefix(message, ' info'));
16
+ }
17
+ export function warn(message) {
18
+ if (isDevMode())
19
+ connection?.console.log(prefix(message, ' warn'));
20
+ }
21
+ export function error(message) {
22
+ if (isDevMode())
23
+ connection?.console.log(prefix(message, 'error'));
24
+ }
25
+ export function logSettingsChange(name, value) {
26
+ if (isDevMode())
27
+ connection?.console.log(prefix(`Setting [${name}] ${value ? 'enabled' : 'disabled'}`));
28
+ }
29
+ export function logFileEvent(eventName, fileInfo) {
30
+ log(`${eventName}: ${fileInfo.name}.${fileInfo.type} [workspace: ${fileInfo.workspace}]`);
31
+ }
32
+ export function logWorkspaceEvent(workspace, opened) {
33
+ log(`Workspace change event: workspace ${opened ? 'opened' : 'closed'} [${workspace}]`);
34
+ }
35
+ export function formatMs(millis) {
36
+ return `${millis.toFixed(2)} ms`;
37
+ }
38
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,IAAI,UAAkC,CAAC;AAEvC,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,UAAU,GAAG,IAAI,CAAC;AACpB,CAAC;AAED,SAAS,MAAM,CAAC,OAAe,EAAE,IAAa;IAC5C,OAAO,IAAI,CAAA,CAAC,CAAC,oBAAoB,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC,CAAC,oBAAoB,OAAO,EAAE,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,OAAe;IACjC,IAAI,SAAS,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;AAC5D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
+ import type { Connection } from "vscode-languageserver/node.js";
2
+ export type ProgressHandle = {
3
+ report: (percentageOrMessage?: number | string, message?: string) => void;
4
+ done: () => void;
5
+ };
6
+ export declare function initProgress(conn: Connection): void;
7
+ export declare function startProgress(title: string, message?: string, percentage?: number, cancellable?: boolean): Promise<ProgressHandle>;