in server/aws-lsp-buildspec/src/language-server/yamlSchemaServer.ts [91:154]
registerHandlers() {
this.documents.onDidOpen(({ document }) => {
if (this.yamlService.isSupported(document) === false) {
return
}
this.validateDocument(document.uri)
})
this.documents.onDidChangeContent(({ document }) => {
if (this.yamlService.isSupported(document) === false) {
return
}
this.validateDocument(document.uri)
})
this.connection.onCompletion(async ({ textDocument: requestedDocument, position }) => {
try {
this.connection.console.info('AWS Yaml completion')
const textDocument = this.getTextDocument(requestedDocument.uri)
if (this.yamlService.isSupported(textDocument) === false) {
return
}
const results = await this.yamlService.doComplete(textDocument, position)
// this.connection.console.info(JSON.stringify(results.items, null, 4))
if (results!!) {
completionItemUtils.prependItemDetail(results.items, this.props.displayName)
}
return results
} catch (error) {
this.connection.console.info(`AWS Yaml completion error: ${error} `)
}
})
this.connection.onHover(async ({ textDocument: requestedDocument, position }) => {
const textDocument = this.getTextDocument(requestedDocument.uri)
if (this.yamlService.isSupported(textDocument) === false) {
return
}
return await this.yamlService.doHover(textDocument, position)
})
this.connection.onDocumentFormatting(({ textDocument: requestedDocument, options }) => {
const textDocument = this.getTextDocument(requestedDocument.uri)
if (this.yamlService.isSupported(textDocument) === false) {
return
}
return this.yamlService.format(textDocument, textDocumentUtils.getFullRange(textDocument), options)
})
// this.connection.onCompletionResolve(item => {
// this.connection.console.info(JSON.stringify(item, null, 4))
// return item
// })
}