@redocly/openapi-language-server 0.0.3 → 0.0.4
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/lib/index.d.ts +530 -13
- package/package.json +3 -4
- package/lib/config.d.ts +0 -28
- package/lib/server/bundle.d.ts +0 -18
- package/lib/server/completion/yaml/KeyCompletion.d.ts +0 -17
- package/lib/server/completion/yaml/LocalFileCompletion.d.ts +0 -4
- package/lib/server/completion/yaml/LocalFolderCompletion.d.ts +0 -6
- package/lib/server/completion/yaml/ValueCompletion.d.ts +0 -23
- package/lib/server/completion/yaml/common.d.ts +0 -7
- package/lib/server/completion/yaml/completion.d.ts +0 -9
- package/lib/server/completion/yaml/context.d.ts +0 -25
- package/lib/server/completion/yaml/insert-snippet-utils.d.ts +0 -15
- package/lib/server/completion/yaml/paths.d.ts +0 -26
- package/lib/server/context-core.d.ts +0 -20
- package/lib/server/documents.d.ts +0 -16
- package/lib/server/external-resolver.d.ts +0 -5
- package/lib/server/hints.d.ts +0 -7
- package/lib/server/openapi-config.d.ts +0 -7
- package/lib/server/openapi-extensions.d.ts +0 -76
- package/lib/server/path.d.ts +0 -8
- package/lib/server/sort.d.ts +0 -43
- package/lib/server/types/completion.d.ts +0 -16
- package/lib/server/types/context-core.d.ts +0 -42
- package/lib/server/utils.d.ts +0 -16
- package/lib/server/validation/index.d.ts +0 -7
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,530 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
declare module '@redocly/openapi-language-server/config' {
|
|
2
|
+
import { TextDocuments } from 'vscode-languageserver/browser';
|
|
3
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
+
import { URI } from 'vscode-uri';
|
|
5
|
+
export interface SupportedLanguage {
|
|
6
|
+
languageId: string;
|
|
7
|
+
filePattern: RegExp;
|
|
8
|
+
}
|
|
9
|
+
export const yamlLanguage: SupportedLanguage;
|
|
10
|
+
export const jsonLanguage: SupportedLanguage;
|
|
11
|
+
export interface FileSystemProvider {
|
|
12
|
+
readFile(uri: URI, encoding?: string): Promise<string>;
|
|
13
|
+
readDir(uri: URI): Promise<any>;
|
|
14
|
+
stat(uri: URI): Promise<{
|
|
15
|
+
isFile(): boolean;
|
|
16
|
+
isDirectory(): boolean;
|
|
17
|
+
}>;
|
|
18
|
+
exists(uri: URI): Promise<boolean>;
|
|
19
|
+
}
|
|
20
|
+
export class Configuration {
|
|
21
|
+
private _fs;
|
|
22
|
+
private _documentManager;
|
|
23
|
+
supportedLanguages: SupportedLanguage[];
|
|
24
|
+
registerFileSystemProvider(fsProvider: FileSystemProvider): void;
|
|
25
|
+
registerDocumentsProvider(documentProvider: TextDocuments<TextDocument>): void;
|
|
26
|
+
get fs(): FileSystemProvider;
|
|
27
|
+
get documents(): TextDocuments<TextDocument>;
|
|
28
|
+
}
|
|
29
|
+
export const config: Configuration;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
declare module '@redocly/openapi-language-server/index' {
|
|
33
|
+
import { CompletionItem, CompletionParams, DidChangeWatchedFilesParams } from 'vscode-languageserver/browser';
|
|
34
|
+
import { isConfigFile } from '@redocly/openapi-language-server/server/openapi-config';
|
|
35
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
36
|
+
import { config } from '@redocly/openapi-language-server/config';
|
|
37
|
+
class OpenapiLanguageServer {
|
|
38
|
+
onCompletion(params: CompletionParams): Promise<CompletionItem[]>;
|
|
39
|
+
onCompletionResolve(item: CompletionItem): Promise<CompletionItem>;
|
|
40
|
+
validateOpenAPI(textDocument: TextDocument): Promise<import("vscode-languageserver/browser").PublishDiagnosticsParams[]>;
|
|
41
|
+
onDidChangeWatchedFiles(params: DidChangeWatchedFilesParams): Promise<(Promise<import("vscode-languageserver/browser").PublishDiagnosticsParams[]> | Promise<Promise<import("vscode-languageserver/browser").PublishDiagnosticsParams[]>>)[]>;
|
|
42
|
+
onDidConfigChange(): Promise<(Promise<import("vscode-languageserver/browser").PublishDiagnosticsParams[]> | Promise<Promise<import("vscode-languageserver/browser").PublishDiagnosticsParams[]>>)[]>;
|
|
43
|
+
onDidChangeConfiguration(): Promise<(Promise<import("vscode-languageserver/browser").PublishDiagnosticsParams[]> | Promise<Promise<import("vscode-languageserver/browser").PublishDiagnosticsParams[]>>)[]>;
|
|
44
|
+
}
|
|
45
|
+
export { OpenapiLanguageServer, config, isConfigFile };
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
declare module '@redocly/openapi-language-server/server/bundle' {
|
|
49
|
+
import { NormalizedProblem } from '@redocly/openapi-core';
|
|
50
|
+
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
51
|
+
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
52
|
+
export type DefinitionData = {
|
|
53
|
+
name: string;
|
|
54
|
+
uri: string;
|
|
55
|
+
};
|
|
56
|
+
export type BundleData = DefinitionData & {
|
|
57
|
+
definition: Record<string, any>;
|
|
58
|
+
rootType: NormalizedNodeType;
|
|
59
|
+
refTypes: [string, NormalizedNodeType][];
|
|
60
|
+
htmlTempalteStyles?: string | null;
|
|
61
|
+
errors?: NormalizedProblem[];
|
|
62
|
+
};
|
|
63
|
+
export function bundleOpenAPI(textDocument: TextDocument, errors: NormalizedProblem[]): Promise<void>;
|
|
64
|
+
export function getBundle(path: string): any;
|
|
65
|
+
export function getBundles(): BundleData[];
|
|
66
|
+
export function getRefTypes(path: string): NormalizedNodeType | undefined | null;
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/KeyCompletion' {
|
|
70
|
+
import { CompletionItem, CompletionItemKind, InsertTextFormat, Command } from 'vscode-languageserver/browser';
|
|
71
|
+
import type { CompletionItemOptions } from '@redocly/openapi-language-server/server/types/completion';
|
|
72
|
+
export interface KeyCompletionOptions extends CompletionItemOptions {
|
|
73
|
+
insertTextFormat?: InsertTextFormat;
|
|
74
|
+
data?: any;
|
|
75
|
+
}
|
|
76
|
+
export class KeyCompletion implements CompletionItem {
|
|
77
|
+
kind: CompletionItemKind;
|
|
78
|
+
label: string;
|
|
79
|
+
insertText: string;
|
|
80
|
+
filterText: string;
|
|
81
|
+
sortText?: string;
|
|
82
|
+
command?: Command;
|
|
83
|
+
insertTextFormat: InsertTextFormat;
|
|
84
|
+
data?: any;
|
|
85
|
+
constructor({ kind, label, insertText, insertTextFormat, filterText, sortText, data, }: KeyCompletionOptions);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
}
|
|
89
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/LocalFileCompletion' {
|
|
90
|
+
import { ValueCompletion, ValueCompletionOptions } from '@redocly/openapi-language-server/server/completion/yaml/ValueCompletion';
|
|
91
|
+
export class LocalFileCompletion extends ValueCompletion {
|
|
92
|
+
constructor(completionOptions: ValueCompletionOptions);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/LocalFolderCompletion' {
|
|
97
|
+
import { Command } from 'vscode-languageserver/browser';
|
|
98
|
+
import { ValueCompletion, ValueCompletionOptions } from '@redocly/openapi-language-server/server/completion/yaml/ValueCompletion';
|
|
99
|
+
export class LocalFolderCompletion extends ValueCompletion {
|
|
100
|
+
command: Command;
|
|
101
|
+
constructor(completionOptions: ValueCompletionOptions);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
}
|
|
105
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/ValueCompletion' {
|
|
106
|
+
import { YAMLScalar } from '@redocly/yaml-language-server-parser';
|
|
107
|
+
import { CompletionItem, CompletionItemKind, TextEdit, InsertReplaceEdit, Position, Command } from 'vscode-languageserver/browser';
|
|
108
|
+
import type { CompletionItemOptions } from '@redocly/openapi-language-server/server/types/completion';
|
|
109
|
+
export interface ValueCompletionDataOptions {
|
|
110
|
+
position?: Position;
|
|
111
|
+
node?: YAMLScalar;
|
|
112
|
+
lineOffset?: number;
|
|
113
|
+
}
|
|
114
|
+
export interface ValueCompletionOptions extends CompletionItemOptions {
|
|
115
|
+
value?: string;
|
|
116
|
+
data: ValueCompletionDataOptions;
|
|
117
|
+
}
|
|
118
|
+
export class ValueCompletion implements CompletionItem {
|
|
119
|
+
kind: CompletionItemKind;
|
|
120
|
+
label: string;
|
|
121
|
+
insertText: string;
|
|
122
|
+
filterText: string;
|
|
123
|
+
sortText?: string;
|
|
124
|
+
command?: Command;
|
|
125
|
+
textEdit?: TextEdit | InsertReplaceEdit;
|
|
126
|
+
constructor({ kind, label, value, textEdit, filterText, sortText, data, }: ValueCompletionOptions);
|
|
127
|
+
getTextEdit(node: YAMLScalar, position: Position, lineOffset: number): TextEdit | InsertReplaceEdit;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
}
|
|
131
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/common' {
|
|
132
|
+
export const fieldNames: {
|
|
133
|
+
example: string;
|
|
134
|
+
default: string;
|
|
135
|
+
enum: string;
|
|
136
|
+
ref: string;
|
|
137
|
+
};
|
|
138
|
+
export const userEnumCompletionKeys: string[];
|
|
139
|
+
|
|
140
|
+
}
|
|
141
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/completion' {
|
|
142
|
+
import * as yamlAst from '@redocly/yaml-language-server-parser';
|
|
143
|
+
import { CompletionItem, Position } from 'vscode-languageserver/browser';
|
|
144
|
+
import { DocumentUri } from 'vscode-languageserver-textdocument';
|
|
145
|
+
import { ValueCompletion } from '@redocly/openapi-language-server/server/completion/yaml/ValueCompletion';
|
|
146
|
+
import { YamlCompletionContext } from '@redocly/openapi-language-server/server/completion/yaml/context';
|
|
147
|
+
export function getCompletionKeys(completionContext: YamlCompletionContext): CompletionItem[];
|
|
148
|
+
export function getCompletionValues(uri: DocumentUri, completionContext: YamlCompletionContext<yamlAst.YAMLScalar>): Promise<ValueCompletion[]>;
|
|
149
|
+
export function getCompletion(uri: DocumentUri, position: Position): Promise<CompletionItem[]>;
|
|
150
|
+
export function resolveCompletion(item: CompletionItem): CompletionItem;
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/context' {
|
|
154
|
+
import { DocumentUri, Position } from 'vscode-languageserver-textdocument';
|
|
155
|
+
import { YAMLNode } from '@redocly/yaml-language-server-parser';
|
|
156
|
+
import { URI } from 'vscode-uri';
|
|
157
|
+
import { NodePath } from '@redocly/openapi-language-server/server/types/context-core';
|
|
158
|
+
import { ExtendedNormalizedNodeType } from '@redocly/openapi-language-server/server/types/completion';
|
|
159
|
+
export interface YamlCompletionContext<NodeType = YAMLNode> {
|
|
160
|
+
currentAst: YAMLNode;
|
|
161
|
+
node: NodeType;
|
|
162
|
+
nodePath: NodePath;
|
|
163
|
+
position: Position;
|
|
164
|
+
lineText: string;
|
|
165
|
+
lineOffset: number;
|
|
166
|
+
openApiType: ExtendedNormalizedNodeType | null;
|
|
167
|
+
}
|
|
168
|
+
export interface RefPathResolverContext {
|
|
169
|
+
docAbsolutePath: URI;
|
|
170
|
+
docAbsoluteDirPath: URI;
|
|
171
|
+
refPath: string;
|
|
172
|
+
refDirPath: URI;
|
|
173
|
+
refDirAbsolutePath: URI;
|
|
174
|
+
isAbsolutePath: boolean;
|
|
175
|
+
root: string;
|
|
176
|
+
}
|
|
177
|
+
export function createCompletionContext<NodeType = YAMLNode>(uri: DocumentUri, position: Position): Promise<YamlCompletionContext<NodeType>>;
|
|
178
|
+
export function createRefPathResolverContext(uri: DocumentUri, refPath: string): Promise<RefPathResolverContext>;
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/insert-snippet-utils' {
|
|
182
|
+
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
183
|
+
export type PartialNodeType = {
|
|
184
|
+
items?: NormalizedNodeType['items'];
|
|
185
|
+
required?: NormalizedNodeType['required'];
|
|
186
|
+
};
|
|
187
|
+
function getKeyValue(key: string, type?: PartialNodeType): string;
|
|
188
|
+
function getBeforeKeyValue(key: string, value: string, beforeKey: string, type?: PartialNodeType): string;
|
|
189
|
+
function getAfterKeyValue(key: string): "" | ": ";
|
|
190
|
+
function getBeforeKey(lineText?: string): "" | " " | "\n ";
|
|
191
|
+
function getAfterValue(beforeKey: string, properties?: NormalizedNodeType['properties']): "" | "\n " | "\n ";
|
|
192
|
+
function getInsertSnippet(key: string, data?: {
|
|
193
|
+
properties?: NormalizedNodeType['properties'];
|
|
194
|
+
lineText: string;
|
|
195
|
+
} & PartialNodeType, addNewLine?: boolean): string;
|
|
196
|
+
export { getInsertSnippet, getAfterKeyValue, getAfterValue, getKeyValue, getBeforeKey, getBeforeKeyValue, };
|
|
197
|
+
|
|
198
|
+
}
|
|
199
|
+
declare module '@redocly/openapi-language-server/server/completion/yaml/paths' {
|
|
200
|
+
import { DocumentUri } from 'vscode-languageserver-textdocument';
|
|
201
|
+
import { YAMLScalar } from '@redocly/yaml-language-server-parser';
|
|
202
|
+
import { SupportedLanguage } from '@redocly/openapi-language-server/config';
|
|
203
|
+
import { LocalFolderCompletion } from '@redocly/openapi-language-server/server/completion/yaml/LocalFolderCompletion';
|
|
204
|
+
import { LocalFileCompletion } from '@redocly/openapi-language-server/server/completion/yaml/LocalFileCompletion';
|
|
205
|
+
import { YamlCompletionContext, RefPathResolverContext } from '@redocly/openapi-language-server/server/completion/yaml/context';
|
|
206
|
+
export const LOCAL_FILES_SUPPORTED_SUGGESTIONS: SupportedLanguage[];
|
|
207
|
+
export enum FsNodeType {
|
|
208
|
+
File = 0,
|
|
209
|
+
Folder = 1
|
|
210
|
+
}
|
|
211
|
+
export interface RefFileStat {
|
|
212
|
+
type: FsNodeType;
|
|
213
|
+
name: string;
|
|
214
|
+
}
|
|
215
|
+
export interface RefPathOption extends RefFileStat {
|
|
216
|
+
value: string;
|
|
217
|
+
matchBy: string;
|
|
218
|
+
sortBy: string;
|
|
219
|
+
}
|
|
220
|
+
export function getToTopOption(pathResolverContext: RefPathResolverContext): RefPathOption;
|
|
221
|
+
export function getChildrenOfPath(files: string[], config: {
|
|
222
|
+
supportedFiles: SupportedLanguage[];
|
|
223
|
+
}, pathResolverContext: RefPathResolverContext): Promise<RefFileStat[]>;
|
|
224
|
+
export function getRefPathOptions(fileStats: RefFileStat[], pathResolverContext: RefPathResolverContext): RefPathOption[];
|
|
225
|
+
export function getLocalFsRefs(uri: DocumentUri, completionContext: YamlCompletionContext<YAMLScalar>): Promise<(LocalFolderCompletion | LocalFileCompletion)[]>;
|
|
226
|
+
|
|
227
|
+
}
|
|
228
|
+
declare module '@redocly/openapi-language-server/server/context-core' {
|
|
229
|
+
import { OasVersion, OasMajorVersion } from '@redocly/openapi-core';
|
|
230
|
+
import * as yamlAst from '@redocly/yaml-language-server-parser';
|
|
231
|
+
import type { Position } from 'vscode-languageserver/browser';
|
|
232
|
+
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
233
|
+
import type { ContextData, ExistingValues } from '@redocly/openapi-language-server/server/types/context-core';
|
|
234
|
+
import type { OpenApiVersion, TextDocumentWithLineOffset, NodeWithPath, NodePath } from '@redocly/openapi-language-server/server/types/context-core';
|
|
235
|
+
export function getContextData(uri: string, position: Position): Promise<ContextData>;
|
|
236
|
+
export function getAstNodeByPath(currentAst: yamlAst.YAMLNode | null, path: (number | string)[]): yamlAst.YAMLNode | null;
|
|
237
|
+
export function getAstNodeByPosition(start: NodeWithPath, position: Position, document: TextDocumentWithLineOffset, isContextData?: boolean): NodeWithPath;
|
|
238
|
+
export function getNodeLineIndent(node: yamlAst.YAMLNode | null | undefined, document: TextDocumentWithLineOffset): number;
|
|
239
|
+
export function getTypesByNodePath(types: any, nodePath: NodePath): {
|
|
240
|
+
currentType: NormalizedNodeType | null;
|
|
241
|
+
parentType: NormalizedNodeType | null;
|
|
242
|
+
endPath: string | null;
|
|
243
|
+
};
|
|
244
|
+
export function getRootTypes(ast: yamlAst.YAMLNode, uri: string): NormalizedNodeType | null;
|
|
245
|
+
export function getOASVersion(ast: yamlAst.YAMLNode): OpenApiVersion<OasVersion>;
|
|
246
|
+
export function getOASMajorVersion(ast: yamlAst.YAMLNode): OpenApiVersion<OasMajorVersion>;
|
|
247
|
+
export function getChildNodes(node?: yamlAst.YAMLNode | null): yamlAst.YAMLNode[];
|
|
248
|
+
export function getExistingValues(node: yamlAst.YAMLSequence, values?: ExistingValues, indent?: number): ExistingValues;
|
|
249
|
+
|
|
250
|
+
}
|
|
251
|
+
declare module '@redocly/openapi-language-server/server/documents' {
|
|
252
|
+
import { DocumentUri } from 'vscode-languageserver/browser';
|
|
253
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
254
|
+
export type DocumentStats = {
|
|
255
|
+
dependencyPaths: Set<string>;
|
|
256
|
+
durationMS: number;
|
|
257
|
+
};
|
|
258
|
+
export type DependencyStats = {
|
|
259
|
+
documentPath: string;
|
|
260
|
+
durationMS: number;
|
|
261
|
+
};
|
|
262
|
+
export function updateDependencyMap(path: string, stats: DocumentStats): Map<string, DocumentStats>;
|
|
263
|
+
export function getPathsByDependency(depPath: string): DependencyStats[];
|
|
264
|
+
export function getDocumentLanguageId(uri: DocumentUri): string;
|
|
265
|
+
export function getDocumentByURI(uri: DocumentUri): Promise<TextDocument>;
|
|
266
|
+
export function isJsonFile(uri: DocumentUri): boolean;
|
|
267
|
+
export function isYamlFile(uri: DocumentUri): boolean;
|
|
268
|
+
|
|
269
|
+
}
|
|
270
|
+
declare module '@redocly/openapi-language-server/server/external-resolver' {
|
|
271
|
+
import { BaseResolver, Source } from '@redocly/openapi-core';
|
|
272
|
+
export class ExternalResolver extends BaseResolver {
|
|
273
|
+
resolveExternalRef(base: string, ref: string): string;
|
|
274
|
+
loadExternalRef(absoluteRef: string): Promise<Source>;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
}
|
|
278
|
+
declare module '@redocly/openapi-language-server/server/hints' {
|
|
279
|
+
import { CompletionItem } from 'vscode-languageserver/browser';
|
|
280
|
+
import { ExtendedNormalizedNodeType } from '@redocly/openapi-language-server/server/types/completion';
|
|
281
|
+
export const START_SEQ_LABEL = "newItem";
|
|
282
|
+
export const START_MAP_LABEL = "propertyName";
|
|
283
|
+
export const ADD_NEW_LINE = "newLine";
|
|
284
|
+
export function hasHints(type: ExtendedNormalizedNodeType): boolean;
|
|
285
|
+
export function getAdditionalCompletionItem(name: string): CompletionItem[];
|
|
286
|
+
|
|
287
|
+
}
|
|
288
|
+
declare module '@redocly/openapi-language-server/server/openapi-config' {
|
|
289
|
+
import { Config as OpenAPIConfig } from '@redocly/openapi-core';
|
|
290
|
+
export { CONFIG_FILE_NAMES } from '@redocly/openapi-core';
|
|
291
|
+
export function isConfigFile(uri: string): boolean;
|
|
292
|
+
export function getOpenAPIConfig({ cache }?: {
|
|
293
|
+
cache?: boolean;
|
|
294
|
+
}): Promise<OpenAPIConfig>;
|
|
295
|
+
export function updateOpenApiConfig(): Promise<OpenAPIConfig>;
|
|
296
|
+
|
|
297
|
+
}
|
|
298
|
+
declare module '@redocly/openapi-language-server/server/openapi-extensions' {
|
|
299
|
+
import { ExtendedNormalizedNodeType } from '@redocly/openapi-language-server/server/types/completion';
|
|
300
|
+
import { mapTypeToComponent } from '@redocly/openapi-core';
|
|
301
|
+
const typeExtensions: {
|
|
302
|
+
Schema: {
|
|
303
|
+
name: string;
|
|
304
|
+
value: {
|
|
305
|
+
type: string;
|
|
306
|
+
name: string;
|
|
307
|
+
};
|
|
308
|
+
}[];
|
|
309
|
+
PathItem: {
|
|
310
|
+
name: string;
|
|
311
|
+
value: {
|
|
312
|
+
type: string;
|
|
313
|
+
name: string;
|
|
314
|
+
};
|
|
315
|
+
}[];
|
|
316
|
+
Parameter: {
|
|
317
|
+
name: string;
|
|
318
|
+
value: {
|
|
319
|
+
type: string;
|
|
320
|
+
name: string;
|
|
321
|
+
};
|
|
322
|
+
}[];
|
|
323
|
+
Response: {
|
|
324
|
+
name: string;
|
|
325
|
+
value: {
|
|
326
|
+
type: string;
|
|
327
|
+
name: string;
|
|
328
|
+
};
|
|
329
|
+
}[];
|
|
330
|
+
Example: {
|
|
331
|
+
name: string;
|
|
332
|
+
value: {
|
|
333
|
+
type: string;
|
|
334
|
+
name: string;
|
|
335
|
+
};
|
|
336
|
+
}[];
|
|
337
|
+
RequestBody: {
|
|
338
|
+
name: string;
|
|
339
|
+
value: {
|
|
340
|
+
type: string;
|
|
341
|
+
name: string;
|
|
342
|
+
};
|
|
343
|
+
}[];
|
|
344
|
+
Header: {
|
|
345
|
+
name: string;
|
|
346
|
+
value: {
|
|
347
|
+
type: string;
|
|
348
|
+
name: string;
|
|
349
|
+
};
|
|
350
|
+
}[];
|
|
351
|
+
SecuritySchema: {
|
|
352
|
+
name: string;
|
|
353
|
+
value: {
|
|
354
|
+
type: string;
|
|
355
|
+
name: string;
|
|
356
|
+
};
|
|
357
|
+
}[];
|
|
358
|
+
Link: {
|
|
359
|
+
name: string;
|
|
360
|
+
value: {
|
|
361
|
+
type: string;
|
|
362
|
+
name: string;
|
|
363
|
+
};
|
|
364
|
+
}[];
|
|
365
|
+
Callback: {
|
|
366
|
+
name: string;
|
|
367
|
+
value: {
|
|
368
|
+
type: string;
|
|
369
|
+
name: string;
|
|
370
|
+
};
|
|
371
|
+
}[];
|
|
372
|
+
};
|
|
373
|
+
function extendOASType(type: ExtendedNormalizedNodeType): ExtendedNormalizedNodeType;
|
|
374
|
+
export { typeExtensions, extendOASType, mapTypeToComponent };
|
|
375
|
+
|
|
376
|
+
}
|
|
377
|
+
declare module '@redocly/openapi-language-server/server/path' {
|
|
378
|
+
import { DocumentUri } from 'vscode-languageserver/browser';
|
|
379
|
+
import { URI } from 'vscode-uri';
|
|
380
|
+
export function parseUri(path: string): URI;
|
|
381
|
+
export function isHttpPath(path: string): boolean;
|
|
382
|
+
export function uriBaseName(uri: DocumentUri): string;
|
|
383
|
+
export function getFileExtension(uri: DocumentUri): string;
|
|
384
|
+
export function noTrailingSlash(path: string): string;
|
|
385
|
+
export function getClosestExistingDir(uri: URI, baseDir?: string): Promise<URI>;
|
|
386
|
+
|
|
387
|
+
}
|
|
388
|
+
declare module '@redocly/openapi-language-server/server/sort' {
|
|
389
|
+
export function getSortText(typeName: string | null, label?: string): string;
|
|
390
|
+
export enum SortTypes {
|
|
391
|
+
FileCompletion = "FileCompletion",
|
|
392
|
+
FolderCompletion = "FolderCompletion",
|
|
393
|
+
LocalComponentCompletion = "LocalComponentCompletion",
|
|
394
|
+
NewLine = "newLine",
|
|
395
|
+
PropertyName = "propertyName",
|
|
396
|
+
NewItem = "newItem",
|
|
397
|
+
PathMap = "PathMap",
|
|
398
|
+
MediaTypeMap = "MediaTypeMap",
|
|
399
|
+
DefinitionRoot = "DefinitionRoot",
|
|
400
|
+
DefinitionRootOpenapi = "DefinitionRoot_openapi",
|
|
401
|
+
DefinitionRootInfo = "DefinitionRoot_info",
|
|
402
|
+
DefinitionRootJsonSchemaDialect = "DefinitionRoot_jsonSchemaDialect",
|
|
403
|
+
DefinitionRootServers = "DefinitionRoot_servers",
|
|
404
|
+
DefinitionRootPaths = "DefinitionRoot_paths",
|
|
405
|
+
DefinitionRootWebhooks = "DefinitionRoot_webhooks",
|
|
406
|
+
DefinitionRootComponents = "DefinitionRoot_components",
|
|
407
|
+
DefinitionRootSecurity = "DefinitionRoot_security",
|
|
408
|
+
DefinitionRootTags = "DefinitionRoot_tags",
|
|
409
|
+
DefinitionRootExternalDocs = "DefinitionRoot_externalDocs",
|
|
410
|
+
Info = "Info",
|
|
411
|
+
InfoTitle = "Info_title",
|
|
412
|
+
InfoSummary = "Info_summary",
|
|
413
|
+
InfoDescription = "Info_description",
|
|
414
|
+
InfoTermsOfService = "Info_termsOfService",
|
|
415
|
+
InfoContact = "Info_contact",
|
|
416
|
+
ContactName = "Contact_name",
|
|
417
|
+
ContactUrl = "Contact_url",
|
|
418
|
+
ContactEmail = "Contact_email",
|
|
419
|
+
InfoLicense = "Info_license",
|
|
420
|
+
LicenseName = "License_name",
|
|
421
|
+
LicenseIdentifier = "License_identifier",
|
|
422
|
+
LicenseUrl = "License_url",
|
|
423
|
+
InfoVersion = "Info_version",
|
|
424
|
+
jsonSchemaDialect = "jsonSchemaDialect",
|
|
425
|
+
ServerList = "Server_List",
|
|
426
|
+
ServerUrl = "Server_url",
|
|
427
|
+
ServerDescription = "Server_description",
|
|
428
|
+
ServerVariables = "Server_variables",
|
|
429
|
+
Default = "Default"
|
|
430
|
+
}
|
|
431
|
+
export const sortLabelObject: Record<SortTypes, string>;
|
|
432
|
+
|
|
433
|
+
}
|
|
434
|
+
declare module '@redocly/openapi-language-server/server/types/completion' {
|
|
435
|
+
import { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
436
|
+
import { CompletionItemKind, TextEdit, InsertReplaceEdit } from 'vscode-languageserver/browser';
|
|
437
|
+
type ExtendedNormalizedNodeType = NormalizedNodeType & {
|
|
438
|
+
isExample?: true;
|
|
439
|
+
enum?: string[];
|
|
440
|
+
type?: string;
|
|
441
|
+
};
|
|
442
|
+
interface CompletionItemOptions {
|
|
443
|
+
label: string;
|
|
444
|
+
kind?: CompletionItemKind;
|
|
445
|
+
sortText?: string;
|
|
446
|
+
textEdit?: TextEdit | InsertReplaceEdit;
|
|
447
|
+
insertText?: string;
|
|
448
|
+
filterText?: string;
|
|
449
|
+
}
|
|
450
|
+
export type { ExtendedNormalizedNodeType, CompletionItemOptions };
|
|
451
|
+
|
|
452
|
+
}
|
|
453
|
+
declare module '@redocly/openapi-language-server/server/types/context-core' {
|
|
454
|
+
import yamlAst from '@redocly/yaml-language-server-parser';
|
|
455
|
+
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
456
|
+
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
457
|
+
export enum ContextErrorCodes {
|
|
458
|
+
FILE_TYPE_NOT_SUPPORTED = 0
|
|
459
|
+
}
|
|
460
|
+
export type ContextError = {
|
|
461
|
+
error: {
|
|
462
|
+
code: ContextErrorCodes;
|
|
463
|
+
message: string;
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
export type ExistingValues = {
|
|
467
|
+
[key: string]: {
|
|
468
|
+
value: string | null;
|
|
469
|
+
startOffset: number;
|
|
470
|
+
endOffset: number | null;
|
|
471
|
+
indent: number;
|
|
472
|
+
type?: 'scalar' | 'map' | 'sequence';
|
|
473
|
+
rawValue?: string;
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
export type ContextData = {
|
|
477
|
+
nodePath: (string | number)[];
|
|
478
|
+
endPath: string | null;
|
|
479
|
+
type: NormalizedNodeType | null;
|
|
480
|
+
existingValues: ExistingValues;
|
|
481
|
+
types: NormalizedNodeType | null;
|
|
482
|
+
};
|
|
483
|
+
type OpenApiVersion<T> = {
|
|
484
|
+
version: T;
|
|
485
|
+
isDefault: boolean;
|
|
486
|
+
};
|
|
487
|
+
type NodePath = (string | number)[];
|
|
488
|
+
type NodeWithPath = {
|
|
489
|
+
node: yamlAst.YAMLNode | null;
|
|
490
|
+
nodePath: NodePath;
|
|
491
|
+
};
|
|
492
|
+
type TextDocumentWithLineOffset = TextDocument & {
|
|
493
|
+
_lineOffsets: number[];
|
|
494
|
+
};
|
|
495
|
+
export { OpenApiVersion, NodeWithPath, NodePath, TextDocumentWithLineOffset };
|
|
496
|
+
|
|
497
|
+
}
|
|
498
|
+
declare module '@redocly/openapi-language-server/server/utils' {
|
|
499
|
+
import { YAMLNode } from '@redocly/yaml-language-server-parser';
|
|
500
|
+
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
501
|
+
type Func<T> = (textDocument: TextDocument) => T | Promise<T>;
|
|
502
|
+
export function debounceDocument<T>(func: Func<T>, wait?: number, immediate?: boolean): Func<Promise<T>>;
|
|
503
|
+
export function removeCirculars(object: any): any;
|
|
504
|
+
export function isRefField(field: string): boolean;
|
|
505
|
+
export function isString<T>(value: T): boolean;
|
|
506
|
+
export function isFunction<T>(f: T): boolean;
|
|
507
|
+
export function isPromise<T>(value: T): boolean;
|
|
508
|
+
export function isYamlMap(node: YAMLNode | null): boolean;
|
|
509
|
+
export function isYamlMapping(node: YAMLNode | null): boolean;
|
|
510
|
+
export function isYamlSequence(node: YAMLNode | null): boolean;
|
|
511
|
+
export function surroundByNodeQuotes(valueToSurround: string, options: Record<string, any> & {
|
|
512
|
+
singleQuoted?: boolean;
|
|
513
|
+
}): string;
|
|
514
|
+
export {};
|
|
515
|
+
|
|
516
|
+
}
|
|
517
|
+
declare module '@redocly/openapi-language-server/server/validation/index' {
|
|
518
|
+
import { NormalizedProblem } from '@redocly/openapi-core';
|
|
519
|
+
import { PublishDiagnosticsParams } from 'vscode-languageserver/browser';
|
|
520
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
521
|
+
export const validateOpenAPI: (textDocument: TextDocument) => Promise<PublishDiagnosticsParams[]> | Promise<Promise<PublishDiagnosticsParams[]>>;
|
|
522
|
+
export function revalidateAllDocuments(): (Promise<PublishDiagnosticsParams[]> | Promise<Promise<PublishDiagnosticsParams[]>>)[];
|
|
523
|
+
export function handleUnexpectedError(fileURI: string, error: any, diagnosticsParams?: PublishDiagnosticsParams[]): PublishDiagnosticsParams[];
|
|
524
|
+
export function getValidationErrorsForBundle(problems: NormalizedProblem[]): NormalizedProblem[];
|
|
525
|
+
|
|
526
|
+
}
|
|
527
|
+
declare module '@redocly/openapi-language-server' {
|
|
528
|
+
import main = require('@redocly/openapi-language-server/index');
|
|
529
|
+
export = main;
|
|
530
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/openapi-language-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Redocly OpenAPI language server",
|
|
5
5
|
"module": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "npm run clean && node esbuild.cjs",
|
|
9
9
|
"compile": "npm run clean && tsc -p tsconfig.json",
|
|
10
|
-
"build:types": "tsc --emitDeclarationOnly --declaration --project tsconfig.json",
|
|
11
10
|
"deploy": "npm publish",
|
|
12
11
|
"clean": "rm -rf lib",
|
|
13
12
|
"prettier-base": "prettier \"**/*.{json,js,jsx,ts,tsx,yml,yaml,html,md}\"",
|
|
@@ -15,8 +14,7 @@
|
|
|
15
14
|
"prettier:check": "npm run prettier-base -- --check",
|
|
16
15
|
"ts:check": "tsc --noEmit --skipLibCheck",
|
|
17
16
|
"lint": "eslint . --ext .jsx,.ts,.tsx --cache",
|
|
18
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
|
-
"postbuild": "npm run build:types"
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
20
18
|
},
|
|
21
19
|
"author": "Redocly LLC <team@redocly.com>",
|
|
22
20
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -28,6 +26,7 @@
|
|
|
28
26
|
"@typescript-eslint/parser": "^5.33.1",
|
|
29
27
|
"esbuild": "^0.15.0",
|
|
30
28
|
"eslint": "^8.21.0",
|
|
29
|
+
"npm-dts": "^1.3.12",
|
|
31
30
|
"path-browserify": "^1.0.1",
|
|
32
31
|
"prettier": "2.7.1",
|
|
33
32
|
"typescript": "^4.7.4"
|
package/lib/config.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { TextDocuments } from 'vscode-languageserver/browser';
|
|
2
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
import { URI } from 'vscode-uri';
|
|
4
|
-
export interface SupportedLanguage {
|
|
5
|
-
languageId: string;
|
|
6
|
-
filePattern: RegExp;
|
|
7
|
-
}
|
|
8
|
-
export declare const yamlLanguage: SupportedLanguage;
|
|
9
|
-
export declare const jsonLanguage: SupportedLanguage;
|
|
10
|
-
export interface FileSystemProvider {
|
|
11
|
-
readFile(uri: URI, encoding?: string): Promise<string>;
|
|
12
|
-
readDir(uri: URI): Promise<any>;
|
|
13
|
-
stat(uri: URI): Promise<{
|
|
14
|
-
isFile(): boolean;
|
|
15
|
-
isDirectory(): boolean;
|
|
16
|
-
}>;
|
|
17
|
-
exists(uri: URI): Promise<boolean>;
|
|
18
|
-
}
|
|
19
|
-
export declare class Configuration {
|
|
20
|
-
private _fs;
|
|
21
|
-
private _documentManager;
|
|
22
|
-
supportedLanguages: SupportedLanguage[];
|
|
23
|
-
registerFileSystemProvider(fsProvider: FileSystemProvider): void;
|
|
24
|
-
registerDocumentsProvider(documentProvider: TextDocuments<TextDocument>): void;
|
|
25
|
-
get fs(): FileSystemProvider;
|
|
26
|
-
get documents(): TextDocuments<TextDocument>;
|
|
27
|
-
}
|
|
28
|
-
export declare const config: Configuration;
|
package/lib/server/bundle.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { NormalizedProblem } from '@redocly/openapi-core';
|
|
2
|
-
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
4
|
-
export declare type DefinitionData = {
|
|
5
|
-
name: string;
|
|
6
|
-
uri: string;
|
|
7
|
-
};
|
|
8
|
-
export declare type BundleData = DefinitionData & {
|
|
9
|
-
definition: Record<string, any>;
|
|
10
|
-
rootType: NormalizedNodeType;
|
|
11
|
-
refTypes: [string, NormalizedNodeType][];
|
|
12
|
-
htmlTempalteStyles?: string | null;
|
|
13
|
-
errors?: NormalizedProblem[];
|
|
14
|
-
};
|
|
15
|
-
export declare function bundleOpenAPI(textDocument: TextDocument, errors: NormalizedProblem[]): Promise<void>;
|
|
16
|
-
export declare function getBundle(path: string): any;
|
|
17
|
-
export declare function getBundles(): BundleData[];
|
|
18
|
-
export declare function getRefTypes(path: string): NormalizedNodeType | undefined | null;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { CompletionItem, CompletionItemKind, InsertTextFormat, Command } from 'vscode-languageserver/browser';
|
|
2
|
-
import type { CompletionItemOptions } from '../../types/completion';
|
|
3
|
-
export interface KeyCompletionOptions extends CompletionItemOptions {
|
|
4
|
-
insertTextFormat?: InsertTextFormat;
|
|
5
|
-
data?: any;
|
|
6
|
-
}
|
|
7
|
-
export declare class KeyCompletion implements CompletionItem {
|
|
8
|
-
kind: CompletionItemKind;
|
|
9
|
-
label: string;
|
|
10
|
-
insertText: string;
|
|
11
|
-
filterText: string;
|
|
12
|
-
sortText?: string;
|
|
13
|
-
command?: Command;
|
|
14
|
-
insertTextFormat: InsertTextFormat;
|
|
15
|
-
data?: any;
|
|
16
|
-
constructor({ kind, label, insertText, insertTextFormat, filterText, sortText, data, }: KeyCompletionOptions);
|
|
17
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Command } from 'vscode-languageserver/browser';
|
|
2
|
-
import { ValueCompletion, ValueCompletionOptions } from './ValueCompletion';
|
|
3
|
-
export declare class LocalFolderCompletion extends ValueCompletion {
|
|
4
|
-
command: Command;
|
|
5
|
-
constructor(completionOptions: ValueCompletionOptions);
|
|
6
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { YAMLScalar } from '@redocly/yaml-language-server-parser';
|
|
2
|
-
import { CompletionItem, CompletionItemKind, TextEdit, InsertReplaceEdit, Position, Command } from 'vscode-languageserver/browser';
|
|
3
|
-
import type { CompletionItemOptions } from '../../types/completion';
|
|
4
|
-
export interface ValueCompletionDataOptions {
|
|
5
|
-
position?: Position;
|
|
6
|
-
node?: YAMLScalar;
|
|
7
|
-
lineOffset?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface ValueCompletionOptions extends CompletionItemOptions {
|
|
10
|
-
value?: string;
|
|
11
|
-
data: ValueCompletionDataOptions;
|
|
12
|
-
}
|
|
13
|
-
export declare class ValueCompletion implements CompletionItem {
|
|
14
|
-
kind: CompletionItemKind;
|
|
15
|
-
label: string;
|
|
16
|
-
insertText: string;
|
|
17
|
-
filterText: string;
|
|
18
|
-
sortText?: string;
|
|
19
|
-
command?: Command;
|
|
20
|
-
textEdit?: TextEdit | InsertReplaceEdit;
|
|
21
|
-
constructor({ kind, label, value, textEdit, filterText, sortText, data, }: ValueCompletionOptions);
|
|
22
|
-
getTextEdit(node: YAMLScalar, position: Position, lineOffset: number): TextEdit | InsertReplaceEdit;
|
|
23
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import * as yamlAst from '@redocly/yaml-language-server-parser';
|
|
2
|
-
import { CompletionItem, Position } from 'vscode-languageserver/browser';
|
|
3
|
-
import { DocumentUri } from 'vscode-languageserver-textdocument';
|
|
4
|
-
import { ValueCompletion } from './ValueCompletion';
|
|
5
|
-
import { YamlCompletionContext } from './context';
|
|
6
|
-
export declare function getCompletionKeys(completionContext: YamlCompletionContext): CompletionItem[];
|
|
7
|
-
export declare function getCompletionValues(uri: DocumentUri, completionContext: YamlCompletionContext<yamlAst.YAMLScalar>): Promise<ValueCompletion[]>;
|
|
8
|
-
export declare function getCompletion(uri: DocumentUri, position: Position): Promise<CompletionItem[]>;
|
|
9
|
-
export declare function resolveCompletion(item: CompletionItem): CompletionItem;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { DocumentUri, Position } from 'vscode-languageserver-textdocument';
|
|
2
|
-
import { YAMLNode } from '@redocly/yaml-language-server-parser';
|
|
3
|
-
import { URI } from 'vscode-uri';
|
|
4
|
-
import { NodePath } from '../../types/context-core';
|
|
5
|
-
import { ExtendedNormalizedNodeType } from '../../types/completion';
|
|
6
|
-
export interface YamlCompletionContext<NodeType = YAMLNode> {
|
|
7
|
-
currentAst: YAMLNode;
|
|
8
|
-
node: NodeType;
|
|
9
|
-
nodePath: NodePath;
|
|
10
|
-
position: Position;
|
|
11
|
-
lineText: string;
|
|
12
|
-
lineOffset: number;
|
|
13
|
-
openApiType: ExtendedNormalizedNodeType | null;
|
|
14
|
-
}
|
|
15
|
-
export interface RefPathResolverContext {
|
|
16
|
-
docAbsolutePath: URI;
|
|
17
|
-
docAbsoluteDirPath: URI;
|
|
18
|
-
refPath: string;
|
|
19
|
-
refDirPath: URI;
|
|
20
|
-
refDirAbsolutePath: URI;
|
|
21
|
-
isAbsolutePath: boolean;
|
|
22
|
-
root: string;
|
|
23
|
-
}
|
|
24
|
-
export declare function createCompletionContext<NodeType = YAMLNode>(uri: DocumentUri, position: Position): Promise<YamlCompletionContext<NodeType>>;
|
|
25
|
-
export declare function createRefPathResolverContext(uri: DocumentUri, refPath: string): Promise<RefPathResolverContext>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
2
|
-
export declare type PartialNodeType = {
|
|
3
|
-
items?: NormalizedNodeType['items'];
|
|
4
|
-
required?: NormalizedNodeType['required'];
|
|
5
|
-
};
|
|
6
|
-
declare function getKeyValue(key: string, type?: PartialNodeType): string;
|
|
7
|
-
declare function getBeforeKeyValue(key: string, value: string, beforeKey: string, type?: PartialNodeType): string;
|
|
8
|
-
declare function getAfterKeyValue(key: string): "" | ": ";
|
|
9
|
-
declare function getBeforeKey(lineText?: string): "" | " " | "\n ";
|
|
10
|
-
declare function getAfterValue(beforeKey: string, properties?: NormalizedNodeType['properties']): "" | "\n " | "\n ";
|
|
11
|
-
declare function getInsertSnippet(key: string, data?: {
|
|
12
|
-
properties?: NormalizedNodeType['properties'];
|
|
13
|
-
lineText: string;
|
|
14
|
-
} & PartialNodeType, addNewLine?: boolean): string;
|
|
15
|
-
export { getInsertSnippet, getAfterKeyValue, getAfterValue, getKeyValue, getBeforeKey, getBeforeKeyValue, };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DocumentUri } from 'vscode-languageserver-textdocument';
|
|
2
|
-
import { YAMLScalar } from '@redocly/yaml-language-server-parser';
|
|
3
|
-
import { SupportedLanguage } from '../../../config';
|
|
4
|
-
import { LocalFolderCompletion } from './LocalFolderCompletion';
|
|
5
|
-
import { LocalFileCompletion } from './LocalFileCompletion';
|
|
6
|
-
import { YamlCompletionContext, RefPathResolverContext } from './context';
|
|
7
|
-
export declare const LOCAL_FILES_SUPPORTED_SUGGESTIONS: SupportedLanguage[];
|
|
8
|
-
export declare enum FsNodeType {
|
|
9
|
-
File = 0,
|
|
10
|
-
Folder = 1
|
|
11
|
-
}
|
|
12
|
-
export interface RefFileStat {
|
|
13
|
-
type: FsNodeType;
|
|
14
|
-
name: string;
|
|
15
|
-
}
|
|
16
|
-
export interface RefPathOption extends RefFileStat {
|
|
17
|
-
value: string;
|
|
18
|
-
matchBy: string;
|
|
19
|
-
sortBy: string;
|
|
20
|
-
}
|
|
21
|
-
export declare function getToTopOption(pathResolverContext: RefPathResolverContext): RefPathOption;
|
|
22
|
-
export declare function getChildrenOfPath(files: string[], config: {
|
|
23
|
-
supportedFiles: SupportedLanguage[];
|
|
24
|
-
}, pathResolverContext: RefPathResolverContext): Promise<RefFileStat[]>;
|
|
25
|
-
export declare function getRefPathOptions(fileStats: RefFileStat[], pathResolverContext: RefPathResolverContext): RefPathOption[];
|
|
26
|
-
export declare function getLocalFsRefs(uri: DocumentUri, completionContext: YamlCompletionContext<YAMLScalar>): Promise<(LocalFolderCompletion | LocalFileCompletion)[]>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { OasVersion, OasMajorVersion } from '@redocly/openapi-core';
|
|
2
|
-
import * as yamlAst from '@redocly/yaml-language-server-parser';
|
|
3
|
-
import type { Position } from 'vscode-languageserver/browser';
|
|
4
|
-
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
5
|
-
import type { ContextData, ExistingValues } from './types/context-core';
|
|
6
|
-
import type { OpenApiVersion, TextDocumentWithLineOffset, NodeWithPath, NodePath } from './types/context-core';
|
|
7
|
-
export declare function getContextData(uri: string, position: Position): Promise<ContextData>;
|
|
8
|
-
export declare function getAstNodeByPath(currentAst: yamlAst.YAMLNode | null, path: (number | string)[]): yamlAst.YAMLNode | null;
|
|
9
|
-
export declare function getAstNodeByPosition(start: NodeWithPath, position: Position, document: TextDocumentWithLineOffset, isContextData?: boolean): NodeWithPath;
|
|
10
|
-
export declare function getNodeLineIndent(node: yamlAst.YAMLNode | null | undefined, document: TextDocumentWithLineOffset): number;
|
|
11
|
-
export declare function getTypesByNodePath(types: any, nodePath: NodePath): {
|
|
12
|
-
currentType: NormalizedNodeType | null;
|
|
13
|
-
parentType: NormalizedNodeType | null;
|
|
14
|
-
endPath: string | null;
|
|
15
|
-
};
|
|
16
|
-
export declare function getRootTypes(ast: yamlAst.YAMLNode, uri: string): NormalizedNodeType | null;
|
|
17
|
-
export declare function getOASVersion(ast: yamlAst.YAMLNode): OpenApiVersion<OasVersion>;
|
|
18
|
-
export declare function getOASMajorVersion(ast: yamlAst.YAMLNode): OpenApiVersion<OasMajorVersion>;
|
|
19
|
-
export declare function getChildNodes(node?: yamlAst.YAMLNode | null): yamlAst.YAMLNode[];
|
|
20
|
-
export declare function getExistingValues(node: yamlAst.YAMLSequence, values?: ExistingValues, indent?: number): ExistingValues;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DocumentUri } from 'vscode-languageserver/browser';
|
|
2
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
export declare type DocumentStats = {
|
|
4
|
-
dependencyPaths: Set<string>;
|
|
5
|
-
durationMS: number;
|
|
6
|
-
};
|
|
7
|
-
export declare type DependencyStats = {
|
|
8
|
-
documentPath: string;
|
|
9
|
-
durationMS: number;
|
|
10
|
-
};
|
|
11
|
-
export declare function updateDependencyMap(path: string, stats: DocumentStats): Map<string, DocumentStats>;
|
|
12
|
-
export declare function getPathsByDependency(depPath: string): DependencyStats[];
|
|
13
|
-
export declare function getDocumentLanguageId(uri: DocumentUri): string;
|
|
14
|
-
export declare function getDocumentByURI(uri: DocumentUri): Promise<TextDocument>;
|
|
15
|
-
export declare function isJsonFile(uri: DocumentUri): boolean;
|
|
16
|
-
export declare function isYamlFile(uri: DocumentUri): boolean;
|
package/lib/server/hints.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CompletionItem } from 'vscode-languageserver/browser';
|
|
2
|
-
import { ExtendedNormalizedNodeType } from './types/completion';
|
|
3
|
-
export declare const START_SEQ_LABEL = "newItem";
|
|
4
|
-
export declare const START_MAP_LABEL = "propertyName";
|
|
5
|
-
export declare const ADD_NEW_LINE = "newLine";
|
|
6
|
-
export declare function hasHints(type: ExtendedNormalizedNodeType): boolean;
|
|
7
|
-
export declare function getAdditionalCompletionItem(name: string): CompletionItem[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Config as OpenAPIConfig } from '@redocly/openapi-core';
|
|
2
|
-
export { CONFIG_FILE_NAMES } from '@redocly/openapi-core';
|
|
3
|
-
export declare function isConfigFile(uri: string): boolean;
|
|
4
|
-
export declare function getOpenAPIConfig({ cache }?: {
|
|
5
|
-
cache?: boolean;
|
|
6
|
-
}): Promise<OpenAPIConfig>;
|
|
7
|
-
export declare function updateOpenApiConfig(): Promise<OpenAPIConfig>;
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { ExtendedNormalizedNodeType } from './types/completion';
|
|
2
|
-
import { mapTypeToComponent } from '@redocly/openapi-core';
|
|
3
|
-
declare const typeExtensions: {
|
|
4
|
-
Schema: {
|
|
5
|
-
name: string;
|
|
6
|
-
value: {
|
|
7
|
-
type: string;
|
|
8
|
-
name: string;
|
|
9
|
-
};
|
|
10
|
-
}[];
|
|
11
|
-
PathItem: {
|
|
12
|
-
name: string;
|
|
13
|
-
value: {
|
|
14
|
-
type: string;
|
|
15
|
-
name: string;
|
|
16
|
-
};
|
|
17
|
-
}[];
|
|
18
|
-
Parameter: {
|
|
19
|
-
name: string;
|
|
20
|
-
value: {
|
|
21
|
-
type: string;
|
|
22
|
-
name: string;
|
|
23
|
-
};
|
|
24
|
-
}[];
|
|
25
|
-
Response: {
|
|
26
|
-
name: string;
|
|
27
|
-
value: {
|
|
28
|
-
type: string;
|
|
29
|
-
name: string;
|
|
30
|
-
};
|
|
31
|
-
}[];
|
|
32
|
-
Example: {
|
|
33
|
-
name: string;
|
|
34
|
-
value: {
|
|
35
|
-
type: string;
|
|
36
|
-
name: string;
|
|
37
|
-
};
|
|
38
|
-
}[];
|
|
39
|
-
RequestBody: {
|
|
40
|
-
name: string;
|
|
41
|
-
value: {
|
|
42
|
-
type: string;
|
|
43
|
-
name: string;
|
|
44
|
-
};
|
|
45
|
-
}[];
|
|
46
|
-
Header: {
|
|
47
|
-
name: string;
|
|
48
|
-
value: {
|
|
49
|
-
type: string;
|
|
50
|
-
name: string;
|
|
51
|
-
};
|
|
52
|
-
}[];
|
|
53
|
-
SecuritySchema: {
|
|
54
|
-
name: string;
|
|
55
|
-
value: {
|
|
56
|
-
type: string;
|
|
57
|
-
name: string;
|
|
58
|
-
};
|
|
59
|
-
}[];
|
|
60
|
-
Link: {
|
|
61
|
-
name: string;
|
|
62
|
-
value: {
|
|
63
|
-
type: string;
|
|
64
|
-
name: string;
|
|
65
|
-
};
|
|
66
|
-
}[];
|
|
67
|
-
Callback: {
|
|
68
|
-
name: string;
|
|
69
|
-
value: {
|
|
70
|
-
type: string;
|
|
71
|
-
name: string;
|
|
72
|
-
};
|
|
73
|
-
}[];
|
|
74
|
-
};
|
|
75
|
-
declare function extendOASType(type: ExtendedNormalizedNodeType): ExtendedNormalizedNodeType;
|
|
76
|
-
export { typeExtensions, extendOASType, mapTypeToComponent };
|
package/lib/server/path.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { DocumentUri } from 'vscode-languageserver/browser';
|
|
2
|
-
import { URI } from 'vscode-uri';
|
|
3
|
-
export declare function parseUri(path: string): URI;
|
|
4
|
-
export declare function isHttpPath(path: string): boolean;
|
|
5
|
-
export declare function uriBaseName(uri: DocumentUri): string;
|
|
6
|
-
export declare function getFileExtension(uri: DocumentUri): string;
|
|
7
|
-
export declare function noTrailingSlash(path: string): string;
|
|
8
|
-
export declare function getClosestExistingDir(uri: URI, baseDir?: string): Promise<URI>;
|
package/lib/server/sort.d.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export declare function getSortText(typeName: string | null, label?: string): string;
|
|
2
|
-
export declare enum SortTypes {
|
|
3
|
-
FileCompletion = "FileCompletion",
|
|
4
|
-
FolderCompletion = "FolderCompletion",
|
|
5
|
-
LocalComponentCompletion = "LocalComponentCompletion",
|
|
6
|
-
NewLine = "newLine",
|
|
7
|
-
PropertyName = "propertyName",
|
|
8
|
-
NewItem = "newItem",
|
|
9
|
-
PathMap = "PathMap",
|
|
10
|
-
MediaTypeMap = "MediaTypeMap",
|
|
11
|
-
DefinitionRoot = "DefinitionRoot",
|
|
12
|
-
DefinitionRootOpenapi = "DefinitionRoot_openapi",
|
|
13
|
-
DefinitionRootInfo = "DefinitionRoot_info",
|
|
14
|
-
DefinitionRootJsonSchemaDialect = "DefinitionRoot_jsonSchemaDialect",
|
|
15
|
-
DefinitionRootServers = "DefinitionRoot_servers",
|
|
16
|
-
DefinitionRootPaths = "DefinitionRoot_paths",
|
|
17
|
-
DefinitionRootWebhooks = "DefinitionRoot_webhooks",
|
|
18
|
-
DefinitionRootComponents = "DefinitionRoot_components",
|
|
19
|
-
DefinitionRootSecurity = "DefinitionRoot_security",
|
|
20
|
-
DefinitionRootTags = "DefinitionRoot_tags",
|
|
21
|
-
DefinitionRootExternalDocs = "DefinitionRoot_externalDocs",
|
|
22
|
-
Info = "Info",
|
|
23
|
-
InfoTitle = "Info_title",
|
|
24
|
-
InfoSummary = "Info_summary",
|
|
25
|
-
InfoDescription = "Info_description",
|
|
26
|
-
InfoTermsOfService = "Info_termsOfService",
|
|
27
|
-
InfoContact = "Info_contact",
|
|
28
|
-
ContactName = "Contact_name",
|
|
29
|
-
ContactUrl = "Contact_url",
|
|
30
|
-
ContactEmail = "Contact_email",
|
|
31
|
-
InfoLicense = "Info_license",
|
|
32
|
-
LicenseName = "License_name",
|
|
33
|
-
LicenseIdentifier = "License_identifier",
|
|
34
|
-
LicenseUrl = "License_url",
|
|
35
|
-
InfoVersion = "Info_version",
|
|
36
|
-
jsonSchemaDialect = "jsonSchemaDialect",
|
|
37
|
-
ServerList = "Server_List",
|
|
38
|
-
ServerUrl = "Server_url",
|
|
39
|
-
ServerDescription = "Server_description",
|
|
40
|
-
ServerVariables = "Server_variables",
|
|
41
|
-
Default = "Default"
|
|
42
|
-
}
|
|
43
|
-
export declare const sortLabelObject: Record<SortTypes, string>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
2
|
-
import { CompletionItemKind, TextEdit, InsertReplaceEdit } from 'vscode-languageserver/browser';
|
|
3
|
-
declare type ExtendedNormalizedNodeType = NormalizedNodeType & {
|
|
4
|
-
isExample?: true;
|
|
5
|
-
enum?: string[];
|
|
6
|
-
type?: string;
|
|
7
|
-
};
|
|
8
|
-
interface CompletionItemOptions {
|
|
9
|
-
label: string;
|
|
10
|
-
kind?: CompletionItemKind;
|
|
11
|
-
sortText?: string;
|
|
12
|
-
textEdit?: TextEdit | InsertReplaceEdit;
|
|
13
|
-
insertText?: string;
|
|
14
|
-
filterText?: string;
|
|
15
|
-
}
|
|
16
|
-
export type { ExtendedNormalizedNodeType, CompletionItemOptions };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import yamlAst from '@redocly/yaml-language-server-parser';
|
|
2
|
-
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
import type { NormalizedNodeType } from '@redocly/openapi-core/lib/types';
|
|
4
|
-
export declare enum ContextErrorCodes {
|
|
5
|
-
FILE_TYPE_NOT_SUPPORTED = 0
|
|
6
|
-
}
|
|
7
|
-
export declare type ContextError = {
|
|
8
|
-
error: {
|
|
9
|
-
code: ContextErrorCodes;
|
|
10
|
-
message: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export declare type ExistingValues = {
|
|
14
|
-
[key: string]: {
|
|
15
|
-
value: string | null;
|
|
16
|
-
startOffset: number;
|
|
17
|
-
endOffset: number | null;
|
|
18
|
-
indent: number;
|
|
19
|
-
type?: 'scalar' | 'map' | 'sequence';
|
|
20
|
-
rawValue?: string;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
export declare type ContextData = {
|
|
24
|
-
nodePath: (string | number)[];
|
|
25
|
-
endPath: string | null;
|
|
26
|
-
type: NormalizedNodeType | null;
|
|
27
|
-
existingValues: ExistingValues;
|
|
28
|
-
types: NormalizedNodeType | null;
|
|
29
|
-
};
|
|
30
|
-
declare type OpenApiVersion<T> = {
|
|
31
|
-
version: T;
|
|
32
|
-
isDefault: boolean;
|
|
33
|
-
};
|
|
34
|
-
declare type NodePath = (string | number)[];
|
|
35
|
-
declare type NodeWithPath = {
|
|
36
|
-
node: yamlAst.YAMLNode | null;
|
|
37
|
-
nodePath: NodePath;
|
|
38
|
-
};
|
|
39
|
-
declare type TextDocumentWithLineOffset = TextDocument & {
|
|
40
|
-
_lineOffsets: number[];
|
|
41
|
-
};
|
|
42
|
-
export { OpenApiVersion, NodeWithPath, NodePath, TextDocumentWithLineOffset };
|
package/lib/server/utils.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { YAMLNode } from '@redocly/yaml-language-server-parser';
|
|
2
|
-
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
declare type Func<T> = (textDocument: TextDocument) => T | Promise<T>;
|
|
4
|
-
export declare function debounceDocument<T>(func: Func<T>, wait?: number, immediate?: boolean): Func<Promise<T>>;
|
|
5
|
-
export declare function removeCirculars(object: any): any;
|
|
6
|
-
export declare function isRefField(field: string): boolean;
|
|
7
|
-
export declare function isString<T>(value: T): boolean;
|
|
8
|
-
export declare function isFunction<T>(f: T): boolean;
|
|
9
|
-
export declare function isPromise<T>(value: T): boolean;
|
|
10
|
-
export declare function isYamlMap(node: YAMLNode | null): boolean;
|
|
11
|
-
export declare function isYamlMapping(node: YAMLNode | null): boolean;
|
|
12
|
-
export declare function isYamlSequence(node: YAMLNode | null): boolean;
|
|
13
|
-
export declare function surroundByNodeQuotes(valueToSurround: string, options: Record<string, any> & {
|
|
14
|
-
singleQuoted?: boolean;
|
|
15
|
-
}): string;
|
|
16
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NormalizedProblem } from '@redocly/openapi-core';
|
|
2
|
-
import { PublishDiagnosticsParams } from 'vscode-languageserver/browser';
|
|
3
|
-
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
-
export declare const validateOpenAPI: (textDocument: TextDocument) => Promise<PublishDiagnosticsParams[]> | Promise<Promise<PublishDiagnosticsParams[]>>;
|
|
5
|
-
export declare function revalidateAllDocuments(): (Promise<PublishDiagnosticsParams[]> | Promise<Promise<PublishDiagnosticsParams[]>>)[];
|
|
6
|
-
export declare function handleUnexpectedError(fileURI: string, error: any, diagnosticsParams?: PublishDiagnosticsParams[]): PublishDiagnosticsParams[];
|
|
7
|
-
export declare function getValidationErrorsForBundle(problems: NormalizedProblem[]): NormalizedProblem[];
|