UNPKG

@chemzqm/neovim

Version:

NodeJS client API for vim9 and neovim

31 lines (30 loc) 1.39 kB
import { EventEmitter } from 'events'; import { NeovimClient } from '../api'; import { AtomicResult } from '../types'; import { ILogger } from '../utils/logger'; import type { VimCommands } from './connection'; export interface Response { send: (resp: any, isError?: boolean) => void; } export default abstract class Transport extends EventEmitter { protected logger: ILogger; readonly isVim: boolean; pauseLevel: number; protected paused: Map<number, [string, any[]][]>; constructor(logger: ILogger, isVim: boolean); protected debug(key: string, ...meta: any[]): void; protected info(key: string, ...meta: any[]): void; protected debugMessage(msg: any[]): void; pauseNotification(): void; cancelNotification(): void; resumeNotification(): Promise<AtomicResult>; resumeNotification(isNotify: true): null; abstract attach(writer: NodeJS.WritableStream, reader: NodeJS.ReadableStream, client: NeovimClient): void; abstract detach(): void; abstract send(arr: any[]): void; abstract vimCommand(command: VimCommands, ...args: any[]): void; abstract vimRequest(command: 'call' | 'eval', args: any[]): Promise<any>; abstract request(method: string, args: any[], cb: Function): any; abstract notify(method: string, args: any[]): void; protected abstract createResponse(method: string, requestId: number): Response; }