Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function createLanguageClient(connection: MessageConnection): MonacoLanguageClient {
return new MonacoLanguageClient({
name: 'LG Language Client',
clientOptions: {
// use a language id as a document selector
documentSelector: ['botbuilderlg'],
// disable the default error handler
errorHandler: {
error: () => ErrorAction.Continue,
closed: () => CloseAction.DoNotRestart,
},
},
// create a language client connection from the JSON RPC connection on demand
connectionProvider: {
get: (errorHandler, closeHandler) => {
return Promise.resolve(createConnection(connection, errorHandler, closeHandler));
},
},
function createLanguageClient(connection: MessageConnection): MonacoLanguageClient {
return new MonacoLanguageClient({
name: "Sample Language Client",
clientOptions: {
// use a language id as a document selector
documentSelector: ['json'],
// disable the default error handler
errorHandler: {
error: () => ErrorAction.Continue,
closed: () => CloseAction.DoNotRestart
}
},
// create a language client connection from the JSON RPC connection on demand
connectionProvider: {
get: (errorHandler, closeHandler) => {
return Promise.resolve(createConnection(connection, errorHandler, closeHandler))
}
}
function createLanguageClient(connection: MessageConnection): MonacoLanguageClient {
return new MonacoLanguageClient({
name: "TypeScript Language Client",
clientOptions: {
// use a language id as a document selector
documentSelector: ['typescript'],
// disable the default error handler
errorHandler: {
error: () => ErrorAction.Continue,
closed: () => CloseAction.DoNotRestart
}
},
// create a language client connection from the JSON RPC connection on demand
connectionProvider: {
get: (errorHandler, closeHandler) => {
return Promise.resolve(createConnection(connection, errorHandler, closeHandler))
}
}
function createLanguageClient(connection: MessageConnection): MonacoLanguageClient {
return new MonacoLanguageClient({
name: 'LU Language Client',
clientOptions: {
// use a language id as a document selector
documentSelector: ['bflu'],
// disable the default error handler
errorHandler: {
error: () => ErrorAction.Continue,
closed: () => CloseAction.DoNotRestart,
},
//middleware
},
// create a language client connection from the JSON RPC connection on demand
connectionProvider: {
get: (errorHandler, closeHandler) => {
return Promise.resolve(createConnection(connection, errorHandler, closeHandler));
},
})
},
listen(dataCallback: DataCallback) {
callbacks.toClient = (message: Message) => dataCallback(message)
},
dispose() {
if (!callbacks.onClientClose) {
return
}
callbacks.onClientClose()
}
}
const messageConnection = createMessageConnection(reader, writer, logger)
return new MonacoLanguageClient({
name: "Cadence Language Client",
clientOptions: {
documentSelector: ['cadence'],
errorHandler: {
error: () => ErrorAction.Continue,
closed: () => CloseAction.DoNotRestart
}
},
// Create a language client connection from the JSON-RPC connection on demand
connectionProvider: {
get: (errorHandler, closeHandler) => {
return Promise.resolve(createConnection(messageConnection, errorHandler, closeHandler))
}
}
});
}
export function createLanguageClient (services, connection) {
const currentDocumentSelector = documentSelectors.find(v => v.lang === config.mainLanguage)
const initializationOption = initializationOptions[config.mainLanguage]
return new MonacoLanguageClient({
name: `[${config.mainLanguage}-langServer]`,
clientOptions: {
commands: undefined,
documentSelector: currentDocumentSelector.selectors,
synchronize: {
configurationSection: synchronize[config.mainLanguage]
},
initializationOptions: {
...initializationOption,
workspaceFolders: [`file://${config._ROOT_URI_}`]
},
initializationFailedHandler: (err) => {
const detail = err instanceof Error ? err.message : ''
},
diagnosticCollectionName: config.mainLanguage.toLowerCase()
},