How to use the coc.nvim.workspace.showMessage function in coc

To help you get started, we’ve selected a few coc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neoclide / coc-sources / packages / omni / index.js View on Github external
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
    }
  }))
github neoclide / coc-vetur / src / index.ts View on Github external
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,
github josa42 / coc-go / src / utils / tests.ts View on Github external
cp.execFile(gotests, args, {env: {}}, async (err, stdout, stderr) => {
      if (err) {
        workspace.showMessage(`Error: ${stderr}`, "error")
        return reject()
      }

      workspace.showMessage(stdout || "")

      resolve(true)
    })
  })
github neoclide / coc-sources / packages / neosnippet / index.js View on Github external
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: () => {
github neoclide / coc-tsserver / src / server / features / watchBuild.ts View on Github external
task.onStderr(lines => {
      workspace.showMessage(`TSC error: ` + lines.join('\n'), 'error')
    })
    this.disposables.push(Disposable.create(() => {
github neoclide / coc-vimtex / src / index.js View on Github external
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
github neoclide / coc-sources / packages / ultisnips / index.js View on Github external
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)) {
github ckipp01 / coc-metals / src / ProgressItem.ts View on Github external
private async showProgress(): Promise {
    let text = this.getText();
    workspace.showMessage(text);
  }
}
github voldikss / coc-browser / index.js View on Github external
fs.writeFile(`${sourceDir}/words_${COUNTER % FILE_COUNT}.txt`, text, err => {
    if (err) {
      workspace.showMessage(err)
      return
    }
  })
  COUNTER++
github neoclide / coc-rls / src / index.ts View on Github external
function warnOnMissingCargoToml(): void {
  workspace.showMessage(
    'A Cargo.toml file must be at the root of the workspace in order to support all features', 'warning'
  )
}

coc

ISC
Latest version published 10 years ago

Package Health Score

40 / 100
Full package analysis