How to use the vscode-jsonrpc.RequestType2 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 kill when request is sent', async (done) => {
    await client.sendRequest(new rpc.RequestType2('kill'), file, 'die!')

    expect(cache.kill).toHaveBeenCalledWith(file, 'die!')

    done()
  })
github yitzchak / dicy / packages / server / spec / Server_spec.ts View on Github external
it('calls run when request is sent', async (done) => {
    const commands: Command[] = ['load', 'build', 'save']

    expect(await client.sendRequest(new rpc.RequestType2('run'), file, commands)).toBeTruthy()

    expect(cache.run).toHaveBeenCalledWith(file, commands)

    done()
  })
github yitzchak / dicy / packages / client / src / Client.ts View on Github external
private connection: any
  /** @internal */
  private server: cp.ChildProcess
  /** @internal */
  private cachedBuilders: Map = new Map()

  /** @internal */
  private clearRequest = new rpc.RequestType1('clear')
  /** @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) {
github eclipsesource / coffee-editor / web / coffee-workflow-analyzer / src / node / workflow-analysis-server.ts View on Github external
public createRunAnalysisRequest(): rpc.RequestType2 {
        return new rpc.RequestType2('runAnalysis');
    }
github yitzchak / dicy / packages / client / src / Client.ts View on Github external
/** @internal */
  private clearRequest = new rpc.RequestType1('clear')
  /** @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 {
github yitzchak / dicy / packages / server / src / Server.ts View on Github external
import {
  BuilderCacheInterface, Command, Message, OptionsSource, Uri
} 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))
github yitzchak / dicy / packages / server / src / Server.ts View on Github external
BuilderCacheInterface, Command, Message, OptionsSource, Uri
} 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())