Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
doComplete: async function (opt) {
let {nvim} = workspace
let func = await nvim.eval('&omnifunc')
if (!func) return null
let {line, colnr, col} = opt
let startcol = col
try {
startcol = await nvim.call(func, [1, ''])
startcol = Number(startcol)
} catch (e) {
workspace.showMessage(`vim error from ${func} :${e.message}`, 'error')
return null
}
// invalid startcol
if (isNaN(startcol) || startcol < 0 || startcol > colnr) return null
let text = byteSlice(line, startcol, colnr - 1)
let [words] = await nvim.eval(`[${func}(0, '${text.replace(/'/g, "''")}'),cursor(${opt.linenr},${colnr})]`)
if (!words || words.length == 0) return null
if (words.hasOwnProperty('words')) {
words = words.words
}
let res = {items: convertToItems(words, this.menu)}
res.startcol = startcol
return res
}
}))
export async function activate(context: ExtensionContext): Promise {
let { subscriptions } = context
let c = workspace.getConfiguration()
const config = c.get('vetur') as any
const enable = config.enable
if (enable === false) return
let file: string
let devPath = config.dev && config.dev.vlsPath // config.get('dev.vlsPath', null)
if (devPath && fs.existsSync(devPath)) {
file = path.join(devPath, 'dist/vueServerMain.js')
if (!fs.existsSync(file)) {
workspace.showMessage(`vetur server module "${file}" not found!`, 'error')
return
}
} else {
file = requireFunc.resolve('vue-language-server')
if (!file) {
workspace.showMessage('vue-language-server module not found!', 'error')
return
}
}
const selector: DocumentSelector = [{
language: 'vue',
scheme: 'file'
}]
let serverOptions: ServerOptions = {
module: file,
cp.execFile(gotests, args, {env: {}}, async (err, stdout, stderr) => {
if (err) {
workspace.showMessage(`Error: ${stderr}`, "error")
return reject()
}
workspace.showMessage(stdout || "")
resolve(true)
})
})
doComplete: async function (opt) {
let loaded = await nvim.getVar('loaded_neosnippet')
if (!loaded) {
if (!loadError) workspace.showMessage('Neosnippet not loaded', 'error')
loadError = true
return
}
let items = await getItems(opt.filetype, this.menu)
return { items }
},
onCompleteDone: () => {
task.onStderr(lines => {
workspace.showMessage(`TSC error: ` + lines.join('\n'), 'error')
})
this.disposables.push(Disposable.create(() => {
exports.activate = async context => {
let config = workspace.getConfiguration('coc.source.vimtex')
let {nvim} = workspace
let regex = await nvim.getVar('vimtex#re#deoplete')
if (!regex) {
workspace.showMessage('vimtex not loaded', 'error')
return
}
regex = regex.slice(2, regex.length)
let pattern = new RegExp(convertRegex(regex) + '$')
function convertItems(list) {
let res = []
for (let item of list) {
if (typeof item == 'string') {
res.push(Object.assign({word: item}))
}
if (item.hasOwnProperty('word')) {
res.push(item)
}
}
return res
doComplete: async function () {
let loaded = await nvim.getVar('did_plugin_ultisnips')
if (!loaded) {
if (!loadError) workspace.showMessage('Ultisnips not loaded', 'error')
loadError = true
return
}
let res = await nvim.call('UltiSnips#SnippetsInCurrentScope')
let items = []
if (Array.isArray(res)) {
for (let item of res) {
items.push({
word: item.key,
info: item.description || '',
menu: this.menu,
isSnippet: true
})
}
} else {
for (let key of Object.keys(res)) {
private async showProgress(): Promise {
let text = this.getText();
workspace.showMessage(text);
}
}
fs.writeFile(`${sourceDir}/words_${COUNTER % FILE_COUNT}.txt`, text, err => {
if (err) {
workspace.showMessage(err)
return
}
})
COUNTER++
function warnOnMissingCargoToml(): void {
workspace.showMessage(
'A Cargo.toml file must be at the root of the workspace in order to support all features', 'warning'
)
}