decthings

Language API


Remotely run language servers to fetch code intellisense information from the model filesystem.

Events

This API has 2 events that can be subscribed to.

To receive events, call the the 'client.language.on' function on the API client. This will register a callback to fire when the Decthings server sends events to the client. In order for Decthings to send events, you must be subscribed to each language server. When you start a language server using startLanguageServer, you will atomatically be subscribed to events for that language server.

/**
 * Event emitted when a language server exits.
 */
on(event: 'exit', handler: (params: {
    languageServerId: string,
    reason: 'timedout' | 'oom' | 'unknown'
}) => void): this

/**
 * Event emitted when data is received from a language server.
 */
on(event: 'data', handler: (params: {
    languageServerId: string,
    data: Buffer
}) => void): this

Subscribe to events example

let client = new DecthingsClient({ apiKey: "<myapikey>" })

async function main() {
    // First, subscribe to events so that Decthings will actually send us any
    await client.language.startLanguageServer({ modelId: '<modelid>', language: 'python' })

    // Next, attach a listener which will be called when Decthings sends us events
    client.language.on('exit', ({ languageServerId, reason }) => {
        // This function will run when an event is received
        console.log(languageServerId)
        console.log(reason)
    })
}
main()

Product

  • Documentation
  • Pricing
  • API reference
  • Guides

Company

  • Support

Get going!

Sign up
  • Terms and conditions
  • Privacy policy
  • Cookie policy
  • GitHub
  • LinkedIn

This website uses cookies to enhance the experience.

Learn more