本文整理匯總了TypeScript中@chemzqm/neovim.Neovim.call方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Neovim.call方法的具體用法?TypeScript Neovim.call怎麽用?TypeScript Neovim.call使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@chemzqm/neovim.Neovim
的用法示例。
在下文中一共展示了Neovim.call方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should clear all diagnostics', async () => {
let diagnostic = createDiagnostic('foo')
let buf = await createDiagnosticBuffer()
let diagnostics = [diagnostic]
buf.refresh(diagnostics)
await helper.wait(100)
await buf.clear()
let content = await nvim.call('execute', [`sign place buffer=${buf.bufnr}`])
let lines: string[] = content.split('\n')
let line = lines.find(s => s.indexOf('CocError') != -1)
expect(line).toBeUndefined()
let winid = await nvim.call('bufwinid', buf.bufnr) as number
let curr = await nvim.call('getloclist', [winid, { title: 1 }])
expect(curr.title).toBeUndefined()
let buffer = await nvim.buffer
let res = await buffer.getVar('coc_diagnostic_info')
expect(res).toEqual({
information: 0,
hint: 0,
warning: 0,
error: 0
})
let { matchIds } = buf as any
expect(matchIds.size).toBe(0)
})
示例2: start
public async start(cwd?: string, env?: { [key: string]: string | null }): Promise<void> {
let { nvim } = this
nvim.pauseNotification()
nvim.command('belowright 5new', true)
nvim.command('setl winfixheight', true)
nvim.command('setl norelativenumber', true)
nvim.command('setl nonumber', true)
if (env && Object.keys(env).length) {
for (let key of Object.keys(env)) {
nvim.command(`let $${key}='${env[key].replace(/'/g, "''")}'`, true)
}
}
await nvim.resumeNotification()
this.bufnr = await nvim.call('bufnr', '%')
let cmd = [this.cmd, ...this.args]
let opts: any = {}
if (cwd) opts.cwd = cwd
this.chanId = await nvim.call('termopen', [cmd, opts])
if (env && Object.keys(env).length) {
for (let key of Object.keys(env)) {
nvim.command(`unlet $${key}`, true)
}
}
await nvim.command('wincmd p')
}
示例3: edit
public async edit(file?: string): Promise<Buffer> {
file = path.join(__dirname, file ? file : `${uuid()}`)
let escaped = await this.nvim.call('fnameescape', file)
await this.nvim.command(`edit ${escaped}`)
await this.wait(60)
let bufnr = await this.nvim.call('bufnr', ['%']) as number
return this.nvim.createBuffer(bufnr)
}
示例4: it
it('should start completion', async () => {
await nvim.setLine('foo football')
await nvim.input('a')
await nvim.call('cursor', [1, 2])
let option: CompleteOption = await nvim.call('coc#util#get_complete_option')
await completion.startCompletion(option)
await helper.wait(30)
expect(completion.isActivted).toBe(true)
})
示例5: reset
public async reset(): Promise<void> {
let mode = await this.nvim.call('mode')
if (mode !== 'n') {
await this.nvim.command('stopinsert')
await this.nvim.call('feedkeys', [String.fromCharCode(27), 'int'])
}
await this.nvim.command('silent! %bwipeout!')
await this.wait(60)
}
示例6: it
it('should show floating window on cursor hold', async () => {
let config = workspace.getConfiguration('diagnostic')
config.update('messageTarget', 'float')
await createDocument()
await nvim.call('cursor', [1, 3])
let winid = await helper.waitFloat()
let bufnr = await nvim.call('nvim_win_get_buf', winid) as number
let buf = nvim.createBuffer(bufnr)
let lines = await buf.lines
expect(lines.join('\n')).toMatch('error')
})
示例7: it
it('should resume list', async () => {
await manager.start(['--normal', 'location'])
await helper.wait(300)
await nvim.eval('feedkeys("j", "in")')
await helper.wait(30)
let line = await nvim.call('line', '.')
expect(line).toBe(2)
await manager.cancel()
await helper.wait(30)
await manager.resume()
await helper.wait(60)
line = await nvim.call('line', '.')
expect(line).toBe(2)
})