本文整理匯總了TypeScript中@chemzqm/neovim.Neovim.pauseNotification方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Neovim.pauseNotification方法的具體用法?TypeScript Neovim.pauseNotification怎麽用?TypeScript Neovim.pauseNotification使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@chemzqm/neovim.Neovim
的用法示例。
在下文中一共展示了Neovim.pauseNotification方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should add matches to ranges', async () => {
let doc = await helper.createDocument()
let buf = doc.buffer
let lines = [
'a'.repeat(30),
'b'.repeat(30),
'c'.repeat(30),
'd'.repeat(30)
]
await buf.setLines(lines, { start: 0, end: -1 })
await helper.wait(100)
let ranges: Range[] = [
Range.create(0, 0, 0, 10),
Range.create(1, 0, 2, 10),
Range.create(3, 0, 4, 0)]
nvim.pauseNotification()
doc.matchAddRanges(ranges, 'Search')
await nvim.resumeNotification()
let res = await nvim.call('getmatches')
let item = res.find(o => o.group == 'Search')
expect(item).toBeDefined()
expect(item.pos1).toEqual([1, 1, 10])
expect(item.pos2).toEqual([2, 1, 30])
expect(item.pos3).toEqual([3, 1, 10])
expect(item.pos4).toEqual([4, 1, 30])
})
示例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: show
public async show(docs: Documentation[], bounding: PumBounding, token: CancellationToken): Promise<void> {
this.bounding = bounding
let { nvim } = this
let rect = await this.calculateBounding(docs)
if (this.window) {
let valid = await this.window.valid
if (!valid) this.window = null
}
if (token.isCancellationRequested) return
if (!this.window) {
try {
let config = Object.assign({
relative: 'editor',
focusable: true
}, rect)
let win = this.window = await nvim.openFloatWindow(this.buffer, false, config)
nvim.pauseNotification()
win.setVar('popup', 1, true)
win.setVar('float', 1, true)
win.setOption('list', false, true)
win.setOption('spell', false, true)
win.setOption('listchars', 'eol: ', true)
win.setOption('number', false, true)
win.setOption('cursorline', false, true)
win.setOption('cursorcolumn', false, true)
win.setOption('signcolumn', 'no', true)
win.setOption('conceallevel', 2, true)
win.setOption('relativenumber', false, true)
win.setOption('winhl', 'Normal:CocFloating,NormalNC:CocFloating', true)
this.showBuffer()
await nvim.resumeNotification()
} catch (e) {
logger.error(`Create preview error:`, e.stack)
}
} else {
nvim.pauseNotification()
let config = Object.assign({
relative: 'editor'
}, rect)
this.window.setConfig(config, true)
this.showBuffer()
await nvim.resumeNotification()
}
if (token.isCancellationRequested) {
nvim.call('coc#util#close_win', [this.window.id], true)
}
}
示例4: it
it('should set documents', async () => {
let buf = await create()
let docs: Documentation[] = [{
filetype: 'markdown',
content: '# head\n**note**'
}, {
filetype: 'typescript',
content: "class Foo",
active: [0, 5]
}]
await buf.setDocuments(docs, 60)
nvim.pauseNotification()
buf.setLines()
await nvim.resumeNotification()
let lines = await buf.buffer.lines
expect(lines.length).toBe(4)
})
示例5: show
public async show(preserveFocus?: boolean): Promise<void> {
let { bufnr, nvim } = this
if (!bufnr) return
let winnr = await nvim.call('bufwinnr', bufnr)
nvim.pauseNotification()
if (winnr == -1) {
nvim.command(`below ${bufnr}sb`, true)
nvim.command('resize 5', true)
} else {
nvim.command(`${winnr}wincmd w`, true)
}
nvim.command('normal! G', true)
if (preserveFocus) {
nvim.command('wincmd p', true)
}
await nvim.resumeNotification()
}