本文整理匯總了TypeScript中@chemzqm/neovim.Neovim.getVar方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Neovim.getVar方法的具體用法?TypeScript Neovim.getVar怎麽用?TypeScript Neovim.getVar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@chemzqm/neovim.Neovim
的用法示例。
在下文中一共展示了Neovim.getVar方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: getItems
public async getItems(): Promise<VimCompleteItem[]> {
let visible = await this.pumvisible()
if (!visible) return []
let context = await this.nvim.getVar('coc#_context') as any
let items = context.candidates
return items || []
}
示例2: visible
public async visible(word: string, source?: string): Promise<boolean> {
await this.waitPopup()
let context = await this.nvim.getVar('coc#_context') as any
let items = context.candidates
if (!items) return false
let item = items.find(o => o.word == word)
if (!item || !item.user_data) return false
try {
let o = JSON.parse(item.user_data)
if (source && o.source !== source) {
return false
}
} catch (e) {
return false
}
return true
}
示例3: it
it('should fix start column', async () => {
await helper.edit()
let source: ISource = {
name: 'test',
priority: 10,
enable: true,
firstMatch: false,
sourceType: SourceType.Native,
triggerCharacters: [],
doComplete: async (): Promise<CompleteResult> => {
let result: CompleteResult = {
startcol: 0,
items: [{ word: 'foo.bar' }]
}
return Promise.resolve(result)
}
}
sources.addSource(source)
await nvim.setLine('foo.')
await nvim.input('Ab')
await helper.waitPopup()
let val = await nvim.getVar('coc#_context') as any
expect(val.start).toBe(0)
})
示例4: items
public async items(): Promise<VimCompleteItem[]> {
let context = await this.nvim.getVar('coc#_context')
return context['candidates'] || []
}