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)
})
})
function getConfig(): WorkspaceConfiguration {
let config = workspace.getConfiguration('ember');
return config;
}
constructor(private pluginManager: PluginManager) {
const config = workspace.getConfiguration('tsserver')
const enableJavascript = !!config.get('enableJavascript')
this.enable = config.get('enable')
this.descriptions = standardLanguageDescriptions.filter(o => {
return enableJavascript ? true : o.id != 'javascript'
})
this.selector = this.descriptions.reduce((arr, c) => {
return arr.concat(c.modeIds)
}, [])
}
private configurationChanged(): void {
const config = workspace.getConfiguration('tsserver')
this.reportStyleCheckAsWarnings = config.get('reportStyleChecksAsWarnings', true)
}
public enableJavascript(): boolean {
const config = workspace.getConfiguration('tsserver')
return !!config.get('enableJavascript')
}
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