How to use the vscode-jsonrpc.RequestType3 function in vscode-jsonrpc

To help you get started, we’ve selected a few vscode-jsonrpc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yitzchak / dicy / packages / server / spec / Server_spec.ts View on Github external
it('calls setUserOptions when request is sent', async (done) => {
    const options: OptionsSource = { foo: 'bar' }

    await client.sendRequest(new rpc.RequestType3('setUserOptions'), file, options, true)

    expect(cache.setUserOptions).toHaveBeenCalledWith(file, options, true)

    done()
  })
github yitzchak / dicy / packages / server / spec / Server_spec.ts View on Github external
it('calls setInstanceOptions when request is sent', async (done) => {
    const options: OptionsSource = { foo: 'bar' }

    await client.sendRequest(new rpc.RequestType3('setInstanceOptions'), file, options, true)

    expect(cache.setInstanceOptions).toHaveBeenCalledWith(file, options, true)

    done()
  })
github yitzchak / dicy / packages / server / spec / Server_spec.ts View on Github external
it('calls setProjectOptions when request is sent', async (done) => {
    const options: OptionsSource = { foo: 'bar' }

    await client.sendRequest(new rpc.RequestType3('setProjectOptions'), file, options, true)

    expect(cache.setProjectOptions).toHaveBeenCalledWith(file, options, true)

    done()
  })
github yitzchak / dicy / packages / server / src / Server.ts View on Github external
import * as rpc from 'vscode-jsonrpc'

export default class Server {
  private cache: BuilderCacheInterface
  private connection: any

  private clearRequest = new rpc.RequestType1('clear')
  private clearAllRequest = new rpc.RequestType0('clearAll')
  private exitNotification = new rpc.NotificationType0('exit')
  private getTargetsRequest = new rpc.RequestType1('getTargets')
  private killRequest = new rpc.RequestType2('kill')
  private killAllRequest = new rpc.RequestType1('killAll')
  private logNotification = new rpc.NotificationType2('log')
  private runRequest = new rpc.RequestType2('run')
  private setDirectoryOptionsRequest = new rpc.RequestType3('setDirectoryOptions')
  private setInstanceOptionsRequest = new rpc.RequestType3('setInstanceOptions')
  private setProjectOptionsRequest = new rpc.RequestType3('setProjectOptions')
  private setUserOptionsRequest = new rpc.RequestType3('setUserOptions')

