diff --git a/src/languageserver/handlers/languageHandlers.ts b/src/languageserver/handlers/languageHandlers.ts index 7820f06e..df7005b9 100644 --- a/src/languageserver/handlers/languageHandlers.ts +++ b/src/languageserver/handlers/languageHandlers.ts @@ -229,7 +229,7 @@ export class LanguageHandlers { return this.languageService.getCodeAction(textDocument, params); } - codeLensHandler(params: CodeLensParams): Thenable | CodeLens[] | undefined { + codeLensHandler(params: CodeLensParams): PromiseLike | CodeLens[] | undefined { const textDocument = this.yamlSettings.documents.get(params.textDocument.uri); if (!textDocument) { return; @@ -237,7 +237,7 @@ export class LanguageHandlers { return this.languageService.getCodeLens(textDocument); } - codeLensResolveHandler(param: CodeLens): Thenable | CodeLens { + codeLensResolveHandler(param: CodeLens): PromiseLike | CodeLens { return this.languageService.resolveCodeLens(param); } diff --git a/src/languageservice/services/yamlCodeLens.ts b/src/languageservice/services/yamlCodeLens.ts index 7157ccf8..b1ae69d3 100644 --- a/src/languageservice/services/yamlCodeLens.ts +++ b/src/languageservice/services/yamlCodeLens.ts @@ -44,7 +44,7 @@ export class YamlCodeLens { return result; } - resolveCodeLens(param: CodeLens): Thenable | CodeLens { + resolveCodeLens(param: CodeLens): PromiseLike | CodeLens { return param; } } diff --git a/src/languageservice/services/yamlFormatter.ts b/src/languageservice/services/yamlFormatter.ts index 203cf749..5727877b 100644 --- a/src/languageservice/services/yamlFormatter.ts +++ b/src/languageservice/services/yamlFormatter.ts @@ -21,7 +21,7 @@ export class YAMLFormatter { } } - public format(document: TextDocument, options: FormattingOptions & CustomFormatterOptions): TextEdit[] { + public format(document: TextDocument, options: Partial & CustomFormatterOptions = {}): TextEdit[] { if (!this.formatterEnabled) { return []; } diff --git a/src/languageservice/yamlLanguageService.ts b/src/languageservice/yamlLanguageService.ts index 6fd1153d..539371d8 100644 --- a/src/languageservice/yamlLanguageService.ts +++ b/src/languageservice/yamlLanguageService.ts @@ -157,28 +157,28 @@ export interface CustomFormatterOptions { } export interface LanguageService { - configure(settings: LanguageSettings): void; - registerCustomSchemaProvider(schemaProvider: CustomSchemaProvider): void; - doComplete(document: TextDocument, position: Position, isKubernetes: boolean): Promise; - doValidation(document: TextDocument, isKubernetes: boolean): Promise; - doHover(document: TextDocument, position: Position): Promise; - findDocumentSymbols(document: TextDocument, context: DocumentSymbolsContext): SymbolInformation[]; - findDocumentSymbols2(document: TextDocument, context: DocumentSymbolsContext): DocumentSymbol[]; - findLinks(document: TextDocument): Promise; - resetSchema(uri: string): boolean; - doFormat(document: TextDocument, options: CustomFormatterOptions): TextEdit[]; - doDefinition(document: TextDocument, params: DefinitionParams): DefinitionLink[] | undefined; - doDocumentOnTypeFormatting(document: TextDocument, params: DocumentOnTypeFormattingParams): TextEdit[] | undefined; - addSchema(schemaID: string, schema: JSONSchema): void; - deleteSchema(schemaID: string): void; - modifySchemaContent(schemaAdditions: SchemaAdditions): void; - deleteSchemaContent(schemaDeletions: SchemaDeletions): void; - deleteSchemasWhole(schemaDeletions: SchemaDeletionsAll): void; - getFoldingRanges(document: TextDocument, context: FoldingRangesContext): FoldingRange[] | null; - getSelectionRanges(document: TextDocument, positions: Position[]): SelectionRange[] | undefined; - getCodeAction(document: TextDocument, params: CodeActionParams): CodeAction[] | undefined; - getCodeLens(document: TextDocument): Thenable | CodeLens[] | undefined; - resolveCodeLens(param: CodeLens): Thenable | CodeLens; + configure: (settings: LanguageSettings) => void; + registerCustomSchemaProvider: (schemaProvider: CustomSchemaProvider) => void; + doComplete: (document: TextDocument, position: Position, isKubernetes: boolean) => Promise; + doValidation: (document: TextDocument, isKubernetes: boolean) => Promise; + doHover: (document: TextDocument, position: Position) => Promise; + findDocumentSymbols: (document: TextDocument, context?: DocumentSymbolsContext) => SymbolInformation[]; + findDocumentSymbols2: (document: TextDocument, context?: DocumentSymbolsContext) => DocumentSymbol[]; + findLinks: (document: TextDocument) => Promise; + resetSchema: (uri: string) => boolean; + doFormat: (document: TextDocument, options?: CustomFormatterOptions) => TextEdit[]; + doDefinition: (document: TextDocument, params: DefinitionParams) => DefinitionLink[] | undefined; + doDocumentOnTypeFormatting: (document: TextDocument, params: DocumentOnTypeFormattingParams) => TextEdit[] | undefined; + addSchema: (schemaID: string, schema: JSONSchema) => void; + deleteSchema: (schemaID: string) => void; + modifySchemaContent: (schemaAdditions: SchemaAdditions) => void; + deleteSchemaContent: (schemaDeletions: SchemaDeletions) => void; + deleteSchemasWhole: (schemaDeletions: SchemaDeletionsAll) => void; + getFoldingRanges: (document: TextDocument, context: FoldingRangesContext) => FoldingRange[] | null; + getSelectionRanges: (document: TextDocument, positions: Position[]) => SelectionRange[] | undefined; + getCodeAction: (document: TextDocument, params: CodeActionParams) => CodeAction[] | undefined; + getCodeLens: (document: TextDocument) => PromiseLike | CodeLens[] | undefined; + resolveCodeLens: (param: CodeLens) => PromiseLike | CodeLens; } export function getLanguageService(params: { diff --git a/src/yamlSettings.ts b/src/yamlSettings.ts index 011b0b8b..fc026034 100644 --- a/src/yamlSettings.ts +++ b/src/yamlSettings.ts @@ -60,7 +60,7 @@ export interface JSONSchemaSettings { export class SettingsState { yamlConfigurationSettings: JSONSchemaSettings[] = undefined; schemaAssociations: ISchemaAssociations | SchemaConfiguration[] | undefined = undefined; - formatterRegistration: Thenable = null; + formatterRegistration: PromiseLike = null; specificValidatorPaths = []; schemaConfigurationSettings = []; yamlShouldValidate = true;