  constructor (transport: [rpc.MessageReader, rpc.MessageWriter], cache: BuilderCacheInterface) {
    this.cache = cache

    this.connection = rpc.createMessageConnection(transport[0], transport[1])

    this.connection.onRequest(this.clearRequest,
      (file: Uri): Promise => this.cache.clear(file))

    this.connection.onRequest(this.clearAllRequest,
      (): Promise => this.cache.clearAll())

    this.connection.onNotification(this.exitNotification,
      (): void => this.exit())
github yitzchak / dicy / packages / server / spec / Server_spec.ts View on Github external
it('calls setDirectoryOptions when request is sent', async (done) => {
    const options: OptionsSource = { foo: 'bar' }

    await client.sendRequest(new rpc.RequestType3('setDirectoryOptions'), file, options, true)

    expect(cache.setDirectoryOptions).toHaveBeenCalledWith(file, options, true)

    done()
  })
github yitzchak / dicy / packages / client / src / Client.ts View on Github external
/** @internal */
  private exitNotification = new rpc.NotificationType0('exit')
  /** @internal */
  private killRequest = new rpc.RequestType2('kill')
  /** @internal */
  private killAllRequest = new rpc.RequestType1('killAll')
  /** @internal */
  private logNotification = new rpc.NotificationType2('log')
  /** @internal */
  private runRequest = new rpc.RequestType2('run')
  /** @internal */
  private setDirectoryOptionsRequest = new rpc.RequestType3('setDirectoryOptions')
  /** @internal */
  private setInstanceOptionsRequest = new rpc.RequestType3('setInstanceOptions')
  /** @internal */
  private setProjectOptionsRequest = new rpc.RequestType3('setProjectOptions')
  /** @internal */
  private setUserOptionsRequest = new rpc.RequestType3('setUserOptions')

  constructor (autoStart: boolean = false) {
    super()
    this.autoStart = autoStart
  }

  /** @internal */
  async bootstrap (): Promise {
    if (this.autoStart && !this.server) await this.start()
  }

  createTransport (): [rpc.MessageReader, rpc.MessageWriter] {
    const serverPath = require.resolve('@dicy/server')
github yitzchak / dicy / packages / client / src / Client.ts View on Github external
/** @internal */
  private clearAllRequest = new rpc.RequestType0('clearAll')
  /** @internal */
  private getTargetsRequest = new rpc.RequestType1('getTargets')
  /** @internal */
  private exitNotification = new rpc.NotificationType0('exit')
  /** @internal */
  private killRequest = new rpc.RequestType2('kill')
  /** @internal */
  private killAllRequest = new rpc.RequestType1('killAll')
  /** @internal */
  private logNotification = new rpc.NotificationType2('log')
  /** @internal */
  private runRequest = new rpc.RequestType2('run')
  /** @internal */
  private setDirectoryOptionsRequest = new rpc.RequestType3('setDirectoryOptions')
  /** @internal */
  private setInstanceOptionsRequest = new rpc.RequestType3('setInstanceOptions')
  /** @internal */
  private setProjectOptionsRequest = new rpc.RequestType3('setProjectOptions')
  /** @internal */
  private setUserOptionsRequest = new rpc.RequestType3('setUserOptions')

  constructor (autoStart: boolean = false) {
    super()
    this.autoStart = autoStart
  }

  /** @internal */
  async bootstrap (): Promise {
    if (this.autoStart && !this.server) await this.start()
  }
github yitzchak / dicy / packages / server / src / Server.ts View on Github external
} from '@dicy/core'
import * as rpc from 'vscode-jsonrpc'

export default class Server {
  private cache: BuilderCacheInterface
  private connection: any

  private clearRequest = new rpc.RequestType1('clear')
  private clearAllRequest = new rpc.RequestType0('clearAll')
  private exitNotification = new rpc.NotificationType0('exit')
  private getTargetsRequest = new rpc.RequestType1('getTargets')
  private killRequest = new rpc.RequestType2('kill')
  private killAllRequest = new rpc.RequestType1('killAll')
  private logNotification = new rpc.NotificationType2('log')
  private runRequest = new rpc.RequestType2('run')
  private setDirectoryOptionsRequest = new rpc.RequestType3('setDirectoryOptions')
  private setInstanceOptionsRequest = new rpc.RequestType3('setInstanceOptions')
  private setProjectOptionsRequest = new rpc.RequestType3('setProjectOptions')
  private setUserOptionsRequest = new rpc.RequestType3('setUserOptions')

  constructor (transport: [rpc.MessageReader, rpc.MessageWriter], cache: BuilderCacheInterface) {
    this.cache = cache

    this.connection = rpc.createMessageConnection(transport[0], transport[1])

    this.connection.onRequest(this.clearRequest,
      (file: Uri): Promise => this.cache.clear(file))

    this.connection.onRequest(this.clearAllRequest,
      (): Promise => this.cache.clearAll())

    this.connection.onNotification(this.exitNotification,
github yitzchak / dicy / packages / client / src / Client.ts View on Github external
/** @internal */
  private getTargetsRequest = new rpc.RequestType1('getTargets')
  /** @internal */
  private exitNotification = new rpc.NotificationType0('exit')
  /** @internal */
  private killRequest = new rpc.RequestType2('kill')
  /** @internal */
  private killAllRequest = new rpc.RequestType1('killAll')
  /** @internal */
  private logNotification = new rpc.NotificationType2('log')
  /** @internal */
  private runRequest = new rpc.RequestType2('run')
  /** @internal */
  private setDirectoryOptionsRequest = new rpc.RequestType3('setDirectoryOptions')
  /** @internal */
  private setInstanceOptionsRequest = new rpc.RequestType3('setInstanceOptions')
  /** @internal */
  private setProjectOptionsRequest = new rpc.RequestType3('setProjectOptions')
  /** @internal */
  private setUserOptionsRequest = new rpc.RequestType3('setUserOptions')

  constructor (autoStart: boolean = false) {
    super()
    this.autoStart = autoStart
  }

  /** @internal */
  async bootstrap (): Promise {
    if (this.autoStart && !this.server) await this.start()
  }

  createTransport (): [rpc.MessageReader, rpc.MessageWriter] {
github yitzchak / dicy / packages / client / src / Client.ts View on Github external
/** @internal */
  private killRequest = new rpc.RequestType2('kill')
  /** @internal */
  private killAllRequest = new rpc.RequestType1('killAll')
  /** @internal */
  private logNotification = new rpc.NotificationType2('log')
  /** @internal */
  private runRequest = new rpc.RequestType2('run')
  /** @internal */
  private setDirectoryOptionsRequest = new rpc.RequestType3('setDirectoryOptions')
  /** @internal */
  private setInstanceOptionsRequest = new rpc.RequestType3('setInstanceOptions')
  /** @internal */
  private setProjectOptionsRequest = new rpc.RequestType3('setProjectOptions')
  /** @internal */
  private setUserOptionsRequest = new rpc.RequestType3('setUserOptions')

  constructor (autoStart: boolean = false) {
    super()
    this.autoStart = autoStart
  }

  /** @internal */
  async bootstrap (): Promise {
    if (this.autoStart && !this.server) await this.start()
  }

  createTransport (): [rpc.MessageReader, rpc.MessageWriter] {
    const serverPath = require.resolve('@dicy/server')

    this.server = cp.fork(serverPath, ['--node-ipc'])