Code Monkey home page Code Monkey logo

coc.nvim's Introduction

Logo

Make your Vim/Neovim as smart as VS Code

Software License Actions Codecov Coverage Status Doc Matrix


Custom coc popup menu with snippet support

Custom popup menu with snippet support

Why?

Quick Start

Make sure use Vim >= 8.1.1719 or Neovim >= 0.4.0.

Install nodejs >= 16.18.0:

curl -sL install-node.vercel.app/lts | bash

For vim-plug users:

" Use release branch (recommended)
Plug 'neoclide/coc.nvim', {'branch': 'release'}

" Or build from source code by using npm
Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'npm ci'}

in your .vimrc or init.vim, then restart Vim and run :PlugInstall.

Checkout Install coc.nvim for more info.

You have to install coc extensions or configure language servers for LSP support.

Install extensions like this:

:CocInstall coc-json coc-tsserver

Or you can configure a language server in your coc-settings.json(open it using :CocConfig) like this:

{
  "languageserver": {
    "go": {
      "command": "gopls",
      "rootPatterns": ["go.mod"],
      "trace.server": "verbose",
      "filetypes": ["go"]
    }
  }
}

Checkout the wiki for more details:

Checkout :h coc-nvim for Vim interface.

Example Vim configuration

Configuration is required to make coc.nvim easier to work with, since it doesn't change your key-mappings or Vim options. This is done as much as possible to avoid conflict with your other plugins.

❗️Important: Some Vim plugins can change your key mappings. Please use command like:verbose imap <tab> to make sure that your keymap has taken effect.

" https://raw.githubusercontent.com/neoclide/coc.nvim/master/doc/coc-example-config.vim

" May need for Vim (not Neovim) since coc.nvim calculates byte offset by count
" utf-8 byte sequence
set encoding=utf-8
" Some servers have issues with backup files, see #649
set nobackup
set nowritebackup

" Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
" delays and poor user experience
set updatetime=300

" Always show the signcolumn, otherwise it would shift the text each time
" diagnostics appear/become resolved
set signcolumn=yes

" Use tab for trigger completion with characters ahead and navigate
" NOTE: There's always complete item selected by default, you may want to enable
" no select by `"suggest.noselect": true` in your configuration file
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
" other plugin before putting this into your config
inoremap <silent><expr> <TAB>
      \ coc#pum#visible() ? coc#pum#next(1) :
      \ CheckBackspace() ? "\<Tab>" :
      \ coc#refresh()
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"

" Make <CR> to accept selected completion item or notify coc.nvim to format
" <C-g>u breaks current undo, please make your own choice
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
                              \: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"

function! CheckBackspace() abort
  let col = col('.') - 1
  return !col || getline('.')[col - 1]  =~# '\s'
endfunction

" Use <c-space> to trigger completion
if has('nvim')
  inoremap <silent><expr> <c-space> coc#refresh()
else
  inoremap <silent><expr> <c-@> coc#refresh()
endif

" Use `[g` and `]g` to navigate diagnostics
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
nmap <silent> [g <Plug>(coc-diagnostic-prev)
nmap <silent> ]g <Plug>(coc-diagnostic-next)

" GoTo code navigation
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)

" Use K to show documentation in preview window
nnoremap <silent> K :call ShowDocumentation()<CR>

function! ShowDocumentation()
  if CocAction('hasProvider', 'hover')
    call CocActionAsync('doHover')
  else
    call feedkeys('K', 'in')
  endif
endfunction

" Highlight the symbol and its references when holding the cursor
autocmd CursorHold * silent call CocActionAsync('highlight')

" Symbol renaming
nmap <leader>rn <Plug>(coc-rename)

" Formatting selected code
xmap <leader>f  <Plug>(coc-format-selected)
nmap <leader>f  <Plug>(coc-format-selected)

augroup mygroup
  autocmd!
  " Setup formatexpr specified filetype(s)
  autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
  " Update signature help on jump placeholder
  autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
augroup end

" Applying code actions to the selected code block
" Example: `<leader>aap` for current paragraph
xmap <leader>a  <Plug>(coc-codeaction-selected)
nmap <leader>a  <Plug>(coc-codeaction-selected)

" Remap keys for applying code actions at the cursor position
nmap <leader>ac  <Plug>(coc-codeaction-cursor)
" Remap keys for apply code actions affect whole buffer
nmap <leader>as  <Plug>(coc-codeaction-source)
" Apply the most preferred quickfix action to fix diagnostic on the current line
nmap <leader>qf  <Plug>(coc-fix-current)

" Remap keys for applying refactor code actions
nmap <silent> <leader>re <Plug>(coc-codeaction-refactor)
xmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)
nmap <silent> <leader>r  <Plug>(coc-codeaction-refactor-selected)

" Run the Code Lens action on the current line
nmap <leader>cl  <Plug>(coc-codelens-action)

" Map function and class text objects
" NOTE: Requires 'textDocument.documentSymbol' support from the language server
xmap if <Plug>(coc-funcobj-i)
omap if <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap af <Plug>(coc-funcobj-a)
xmap ic <Plug>(coc-classobj-i)
omap ic <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)

" Remap <C-f> and <C-b> to scroll float windows/popups
if has('nvim-0.4.0') || has('patch-8.2.0750')
  nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
  inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
  inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
  vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
  vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
endif

" Use CTRL-S for selections ranges
" Requires 'textDocument/selectionRange' support of language server
nmap <silent> <C-s> <Plug>(coc-range-select)
xmap <silent> <C-s> <Plug>(coc-range-select)

" Add `:Format` command to format current buffer
command! -nargs=0 Format :call CocActionAsync('format')

" Add `:Fold` command to fold current buffer
command! -nargs=? Fold :call     CocAction('fold', <f-args>)

" Add `:OR` command for organize imports of the current buffer
command! -nargs=0 OR   :call     CocActionAsync('runCommand', 'editor.action.organizeImport')

" Add (Neo)Vim's native statusline support
" NOTE: Please see `:h coc-status` for integrations with external plugins that
" provide custom statusline: lightline.vim, vim-airline
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}

" Mappings for CoCList
" Show all diagnostics
nnoremap <silent><nowait> <space>a  :<C-u>CocList diagnostics<cr>
" Manage extensions
nnoremap <silent><nowait> <space>e  :<C-u>CocList extensions<cr>
" Show commands
nnoremap <silent><nowait> <space>c  :<C-u>CocList commands<cr>
" Find symbol of current document
nnoremap <silent><nowait> <space>o  :<C-u>CocList outline<cr>
" Search workspace symbols
nnoremap <silent><nowait> <space>s  :<C-u>CocList -I symbols<cr>
" Do default action for next item
nnoremap <silent><nowait> <space>j  :<C-u>CocNext<CR>
" Do default action for previous item
nnoremap <silent><nowait> <space>k  :<C-u>CocPrev<CR>
" Resume latest coc list
nnoremap <silent><nowait> <space>p  :<C-u>CocListResume<CR>

Example Lua configuration

NOTE: This only works in Neovim 0.7.0dev+.

-- https://raw.githubusercontent.com/neoclide/coc.nvim/master/doc/coc-example-config.lua

-- Some servers have issues with backup files, see #649
vim.opt.backup = false
vim.opt.writebackup = false

-- Having longer updatetime (default is 4000 ms = 4s) leads to noticeable
-- delays and poor user experience
vim.opt.updatetime = 300

-- Always show the signcolumn, otherwise it would shift the text each time
-- diagnostics appeared/became resolved
vim.opt.signcolumn = "yes"

local keyset = vim.keymap.set
-- Autocomplete
function _G.check_back_space()
    local col = vim.fn.col('.') - 1
    return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
end

-- Use Tab for trigger completion with characters ahead and navigate
-- NOTE: There's always a completion item selected by default, you may want to enable
-- no select by setting `"suggest.noselect": true` in your configuration file
-- NOTE: Use command ':verbose imap <tab>' to make sure Tab is not mapped by
-- other plugins before putting this into your config
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)

-- Make <CR> to accept selected completion item or notify coc.nvim to format
-- <C-g>u breaks current undo, please make your own choice
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)

-- Use <c-j> to trigger snippets
keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
-- Use <c-space> to trigger completion
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})

-- Use `[g` and `]g` to navigate diagnostics
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})

-- GoTo code navigation
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})


-- Use K to show documentation in preview window
function _G.show_docs()
    local cw = vim.fn.expand('<cword>')
    if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
        vim.api.nvim_command('h ' .. cw)
    elseif vim.api.nvim_eval('coc#rpc#ready()') then
        vim.fn.CocActionAsync('doHover')
    else
        vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
    end
end
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})


-- Highlight the symbol and its references on a CursorHold event(cursor is idle)
vim.api.nvim_create_augroup("CocGroup", {})
vim.api.nvim_create_autocmd("CursorHold", {
    group = "CocGroup",
    command = "silent call CocActionAsync('highlight')",
    desc = "Highlight symbol under cursor on CursorHold"
})


-- Symbol renaming
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})


-- Formatting selected code
keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})


-- Setup formatexpr specified filetype(s)
vim.api.nvim_create_autocmd("FileType", {
    group = "CocGroup",
    pattern = "typescript,json",
    command = "setl formatexpr=CocAction('formatSelected')",
    desc = "Setup formatexpr specified filetype(s)."
})

-- Update signature help on jump placeholder
vim.api.nvim_create_autocmd("User", {
    group = "CocGroup",
    pattern = "CocJumpPlaceholder",
    command = "call CocActionAsync('showSignatureHelp')",
    desc = "Update signature help on jump placeholder"
})

-- Apply codeAction to the selected region
-- Example: `<leader>aap` for current paragraph
local opts = {silent = true, nowait = true}
keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)

-- Remap keys for apply code actions at the cursor position.
keyset("n", "<leader>ac", "<Plug>(coc-codeaction-cursor)", opts)
-- Remap keys for apply source code actions for current file.
keyset("n", "<leader>as", "<Plug>(coc-codeaction-source)", opts)
-- Apply the most preferred quickfix action on the current line.
keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)

-- Remap keys for apply refactor code actions.
keyset("n", "<leader>re", "<Plug>(coc-codeaction-refactor)", { silent = true })
keyset("x", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })
keyset("n", "<leader>r", "<Plug>(coc-codeaction-refactor-selected)", { silent = true })

-- Run the Code Lens actions on the current line
keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)


-- Map function and class text objects
-- NOTE: Requires 'textDocument.documentSymbol' support from the language server
keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)


-- Remap <C-f> and <C-b> to scroll float windows/popups
---@diagnostic disable-next-line: redefined-local
local opts = {silent = true, nowait = true, expr = true}
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
keyset("i", "<C-f>",
       'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
keyset("i", "<C-b>",
       'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)


-- Use CTRL-S for selections ranges
-- Requires 'textDocument/selectionRange' support of language server
keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})


-- Add `:Format` command to format current buffer
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})

-- " Add `:Fold` command to fold current buffer
vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})

-- Add `:OR` command for organize imports of the current buffer
vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})

-- Add (Neo)Vim's native statusline support
-- NOTE: Please see `:h coc-status` for integrations with external plugins that
-- provide custom statusline: lightline.vim, vim-airline
vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")

-- Mappings for CoCList
-- code actions and coc stuff
---@diagnostic disable-next-line: redefined-local
local opts = {silent = true, nowait = true}
-- Show all diagnostics
keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
-- Manage extensions
keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
-- Show commands
keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
-- Find symbol of current document
keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
-- Search workspace symbols
keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
-- Do default action for next item
keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
-- Do default action for previous item
keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
-- Resume latest coc list
keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)

Articles

Troubleshooting

Try these steps if you experience problems with coc.nvim:

  • Ensure your Vim version >= 8.0 using :version
  • If a service failed to start, use :CocInfo or :checkhealth if you use Neovim
  • Checkout the log of coc.nvim with :CocOpenLog
  • If you have issues with the language server, it's recommended to checkout the language server output

Feedback

Backers

Become a backer and get your image on our README on GitHub with a link to your site.

Contributors

Qiming zhao
Qiming zhao

💻
Heyward Fann
Heyward Fann

💻
Raidou
Raidou

💻
kevinhwang91
kevinhwang91

💻
年糕小豆汤
年糕小豆汤

💻
Avi Dessauer
Avi Dessauer

💻
最上川
最上川

💻
Yatao Li
Yatao Li

💻
wongxy
wongxy

💻
Sam McCall
Sam McCall

💻
Samuel Roeca
Samuel Roeca

💻
Amirali Esmaeili
Amirali Esmaeili

💻
Jack Rowlingson
Jack Rowlingson

💻
Jaehwang Jung
Jaehwang Jung

💻
Antoine
Antoine

💻
Cosmin Popescu
Cosmin Popescu

💻
Duc Nghiem Xuan
Duc Nghiem Xuan

💻
Francisco Lopes
Francisco Lopes

💻
daquexian
daquexian

💻
dependabot[bot]
dependabot[bot]

💻
greenkeeper[bot]
greenkeeper[bot]

💻
Chris Kipp
Chris Kipp

💻
Dmytro Meleshko
Dmytro Meleshko

💻
Kirill Bobyrev
Kirill Bobyrev

💻
Gontran Baerts
Gontran Baerts

💻
Andy
Andy

💻
Cheng JIANG
Cheng JIANG

💻
Corin
Corin

💻
Daniel Zhang
Daniel Zhang

💻
Ferdinand Bachmann
Ferdinand Bachmann

💻
Guangqing Chen
Guangqing Chen

💻
Jade Meskill
Jade Meskill

💻
Jasper Poppe
Jasper Poppe

💻
Jean Jordaan
Jean Jordaan

💻
Kid
Kid

💻
Pieter van Loon
Pieter van Loon

💻
Robert Liebowitz
Robert Liebowitz

💻
Seth Messer
Seth Messer

💻
UncleBill
UncleBill

💻
ZERO
ZERO

💻
fsouza
fsouza

💻
XiaoZhang
XiaoZhang

💻
whyreal
whyreal

💻
yehuohan
yehuohan

💻
バクダンくん
バクダンくん

💻
Raphael
Raphael

💻
tbodt
tbodt

💻
Aaron McDaid
Aaron McDaid

💻
Aasif Versi
Aasif Versi

💻
Abner Silva
Abner Silva

💻
Adam Stankiewicz
Adam Stankiewicz

💻
Adamansky Anton
Adamansky Anton

💻
Ahmed El Gabri
Ahmed El Gabri

💻
Alexandr Kondratev
Alexandr Kondratev

💻
Andrew Shim
Andrew Shim

💻
Andy Lindeman
Andy Lindeman

💻
Augustin
Augustin

💻
Bastien Orivel
Bastien Orivel

💻
Ben Lu
Ben Lu

💻
Ben
Ben

💻
Brendan Roy
Brendan Roy

💻
brianembry
brianembry

💻
br
br

💻
Cason Adams
Cason Adams

💻
Chang Y
Chang Y

💻
Chayoung You
Chayoung You

💻
Chen Lijun
Chen Lijun

💻
Chen Mulong
Chen Mulong

💻
Chris Weyl
Chris Weyl

💻
dezza
dezza

💻
Cody Allen
Cody Allen

💻
Damien Rajon
Damien Rajon

💻
Daniel Eriksson
Daniel Eriksson

💻
Daniel Jenson
Daniel Jenson

💻
David Mejorado
David Mejorado

💻
Deric Pang
Deric Pang

💻
Ding Tao
Ding Tao

💻
Doron Behar
Doron Behar

💻
Egor Kovetskiy
Egor Kovetskiy

💻
ElKowar
ElKowar

💻
Emeliov Dmitrii
Emeliov Dmitrii

💻
Fabian Becker
Fabian Becker

💻
FallenWarrior2k
FallenWarrior2k

💻
Fausto Núñez Alberro
Fausto Núñez Alberro

💻
Felipe Ramos
Felipe Ramos

💻
Fredrik Borg
Fredrik Borg

💻
Gavin Sim
Gavin Sim

💻
Gibson Fahnestock
Gibson Fahnestock

💻
Giovanni Giordano
Giovanni Giordano

💻
Gopal Adhikari
Gopal Adhikari

💻
Hanh Le
Hanh Le

💻
hedy
hedy

💻
Hendrik Lammers
Hendrik Lammers

💻
Henry Barreto
Henry Barreto

💻
Hugo
Hugo

💻
Jackie Li
Jackie Li

💻
Jakub Nowak
Jakub Nowak

💻
James Pickard
James Pickard

💻
Jia Sui
Jia Sui

💻
Ellie Hermaszewska
Ellie Hermaszewska

💻
Joel Bradshaw
Joel Bradshaw

💻
John Carlo Roberto
John Carlo Roberto

💻
Jonas Holst Damtoft
Jonas Holst Damtoft

💻
Jonathan Lehman
Jonathan Lehman

💻
Joosep Alviste
Joosep Alviste

💻
Josa Gesell
Josa Gesell

💻
Joshua Rubin
Joshua Rubin

💻
Julian Grinblat
Julian Grinblat

💻
Julian Valentin
Julian Valentin

💻
KabbAmine
KabbAmine

💻
Kay Gosho
Kay Gosho

💻
Kenny Huynh
Kenny Huynh

💻
Kevin Rambaud
Kevin Rambaud

💻
Kian Cross
Kian Cross

💻
Kristijan Husak
Kristijan Husak

💻
NullVoxPopuli
NullVoxPopuli

💻
Lasse Peters
Lasse Peters

💻
Noel Errenil
Noel Errenil

💻
LinArcX
LinArcX

💻
Liu-Cheng Xu
Liu-Cheng Xu

💻
Marc
Marc

💻
Marius Gawrisch
Marius Gawrisch

💻
Mark Hintz
Mark Hintz

💻
Mathieu Le Tiec
Mathieu Le Tiec

💻
Matt White
Matt White

💻
Matthew Evans
Matthew Evans

💻
Me1onRind
Me1onRind

💻
Qyriad
Qyriad

💻
Narcis B.
Narcis B.

💻
Neur1n
Neur1n

💻
Nicolas Dermine
Nicolas Dermine

💻
Noah
Noah

💻
PENG Rui
PENG Rui

💻
Paco
Paco

💻
Peng Guanwen
Peng Guanwen

💻
Petter Wahlman
Petter Wahlman

💻
Pooya Moradi
Pooya Moradi

💻
Quade Morrison
Quade Morrison

💻
Ralf Vogler
Ralf Vogler

💻
Ran Chen
Ran Chen

💻
Ricardo García Vega
Ricardo García Vega

💻
Rick Jones
Rick Jones

💻
Ryan Christian
Ryan Christian

💻
Salo
Salo

💻
Sam Nolan
Sam Nolan

💻
Saurav
Saurav

💻
Sean Mackesey
Sean Mackesey

💻
Sheel Patel
Sheel Patel

💻
Solomon Ng
Solomon Ng

💻
Sri Kadimisetty
Sri Kadimisetty

💻
Stephen Prater
Stephen Prater

💻
Sune Kibsgaard
Sune Kibsgaard

💻
Aquaakuma
Aquaakuma

💻
Takumi Kawase
Takumi Kawase

💻
The Blob SCP
The Blob SCP

💻
Tomasz N
Tomasz N

💻
Tomoyuki Harada
Tomoyuki Harada

💻
Tony Fettes
Tony Fettes

💻
Tony Narlock
Tony Narlock

💻
Tony Wang
Tony Wang

💻
Victor Quach
Victor Quach

💻
Whisperity
Whisperity

💻
William Turner
William Turner

💻
Xiaochao Dong
Xiaochao Dong

💻
Hugh Hou
Hugh Hou

💻
Jackie Li
Jackie Li

💻
Zachary Freed
Zachary Freed

💻
akiyosi
akiyosi

💻
alexjg
alexjg

💻
aste4
aste4

💻
clyfish
clyfish

💻
dev7ba
dev7ba

💻
diartyz
diartyz

💻
doza-daniel
doza-daniel

💻
equal-l2
equal-l2

💻
fong
fong

💻
hexh
hexh

💻
hhiraba
hhiraba

💻
ic-768
ic-768

💻
javiertury
javiertury

💻
karasu
karasu

💻
kevineato
kevineato

💻
Eduardo Costa
Eduardo Costa

💻
micchy326
micchy326

💻
midchildan
midchildan

💻
minefuto
minefuto

💻
miyanokomiya
miyanokomiya

💻
miyaviee
miyaviee

💻
monkoose
monkoose

💻 🐛
mujx
mujx

💻
mvilim
mvilim

💻
naruaway
naruaway

💻
piersy
piersy

💻
ryantig
ryantig

💻
rydesun
rydesun

💻
sc00ter
sc00ter

💻
smhc
smhc

💻
Sam Kaplan
Sam Kaplan

💻
tasuten
tasuten

💻
todesking
todesking

💻
typicode
typicode

💻
李鸣飞
李鸣飞

💻
Ikko Ashimine
Ikko Ashimine

📖
Rammiah
Rammiah

🐛
Alisue
Alisue

🐛
bigshans
bigshans

📖
Robert Boyd III
Robert Boyd III

🐛
Yuki Iwanaga
Yuki Iwanaga

💻
SpringHack
SpringHack

🐛
Lucas Burns
Lucas Burns

📖
qiqiboy
qiqiboy

💻
timsu92
timsu92

📖
Shawn M Moore
Shawn M Moore

💻
Aaron U'Ren
Aaron U'Ren

🐛
SeniorMars
SeniorMars

📖
牧羊犬真Q
牧羊犬真Q

📖
geraldspreer
geraldspreer

📖
Fabio
Fabio

📖
Li Yunting
Li Yunting

🐛
Jeff L.
Jeff L.

💻
Elliot Winkler
Elliot Winkler

💻

This project follows the all-contributors specification. Contributions of any kind are welcome!

License

Anti 996

coc.nvim's People

Contributors

allcontributors[bot] avatar amiralies avatar antoinemadec avatar avi-d-coder avatar chemzqm avatar ckipp01 avatar cosminadrianpopescu avatar daquexian avatar dependabot[bot] avatar depfu[bot] avatar fannheyward avatar gbcreation avatar gou4shi1 avatar greenkeeper[bot] avatar hexh250786313 avatar iamcco avatar jrowlingson avatar kevinhwang91 avatar oblitum avatar pappasam avatar qiqiboy avatar sam-mccall avatar statiolake avatar tomtomjhj avatar unclebill avatar voldikss avatar weirongxu avatar xiyaowong avatar xuanduc987 avatar yatli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coc.nvim's Issues

dart language server

Describe the bug
I configured a custom language server for dart. It is starting up and displaying some auto completions. However it is just displaying auto completions when I type in a new line, not after i have some variable/instance and want to see methods. Then it does not recommend me anything. It seems that it is just auto completing global stuff.

To Reproduce
Configured the dart_language_server like this:

{
  "languageserver": {
    "dart": {
      "command": "dart_language_server",
      "args": [],
      "filetypes": ["dart"],
      "cwd": "./lib",
      "initializationOptions": {},
      "settings": {
        "dart": {
          "validation": {},
          "completion": {}
        }
      }
    }
  }
}

Expected behavior
I get some completion suggestions for instance variables as well like with LanguageClient-Neovim

Screenshots
Here you see it completes global stuff

screen shot 2018-08-05 at 21 48 45

However, it does not find methods of a class instance like it should:
screen shot 2018-08-05 at 21 49 07

Desktop (please complete the following information):

  • Terminal: [e.g. iTerm2]
  • Version: [e.g. v3.2.2]
  • Neovim 0.3.1

Roadmap for v0.1

Coc is working now, but still lots of work ahead to make it better.
Let me know if you have some ideas for it.

  • Works in vim.
  • Airline/Lightline integration
  • Add support for https://github.com/Shougo/neosnippet.vim
  • Binary distribution.
  • Command for edit coc-settings.json.
  • Support lSP feature: document highlight
  • Support lSP feature: document link
  • Support codeLens feature by using vritual text.
  • A coc-emmet extension to help expand emmet in completion menu.
  • Integration of Microsoft/vscode-python

Post hook / install.sh failing

Describe the bug
+PlugInstall / +PlugUpdate is returning exit code 1

To Reproduce
Steps to reproduce the behavior:
follow instructions for installation using Plug

Expected behavior
Post hook should not fail

Desktop (please complete the following information):

  • Nvim: v0.3.1

Can't configure vue-language-server

Hi, I can't make coc to work with vue-language-server
Here the content of my coc-settings.json:

{
    "languageserver" : {
        "vue": {
            "command": "vls",
            "filetypes": ["vue"]
        }
    }
}
$ which vls 
 /usr/bin/vls
$ nvim -v
NVIM v0.3.1

when i open .vue file i have this in :messages

[coc.nvim] Executable vls not found                                                                                                                                                            
[coc.nvim] Service init error: Cannot read property 'catch' of undefined                                                                                                                       
[coc.nvim] service stylelint started                                                                                                                                                           
Press ENTER or type command to continue                                                                                                                                                        

Thank you for your work and help.

EDIT: vls works fine with deoplete and https://github.com/autozimu/LanguageClient-neovim

ESlint error when using vim-fugitives :Gdiff command

Describe the bug
I'm using vim-fugitive plugin, so when i use :Gdiff command in a file that was changed, coc.nvim opens vertical split with the following error

[Info  - 18:04:27] ESLint library loaded from: /home/maz/server/www/homestead/voice-mvp/node_modules/eslint/lib/api.js
[Error - 18:04:37] ESLint stack trace:
[Error - 18:04:37] TypeError: Cannot read property 'CLIEngine' of undefined
    at validate (/home/maz/.config/yarn/global/node_modules/eslint-server/lib/index.js:548:40)
    at resolveSettings.then.settings (/home/maz/.config/yarn/global/node_modules/eslint-server/lib/index.js:490:13)
    at <anonymous>

To Reproduce
Steps to reproduce the behavior:

  1. You need to have vim-fugitive plugin;
  2. Open .js file, remove a line;
  3. Save the file;
  4. Run :Gdiff command;

Expected behavior
When :Gdiff command was executed there shouldn't be any errors from coc.nvim.

Screenshots
I recoreded the issue with asciinema - https://asciinema.org/a/AiTGXMXLPdtVjbLZaDqrXlS1p

Desktop (please complete the following information):

  • Terminal: tilda
  • Version: 1.4.1-1
    tmux 2.7-1
    NVIM v0.3.1
    Kernel: 4.14.57-1-MANJARO x86_64 bits: 64 Desktop: Xfce 4.12.4 Distro: Manjaro Linux

Eslint extension thrown with module not found

Describe the bug
Eslint extension sometimes thrown with module not found

To Reproduce
Steps to reproduce the behavior:

  1. Create global .eslintrc with other module, like eslint-react
  2. Open file without .eslintrc but has eslint module.

Expected behavior
Should not use local eslint when configuration is resolved from global position.

Screenshots
If applicable, add screenshots to help explain your problem.

Enrironment (please complete the following information):

  • Terminal: iTerm2
  • Version: 3.1.0

Add vim-go support?

COC works great for TS, thanks for your work.

Is there any way to add vim-go support? will popup completion items, but there is no autocompletion.

Thanks.

WaitUntil could only be called once

Describe the bug
When saving javascript files, I'm seeing WaitUntil could only be called once several times in messages.

[coc.nvim] WaitUntil could only be called once                                                                                                                                                                                                                                             
[coc.nvim] WaitUntil could only be called once                                                                                                                                                                                                                                             
"foo/bar/App.js" 317L, 10838C [w]                                                                                                                                                                                                                                            
Press ENTER or type command to continue             

To Reproduce
Steps to reproduce the behavior:

  1. Edit javascript files
  2. save, :w

Expected behavior
I expect the file to save without Coc errors

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Terminal: Terminal.app v2.8.2
  • Tmux: v2.7

Remove big bundle like vetur from coc.vim

Is your feature request related to a problem? Please describe.
The bundle vetur takes too much dependencies.

Describe the solution you'd like
Remove from the core, use global or help user install global module instead.

Complete list sources

Describe the bug
Not a bug report or feature request most of a question about the completion list

Given i have used a js/ts builtin type console when popup menu appears i current see a selection from the actual module but also the File how do I make is so that the only options available in the menu are from that actual module and no-other sources.

1__tmux__tmux_

Is Pyls broken currently?

I just updated coc.nvim to the lastest release and it seems pyls does not work (no code completion and linting anymore), it worked previously (last Sunday), I am curious whether extra setting has to be set.

To Reproduce

  1. The bare init.vim,
call plug#begin('~/.config/nvim/plugged')
	Plug 'neoclide/coc.nvim', {'do': 'yarn install'}
call plug#end()
let g:coc_force_debug = 1
  1. the bare python file to be tested.
import sys

prin('coc.nvim')

It seems pyls is not started (I have pyls installed previously via pip3 install -U --user 'python-language-server[all]), because there is no such a message [coc.nvim] service pyls started! or other error messages displayed during opening a python file. For a javascript file, there is an error message [coc.nvim] ESLint: Cannot read property 'CLIEngine' of undefined.

By the way, what would be the quick way to diagnose the issue?

Basic floating window support

Is your feature request related to a problem? Please describe.

  • Use floating window for documentation of completion item preview.
  • Use floating window for showing message of hover action.
  • Use floating window for diagnostic messages, instead of echo them.
  • Use floating window for signature help, isntead of echo.

[NOOB Question] Python Language Server added in the plugin

Thank you for creating the wonderful neovim plugin coc.nvim.

Per this news, https://blogs.msdn.microsoft.com/pythonengineering/2018/07/18/introducing-the-python-language-server/ , Python language server is officially added to vscode.

Thank you very much.

Better provider support for single document

Is your feature request related to a problem? Please describe.

For one document, some provider should be allowed to have many works at the same time.

Including: DefinitionProvider, TypeDefinitionProvider, ImplementationProvider, ReferenceProvider, HoverProvider, DocumentHighlightProvider, DocumentLinkProvider

coc-codeaction-selected throws cannot cannot destructure property `line` of `undefined` or `null`

Describe the bug
<Plug>(coc-codeaction-selected) results in vim trying to reload the file immediately afterwards as well as throwing an error.

To Reproduce
Steps to reproduce the behavior:

  1. Create myfile.js
  2. Add these contents
function myFunction(x) {
  const a = 1
  return x + a
}
  1. Visual select line 2 and run <Plug>(coc-codeaction-selected) through the provided binding.
  2. Select any combination of the next results (1 -> 1 -> for this example)
  3. Results in an error (see below) and vim trying to reload the file from the state before while only changing the current buffer to:
function myFunction(x) {
  const a = newFunction()
  return x + a

        function newFunction() {
                return 1;
        }
}

And throws [coc.nvim] Command error: cannot destructure property line of undefined or null

Expected behavior
Would hope for no error and vim not try and reload the file from system. Ideally refactoring tools would be able to select a name instead of defaulting to newFunction. Would also be cool if the scope was more than constant_scope_1 and the refactoring was placed on the correct level of indentation

Screenshots
screen shot 2018-08-16 at 9 20 24 pm

Desktop (please complete the following information):

  • latest iTerm2, Neovim, all green in checkhealth
  • Version: v0.0.10

Additional context
Attempted in home directory, and in a project directory as well.

No intellisense from tsserver for .tsx files

Describe the bug
The typescript language server works for .ts files, but not .tsx

To Reproduce
Steps to reproduce the behavior:

  1. Open a typescript project that has .tsx files
  2. Open a tsx file
  3. attempt to use intellisense such as getting the properties from a type
type MyType = { bar: string };
function foo(a: MyType) {
    return a.b    <----- expecting autocomplete of "bar" here
}

Expected behavior
Expecting the intellisense to autocomplete based on the type using the ts language server

Actual behavior: the intellisense is just based on other sources such as around
Screenshots

screenshot

Desktop (please complete the following information):

  • Terminal: mintty on Windows 10 (ssh'd into Ubuntu 16.04 machine)
  • Version: nvim v0.3.2-188-g821310930

Additional context
Everything works as expected in .ts files. A tsx file has filetype of typescriptreact. When I do set filetype=typescript, I see two messages from coc.nvim indicating it found tsserver and is using it. But despite that, I still don't get the expected behavior in tsx files.

Here is my init.vim: https://github.com/city41/dotfiles/blob/master/config/.config/nvim/init.vim

Thanks for this great plugin!

Bug: Unable to successfully complete the post-install step.

Hey there! I'd love to give this plugin a try.. BUT, I'm having issues getting the post-install step to complete successfully. Specifically, it's unable to complete the typescript compilation (build step) due to some type errors (in the cases failing for me, both, id and listen aren't members of Buffer).

init.vim entry:

Plug 'neoclide/coc.nvim', { 'do': 'npm install' }

This consistently fails to complete the post-install step (i've tried with both npm install and yarn install).

Versions:

node: 8.11.2
neovim-node-host: 4.1.0
neovim: 0.3.0
macos: 10.13.4
kitty: 0.11.1
tmux: 2.7

Here is the npm debug log output:

0 info it worked if it ends with ok
1 verbose cli [ '/Users/me/.n/bin/node',
1 verbose cli   '/Users/me/.n/bin/npm',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~build: PATH: /Users/me/.n/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/me/.dotfiles/nvim/plugged/coc.nvim/node_modules/.bin:/Users/me/.dotfiles/nvim/plugged/coc.nvim/node_modules/.bin:/Users/me/.config/yarn/link/node_modules/.bin:/Users/me/.dotfiles/nvim/plugged/coc.nvim/node_modules/.bin:/Users/me/.config/yarn/link/node_modules/.bin:/Users/me/.n/libexec/lib/node_modules/npm/bin/node-gyp-bin:/Users/me/.n/lib/node_modules/npm/bin/node-gyp-bin:/Users/me/.n/bin/node_modules/npm/bin/node-gyp-bin:/Users/me/.gem/ruby/2.3.1/bin:/Users/me/.rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/bin:/Users/me/.rubies/ruby-2.3.1/bin:/Users/me/.avn/bin:/Users/me/.rbenv/shims:/Users/me/.avn/bin:/Users/me/.rbenv/shims:/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/me/.avn/bin:/Users/me/.rbenv/shims:./bin:./.bin:./vendor/bundle/bin:/Users/me/.rbenv/bin:/Users/me/bin:/Users/me/.bin:/Users/me/.dotfiles/bin:/Users/me/.rubies:/Users/me/.go/bin:/Users/me/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/local/lib/node_modules:/Users/me/.yarn/bin:/Users/me/.n/bin:/Users/me/.n/lib/node_modules:/Users/me/.config/yarn/global/node_modules/.bin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/imagemagick@6/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/[email protected]/bin:/usr/local/opt/curl/bin:/usr/local/lib/python2.7/site-packages:/Users/me/Library/Python/3.6/lib/python/site-packages:/usr/bin:/usr/sbin:/bin:/sbin:/opt/X11/bin:/Users/me/.fzf/bin
9 verbose lifecycle [email protected]~build: CWD: /Users/me/.dotfiles/nvim/plugged/coc.nvim
10 silly lifecycle [email protected]~build: Args: [ '-c', 'tsc -p tsconfig.json' ]
11 silly lifecycle [email protected]~build: Returned: code: 2  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] build: `tsc -p tsconfig.json`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/Users/me/.n/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:304:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/Users/me/.n/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:925:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/me/.dotfiles/nvim/plugged/coc.nvim
16 verbose Darwin 17.5.0
17 verbose argv "/Users/me/.n/bin/node" "/Users/me/.n/bin/npm" "run" "build"
18 verbose node v8.11.2
19 verbose npm  v6.1.0
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] build: `tsc -p tsconfig.json`
22 error Exit status 2
23 error Failed at the [email protected] build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Here's some of the yarn build stack trace:

src/model/document.ts:98:39 - error TS2339: Property 'id' does not exist on type 'Buffer'.

98     let uri = getUri(fullpath, buffer.id)
                                         ~~


src/model/document.ts:129:35 - error TS2339: Property 'listen' does not exist on type 'Buffer'.

129     let unbindLines = this.buffer.listen('lines', (...args) => {
                                      ~~~~~~


src/model/document.ts:136:36 - error TS2339: Property 'listen' does not exist on type 'Buffer'.

136     let unbindChange = this.buffer.listen('changedtick', (buf:Buffer, tick:number) => {
                                       ~~~~~~


src/model/document.ts:137:15 - error TS2339: Property 'id' does not exist on type 'Buffer'.

137       if (buf.id !== this.buffer.id) return
                  ~~


src/model/document.ts:137:34 - error TS2339: Property 'id' does not exist on type 'Buffer'.

137       if (buf.id !== this.buffer.id) return
                                     ~~


src/model/document.ts:157:13 - error TS2339: Property 'id' does not exist on type 'Buffer'.

157     if (buf.id !== this.buffer.id) return
                ~~


src/model/document.ts:157:32 - error TS2339: Property 'id' does not exist on type 'Buffer'.

157     if (buf.id !== this.buffer.id) return
                                   ~~


src/model/document.ts:225:24 - error TS2339: Property 'id' does not exist on type 'Buffer'.

225     return this.buffer.id
                           ~~


src/model/document.ts:256:35 - error TS2339: Property 'id' does not exist on type 'Buffer'.

256     let buf = buffers.find(b => b.id == bufnr)
                                      ~~


src/workspace.ts:169:44 - error TS2339: Property 'id' does not exist on type 'Buffer'.

169     let document = this.getDocument(buffer.id)
                                               ~~


src/workspace.ts:242:26 - error TS2339: Property 'id' does not exist on type 'Buffer'.

242     const bufnr = buffer.id
                             ~~


src/workspace.ts:358:44 - error TS2339: Property 'id' does not exist on type 'Buffer'.

358     let document = this.getDocument(buffer.id)
                                               ~~


npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] build: `tsc -p tsconfig.json`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2018-06-26T04_37_17_887Z-debug.log
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

checkhealth error:

Describe the bug

health#coc#check
========================================================================
  - OK: Environment check passed
  - ERROR: service could not be initialized
    - ADVICE:
      - You may not have neovim package installed correctly,
      - check out https://github.com/neovim/node-client#debugging--troubleshooting

## Node.js provider (optional)
  - INFO: Node.js: v10.8.0
  - INFO: Neovim node.js host: /Users/fannheyward/.config/yarn/global/node_modules/neovim/bin/cli.js
  - OK: Latest "neovim" npm/yarn package is installed: 4.2.1

Desktop (please complete the following information):

  • Terminal: iTerm2
  • Version: v3.1.7
  • Neovim: v0.3.1

Triggering after '.' or backspaces

Thanks for writing the plugin! I've been testing it out and an initial pain point for me is I lose the autocomplete suggestions if I have to backspace or if I complete a suggestion and want to get suggestions for properties on the object that I just selected.

For example if I'm writing in Javascript and I type "conso" to then select the suggestion of "console" and then type "." to call a method on console the autocomplete suggestions do not pop up. And again, having the suggestion menu disappear if I have to hit backspace to correct a mistake does not feel great.

Maybe there's something in the config that I've missed that can help with this, but otherwise I think it would greatly enhance the experience to keep the autocomplete menu open when backspacing and also having it "re-trigger" when a character is inputted to act on a variable ('.' for Javascript as an example). Thanks again!

Just updated and got the following error coc abnormal exit

Just done a PlugUpdate , all seems fine then a restart of nvim produced thee message
[coc.nvim] Abnormal exit

with the following window contents.

pkg/prelude/bootstrap.js:1
SyntaxError: Invalid or unexpected token
at readPrelude (bootstrap_node.js:133:17)
at bootstrap_node.js:140:22
at bootstrap_node.js:147:8
at startup (bootstrap_node.js:148:6)
at bootstrap_node.js:648:3

Nvim 0.3.1 , OSX 10.13.4

Was working fine before the update

Create integration test

Is your feature request related to a problem? Please describe.

  • Each source should be tested.
  • Each langauge server feature should be tested.
  • Each extension should be tested

Strange behavior when autocompleting strings in js,vue files

Describe the bug
When i create new component with Vue.component('$') ($ - is my cursor), or something like document.querySelector('.test') i'm getting strange output from neovim, i recorded the issue with asciinema

To Reproduce
Steps to reproduce the behavior:

  1. create .js file;
  2. type document.querySelector('.te$'); or Vue.component('$'); $ - is cursor;

Expected behavior
No strange messages from neovim;

Screenshots
https://asciinema.org/a/Qo2NFjLlCoLxKvocH2AkwbXiY

Desktop (please complete the following information):
Terminal: tilda
Version: 1.4.1-1
tmux 2.7-1
NVIM v0.3.1
Kernel: 4.14.57-1-MANJARO x86_64 bits: 64 Desktop: Xfce 4.12.4 Distro: Manjaro Linux
coc settings:

{
    "coc.preferences.triggerAfterInsertEnter": false,
    "eslint.packageManager": "npm",
    "html.filetypes": ["html", "handlebars", "razor", "blade"],
    "eslint.filetypes": ["javascript", "javascript.jsx", "vue"],
    "languageserver": {
        "cquery": {
            "command": "cquery",
            "args": ["--log-file=/tmp/cq.log"],
            "filetypes": ["c"],
            "initializationOptions": {
                "cacheDirectory": "/tmp/cquery"
            }
        }
    }
}

Thaks for the help and nice plugin!

New layout for outline view

Is your feature request related to a problem? Please describe.

Something like tagbar's replace the one of denite coc-symbols.

ESlint crash when open empty js, vue files in /tmp

Describe the bug
When i create new js or vue file in /tmp and open it, i get

[Info  - 12:20:16 PM] ESLint library loaded from: /home/maz/.config/yarn/global/node_modules/eslint/lib/api.js
[Error - 12:20:16 PM] ESLint stack trace:
[Error - 12:20:16 PM] Error: Cannot find module 'babel-eslint'
    at ModuleResolver.resolve (/home/maz/.config/yarn/global/node_modules/eslint/lib/util/module-resolver.js:72:19)
    at loadFromDisk (/home/maz/.config/yarn/global/node_modules/eslint/lib/config/config-file.js:514:42)
    at Object.load (/home/maz/.config/yarn/global/node_modules/eslint/lib/config/config-file.js:564:20)
    at Config.getPersonalConfig (/home/maz/.config/yarn/global/node_modules/eslint/lib/config.js:154:37)
    at Config.getLocalConfigHierarchy (/home/maz/.config/yarn/global/node_modules/eslint/lib/config.js:248:41)
    at Config.getConfigHierarchy (/home/maz/.config/yarn/global/node_modules/eslint/lib/config.js:179:43)
    at Config.getConfigVector (/home/maz/.config/yarn/global/node_modules/eslint/lib/config.js:286:21)
    at Config.getConfig (/home/maz/.config/yarn/global/node_modules/eslint/lib/config.js:329:29)
    at processText (/home/maz/.config/yarn/global/node_modules/eslint/lib/cli-engine.js:162:33)
    at CLIEngine.executeOnText (/home/maz/.config/yarn/global/node_modules/eslint/lib/cli-engine.js:596:17)

To Reproduce

  1. cd /tmp;
  2. nvim test.js;

Expected behavior
There shouldn't be any errors from coc.nvim when i nvim new-file

Screenshots
I recoreded the issue with asciinema - https://asciinema.org/a/mnsHRJBXXyulWuLJ7mFCTEIvE

Desktop (please complete the following information):
Terminal: tilda
Version: 1.4.1-1
tmux 2.7-1
NVIM v0.3.1
Kernel: 4.14.57-1-MANJARO x86_64 bits: 64 Desktop: Xfce 4.12.4 Distro: Manjaro Linux

Bug of snippet parse

Describe the bug

When there is $ in newText, it's always considered as placeholder.

Warning/Error Messages from pyls

import os
  
print('coc.nvim')

The above dummy code will show two warnings:

⚠ import os
  
⚠ print('coc.nvim')

When the cursor on the first one, the message is shown as [pyflakes] 'os' imported but unused [W] on the status, but moving cursor on the second one, there is no message shown (except the previous shown message, which should be cleared after cursor moving), note that using :lnext or :lprevious will show the warning/error correctly.

:lopen shows the second warning:

/tmp/test.py|1 col 1 warning| [pyls] 'os' imported but unused                                                                                  
/tmp/test.py|3 col 18 warning| [pyls W292] W292 no newline at end of file

It seems the second one comes from pydocstyle when the file is checked in the nvim buffer. However, directly running pycodestyle --statistics -qq /tmp/test.py does not show the warning. If I added a new blank line after that line in the nvim buffer, it will eliminate the warning, but pylint will complain the new blank line.

When there is one line in the file,

print('coc.nvim')

The Warning sign is shown, but the warning message is not shown unless using :lfirst or similar commands.

Any thoughts on the issue? Thank you.

By the way, how I could add pylint as default linter if I want to use pylint? I tried coc-setting.json, but I could not figure it out.

Disable TSServer for Flow files

Describe the bug
Attempting to get only Flow working on flow files, as the tsserver is reporting syntax errors specific to ts type annotations vs flow annotations

To Reproduce
Open flow typed files, see tsserver errors.

I've re-added the neovim-languageclient plugin (I had removed it prior to installing Coc) configured the "languageservers" section of the config file and added

"coc.tslint.enable": false,
"coc.tsserver.enable": false,

to my coc config and it still shows tsserver errors in addition to my flow errors.

Expected behavior
I would see flow errors, not tsserver errors

Screenshots
screen shot 2018-08-07 at 12 22 34 pm

Desktop (please complete the following information):

  • Terminal: Terminal.app v2.8.2
  • Tmux: v2.7

Additional context
.vimrc

" camron flanders <[email protected]>
" last update: 08-07-2017:CBF

" feel free to use all or part of my vimrc to learn, modify, use. If used in
" a .vimrc you intend to distribute, please credit appropriately.

set nocompatible                                                    "screw vi, vim's better

"git-plug configuration {{{

" plug-ins list  {{{
if has('nvim')
    if empty(glob('~/.config/nvim/autoload/plug.vim'))
        silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
        autocmd VimEnter * PlugInstall | source $MYVIMRC
    endif

    call plug#begin('~/.config/nvim/bundle')
    "Plug 'benekastah/neomake'
else
    " Load vim-plug automatically, even if it's not installed
    if empty(glob('~/.vim/autoload/plug.vim'))
        silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
        autocmd VimEnter * PlugInstall | source $MYVIMRC
    endif

    call plug#begin('~/.vim/bundle')
endif

if has('nvim') || (v:version >= 800)
    Plug 'neoclide/coc.nvim', {'do': './install.sh'}

    Plug 'autozimu/LanguageClient-neovim', {
        \ 'branch': 'next',
        \ 'do': 'bash install.sh',
        \ }
    Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'
else
    Plug 'scrooloose/syntastic'
endif

Plug 'Raimondi/delimitMate'
Plug 'Shougo/vimproc.vim'
Plug 'joonty/vdebug'

Plug 'itchyny/lightline.vim'

"Plug 'ctrlpvim/ctrlp.vim'
"Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
Plug 'wincent/terminus'

Plug 'kristijanhusak/vim-carbon-now-sh'

Plug 'christoomey/vim-tmux-navigator'
Plug 'AndrewRadev/switch.vim'
Plug 'dzeban/vim-log-syntax'
Plug 'easymotion/vim-easymotion'
Plug 'godlygeek/tabular'
Plug 'jbgutierrez/vim-babel'

Plug 'brooth/far.vim'

Plug 'mattn/emmet-vim'
Plug 'mhinz/vim-signify'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'rhysd/conflict-marker.vim'
Plug 'rking/ag.vim'
Plug 'scrooloose/nerdcommenter'

Plug 'reasonml-editor/vim-reason-plus'

Plug 'terryma/vim-multiple-cursors'
Plug 'tpope/vim-characterize'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-speeddating'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-vinegar'

Plug 'christoomey/vim-conflicted'

Plug 'vim-scripts/YankRing.vim'
Plug 'vim-scripts/vcscommand.vim'
Plug 'wellle/targets.vim'

Plug 'docunext/closetag.vim'

Plug 'vim-scripts/SQLUtilities'
Plug 'vim-scripts/Align'

" syntax/language files
Plug 'sheerun/vim-polyglot'
"Plug 'fatih/vim-go'
Plug 'chrisbra/csv.vim'
Plug '2072/vim-syntax-for-PHP'
Plug 'mxw/vim-jsx'
Plug 'pangloss/vim-javascript'

" color themes
Plug 'altercation/vim-colors-solarized'
Plug 'tomasr/molokai'
Plug 'mhartington/oceanic-next'
"Plug 'marciomazza/vim-brogrammer-theme'


call plug#end()
"}}}
"}}}

if &t_Co > 2
    syntax on
endif

if &t_Co >= 256 || has("termguicolors") || has("gui_running")
    if has("termguicolors")
        set termguicolors
    endif

    if has("gui_running")
        set macligatures
        set anti                                                            "make text pretty
    else
        set mouse=a
    endif

    set background=dark
    let g:oceanic_next_terminal_bold = 1
    let g:oceanic_next_terminal_italic = 1
    colorscheme OceanicNext
endif

if v:version > 703 || v:version == 703 && has('patch541')
  set formatoptions+=j                                              " makes lines join properly, removes extra comment syntax and such
endif

let mapleader = "\<Space>"                                          "set leader to spacebar

set autoread
"set relativenumber                                                  "line numbers show current line and relative offsets
"set number
set noshowmode

set path+=**

"set cursorline                                                      "highlight the current line

" only highlight the cursorline in the active window
augroup CursorLine
  au!
  au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
  au WinLeave * setlocal nocursorline
augroup END

let g:gitgutter_max_signs = 1000                                      "limit how many signs gitgutter calculates, so it doesn't get _too_ slow
let g:gitgutter_realtime = 0
let g:gitgutter_eager = 0

"startup settings {{{

"source a few files {{{

"source macros/matchit.vim

"}}}
"backup/swp settings {{{

set nobackup
set noswapfile
set noundofile

"}}}
"file type settings, on {{{

filetype on
filetype plugin on                                                  "turn on filetype based plugins
                                                                    "filetype indent is also on, in the next section.

"}}}

"}}}
"indention stuff {{{

filetype indent on                                                  "indent based on filetype
set shiftround                                                      "round to a multiple of my tab settings
"set autoindent                                                     "indent, duh
"set smartindent                                                    "we'll autoindent (with intelligence), bitches
"set cin                                                            "auto c-indenting

"}}}
"completion settings {{{

"set complete+=k                                                     "built in plus my defined, below
"set showfulltag                                                     "show me args for tag
"set tags+=.tags,tags,~/.vimtags;

"}}}
"stuff {{{

let xml_use_xhtml = 1                                               "close html as xhtml, properly.
set encoding=utf-8
set scrolloff=3
set nowrap
set hidden                                                          "let me have hidden buffers
set showmatch                                                       "show me where the matching bracket is
set ttyfast
set ruler                                                           "show me the ruler!
set rulerformat=%35(%5l,%-6(%c%V%)\ %5L\ %P%)                       "my ruler shows: line/vColumn/total/pos
set guifont=Fantasque\ Sans\ Mono:h15                               "use guifont=* to open font picker
set history=1000                                                    "keep last 1000 commands
set undolevels=1000                                                 "use many muchos levels of undo
set sc                                                              "show commands as I type
set visualbell                                                      "a quiet vim is a happy vim
set backspace=indent,eol,start                                      "allow backspacing over everything
set modeline
set shortmess=atITA                                                 "I don't want long messages
set nostartofline                                                   "keep my cursor where it was
set fen                                                             "let me fold things
set foldmethod=indent                                               "and fold on indents
set foldlevelstart=99
set foldnestmax=10                                                  "10 nested fold max

set lazyredraw                                                      "don't update the screen during macros

set list                                                            "show chars
set listchars=tab:▸\ ,trail:·,extends:»,nbsp:·                      "how to show chars

nnoremap <leader>z za

"}}}
"wildmenu {{{

set wildmenu                                                        "go wild!
set wildmode=longest,list:longest                                      "tame the wildness, using unix-style match
set wildignore=*.o,*.obj,*.bak,*.exe,*.pyc,*.DS_Store,*.db,*/.git/*,*/tmp/*,*.swp          "don't show me crap I don't want

set completeopt=preview,menuone
"}}}
"gui options {{{

if has('gui_running')
    set guitablabel=%t                                                  "tabs display file name

    "kick it old school, no gui needed.
    set guioptions-=T                                                   "kill toolbar
    set guioptions-=m                                                   "kill menu
    set guioptions-=r                                                   "kill right scrollbar
    set guioptions-=l                                                   "kill left scrollbar
    set guioptions-=L                                                   "kill left scrollbar with multiple buffers
endif

"}}}
"cursor options {{{

set gcr=a:blinkwait500-blinkon1000-blinkoff150                      "tune the blinking of the cursor
set gcr=i:hor10                                                     "underline cursor. not too thick not too thin. goldielocks style
set gcr=v:block                                                     "selecting should cover the text

"}}}
"tab stuff {{{

set expandtab                                                       "expand tabs to spaces, when not an indent
set smarttab                                                        "let's be smart about our tabs
set shiftwidth=4                                                    "make tabs 4 spaces
set softtabstop=4                                                   "softtab value, 4 spaces
set tabstop=4                                                       "keep default for softtab compat.

"}}}
"search / diff {{{

set hlsearch                                                        "highlight what I find
set incsearch                                                       "show matches as I type
set ignorecase smartcase                                            "ignore case unless I type in multi-case

set laststatus=2

"}}}
"plugin settings {{{

"easymotion {{{
"move to line
map <Leader>L <Plug>(easymotion-bd-jk)
nmap <Leader>L <Plug>(easymotion-overwin-line)

" Move to word
map  <Leader>W <Plug>(easymotion-bd-w)
nmap <Leader>W <Plug>(easymotion-overwin-w)

"}}}

"multi cursor
"let g:multi_cursor_start_key='<C-m>'

"surround {{{

autocmd FileType php let b:surround_45 = "<?php \r ?>"
autocmd FileType php let b:surround_95 = "<?= \r ?>"

"}}}

"fzf settings {{{

nnoremap <leader>f :Files<CR>
nnoremap <leader>d :Buffers<CR>
nnoremap <leader>t :Tags<CR>

"[Buffers] Jump to the existing window if possible
let g:fzf_buffers_jump = 1

" Customize fzf colors to match your color scheme
let g:fzf_colors =
  \ { 'fg':      ['fg', 'Normal'],
  \ 'bg':      ['bg', 'Normal'],
  \ 'hl':      ['fg', 'Comment'],
  \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
  \ 'hl+':     ['fg', 'Statement'],
  \ 'info':    ['fg', 'PreProc'],
  \ 'border':  ['fg', 'Ignore'],
  \ 'prompt':  ['fg', 'Conditional'],
  \ 'pointer': ['fg', 'Exception'],
  \ 'marker':  ['fg', 'Keyword'],
  \ 'spinner': ['fg', 'Label'],
  \ 'header':  ['fg', 'Comment'] }

"}}}

"ctrlP settings {{{
"let g:ctrlp_use_caching = 0

"nnoremap <leader>f :CtrlPMixed<CR>

"if executable('rg')
	"set grepprg=rg\ --color=never
	"let g:ctrlp_user_command = 'rg %s --files --color=never --glob ""'
	"let g:ctrlp_use_caching = 0
"else
	"if executable('ag')
		"set grepprg=ag\ --nogroup\ --nocolor
		"let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
	"endif
"endif
"}}}

"syntastic settings {{{
"set statusline=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*

"let g:syntastic_aggregate_errors = 1
"let g:syntastic_always_populate_loc_list = 0
"let g:syntastic_auto_loc_list = 1
"let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0

"let g:syntastic_javascript_checkers = ['flow', 'eslint',]
"let g:syntastic_scss_checkers = ['sassc']
"let g:syntastic_php_checkers = ['php']


"augroup javascript_lint_group
    "autocmd!
    "autocmd FileType javascript call CBFSetEsLintPath()
    "autocmd FileType javascript.jsx call CBFSetEsLintPath()
"augroup END

"function! CBFSetEsLintPath()
    "" Point syntastic checker at locally installed `eslint` if it exists.
    "if executable('node_modules/.bin/eslint')
        "let b:syntastic_javascript_eslint_exec = 'node_modules/.bin/eslint'
        "let g:syntastic_javascript_eslint_args = ['--fix']
    "endif
"endfunction


"function! SyntasticCheckHook(error)
    "checktime
"endfunction
"}}}

"lightline {{{
let g:lightline = {
\   'component': {
\       'lineinfo': "%3l:%-2v/%{line('$')}"
\   }
\ }
"}}}

"YankRing {{{
let g:yankring_history_dir = "/tmp"
"}}}

"JSX {{{
let g:jsx_ext_required = 0

"}}}

"VDebug {{{
if !exists('g:vdebug_options')
    let g:vdebug_options = {}
endif

"let g:vdebug_options["break_on_open"] = 0
let g:vdebug_options["watch_window_height"]=45
let g:vdebug_options["status_window_height"]=5
" let g:vdebug_options["continuous_mode"]=1
let g:vdebug_options["path_maps"] = {
\    "/vagrant": "/Users/camron/src/lodgetools/inntender",
\    "/code": "/Users/camron/src/lodgetools/inntender",
\   "/var/www/html": "/Users/camron/src/lodgetools/channel_manager"
\}
"}}}


"Ultisnips {{{
"let g:UltiSnipsExpandTrigger="<c-j>"
"let g:UltiSnipsJumpBackwardTrigger="<c-z>"

"}}}

"YCM {{{
"let g:ycm_add_preview_to_completeopt = 1
"let g:ycm_autoclose_preview_window_after_completion = 1

"if !exists('g:ycm_semantic_triggers')
    "let g:ycm_semantic_triggers = {}
"endif

"}}}

"CoC configuration {{{

imap <silent> <C-x><C-u> <Plug>(coc-complete-custom)
autocmd CursorHoldI,CursorMovedI * silent! call CocAction('showSignatureHelp')


"}}}

"LanguageClient {{{
"let g:LanguageClient_autoStart = 1
"let g:LanguageClient_autoStop = 1

"let g:LanguageClient_serverCommands = {
    "\ 'reason': ['ocaml-language-server', '--stdio'],
    "\ 'ocaml': ['ocaml-language-server', '--stdio'],
    "\ 'javascript': ['flow-language-server', '--stdio'],
    "\ 'javascript.jsx': ['flow-language-server', '--stdio'],
    "\ 'dockerfile': ['docker-langserver', '--stdio'],
    "\ 'python': ['pyls'],
    "\ }

"nnoremap <silent> <leader>ld :call LanguageClient_textDocument_definition()<cr>
"nnoremap <silent> <leader>lf :call LanguageClient_textDocument_formatting()<cr>
"nnoremap <silent> <leader>lr :call LanguageClient_textDocument_rename()<cr>
"nnoremap <silent> <cr> :call LanguageClient_textDocument_hover()<cr>

"set omnifunc=LanguageClient#complete

"}}}

"Vim-Reason {{{

"}}}

"Ale / linting {{{

let g:javascript_plugin_flow = 1

nmap <silent> <leader>k <Plug>(ale_previous_wrap)
nmap <silent> <leader>j <Plug>(ale_next_wrap)

let g:ale_linters = {}
let g:ale_linters.javascript = ['flow', 'eslint',]
let g:ale_linters.php = ['php']
let g:ale_linters.python = ['flake8']
let g:ale_linters.scss = ['stylelint']

let g:ale_fix_on_save = 1
let g:ale_fixers = {}
let g:ale_fixers.javascript = ['eslint']
let g:ale_fixers.scss = ['stylelint']

let g:ale_history_log_output = 1

"}}}

"Undo Tree {{{

"nnoremap <leader>u :GundoToggle<CR>
"let g:gundo_right = 1

"}}}

"Explore map & settings {{{
nnoremap <leader>e :Ex<CR>

let g:netrw_liststyle=3
autocmd FileType netrw setl bufhidden=delete        " this will remove the explore buffers when hidden, so we can quit without bd! each one

"}}}

"TagBar {{{

"nnoremap <leader>t  :TagbarToggle<CR>

""}}}

"PHP CS Fixer {{{

let g:php_cs_fixer_level = "symfony"
let g:php_cs_fixer_config_file = '.php_cs'

""}}}

"NERDCommenter {{{

let NERDShutUp  =   1                                               "don't complain to me
map <leader>cc <plug>NERDCommenterToggle


"}}}

" prettier {{{
let g:prettier#quickfix_auto_focus = 0
let g:prettier#autoformat = 0
let g:prettier#config#print_width = 80
let g:prettier#config#tab_width = 4
let g:prettier#config#use_tabs = 'false'
let g:prettier#config#semi = 'false'
let g:prettier#config#single_quote = 'true'
let g:prettier#config#bracket_spacing = 'true'
let g:prettier#config#jsx_bracket_same_line = 'false'
let g:prettier#config#arrow_parens = 'always'
let g:prettier#config#trailing_comma = 'es5'
let g:prettier#config#parser = 'babylon'
let g:prettier#config#prose_wrap = 'preserve'

" ignore the above defaults and use file in the project, if found
let g:prettier#config#config_precedence = 'prefer-file'
"autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue PrettierAsync
"}}}

" ctrl space options {{{

"let g:CtrlSpaceSymbols = { "Vis": "ϟ"}
"nnoremap <silent><leader>f :CtrlSpace O<cr>
"nnoremap <silent><leader>b :CtrlSpace H<cr>

"}}}

" Use ag for search
if executable('ag')
  let g:CtrlSpaceGlobCommand = 'ag -l --nocolor -g ""'
endif

"}}}

"Gist options {{{
let g:gist_clip_command = 'pbcopy'
let g:gist_detect_filetype = 1
let g:gist_open_browser_after_post = 1

let g:github_user = "camflan"
let g:github_token = "897b6a6109e0de41cdb13f391ba62ea2"

"}}}

"}}}
"omnicomplete setup {{{

"autocmd FileType python set omnifunc=pythoncomplete#Complete
"autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
"autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
"autocmd FileType css set omnifunc=csscomplete#CompleteCSS
"autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd BufNewFile,BufRead *.scss set ft=scss.css

nnoremap <leader>g :AgBuffer

"}}}
"abbreviations {{{

" Correct Typos {{{

" English {{{
iab beacuse    because
iab becuase    because
iab acn        can
iab cna        can
iab centre     center
iab chnage     change
iab chnages    changes
iab chnaged    changed
iab chnagelog  changelog
iab Chnage     Change
iab Chnages    Changes
iab ChnageLog  ChangeLog
iab debain     debian
iab Debain     Debian
iab defualt    default
iab Defualt    Default
iab differnt   different
iab diffrent   different
iab emial      email
iab Emial      Email
iab figth      fight
iab figther    fighter
iab fro        for
iab fucntion   function
iab ahve       have
iab homepgae   homepage
iab logifle    logfile
iab lokk       look
iab lokking    looking
iab mial       mail
iab Mial       Mail
iab miantainer maintainer
iab amke       make
iab mroe       more
iab nwe        new
iab recieve    receive
iab recieved   received
iab erturn     return
iab retrun     return
iab retunr     return
iab seperate   separate
iab shoudl     should
iab soem       some
iab taht       that
iab thta       that
iab teh        the
iab tehy       they
iab truely     truly
iab waht       what
iab wiht       with
iab whic       which
iab whihc      which
iab yuo        you
iab databse    database
iab versnio    version
iab obnsolete  obsolete
iab flase      false
iab recrusive  recursive
iab Recrusive  Recursive
"}}}
" Days of week {{{
iab monday     Monday
iab tuesday    Tuesday
iab wednesday  Wednesday
iab thursday   Thursday
iab friday     Friday
iab saturday   Saturday
iab sunday     Sunday
"}}}

"}}}

"}}}
"key mappings {{{
"unmaps {{{

"}}}
"plugin mappings {{{

let g:user_emmet_leader_key = '<C-Y>'

"}}}
".vimrc editing maps {{{

"makes it easy to edit/reload vimrc for tweaks. I like to tweak.
:nmap <leader>s :so $MYVIMRC<CR>
:nmap <leader>v :vsp $MYVIMRC<CR>

"}}}
"mappings to swap 2 words {{{

" Swap word with next word
nmap <silent> gw    "_yiw:s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<cr>

"}}}
"newlines while typing {{{

" here are some commands for new lines, quickly while in insert mode
"imap <D-CR> <Esc>o
"imap <D-S-CR> <Esc>A;<CR>
"imap <D-S-A> <Esc>A:<CR>

"}}}
"buffer navigation nmaps {{{

map <C-h> <C-W>h
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-l> <C-W>l

"}}}
"general maps {{{

"make vim use correct regexes
nnoremap / /\v
vnoremap / /\v

nnoremap <leader>l :set list!<cr>

" Speed up scrolling of the viewport slightly
"nnoremap <C-e> 2<C-e>
"nnoremap <C-y> 2<C-y>

"changes :command to ;command making it faster
nnoremap ; :
vnoremap ; :

"make this the way it should work by default
noremap Y y$

"toggle wrap
nmap <leader>w :set nowrap!<CR>

"when wrapping, wrap text to the correct indentation
set breakindent
set showbreak=↪

" make jj esc, in insert mode.
inoremap jj <C-[>

" disable esc key to stop using it
inoremap <esc> <nop>

" easily, temporarily disable search highlighting"
nmap <silent> <leader>/ :silent :nohlsearch<CR>

" sudo write to files that weren't opened with sudo originally!
cmap w!! w !sudo tee % >/dev/null

"}}}
"expansions {{{

"file directory
imap <leader>fd    <C-R>=expand("%:p:h")<CR>
" present working dir
imap <leader>pwd   <C-R>=getcwd()<CR>

"}}}

"}}}

"autocmd {{{
"remove trailling whitespace
autocmd FileType c,cpp,java,php autocmd BufWritePre <buffer> %s/\s\+$//e
"}}}

"functions {{{

"python refactoring method {{{
function! PythonExtractMethod() range
let name = inputdialog("Name of new method: ")
let args = inputdialog("Argument list: ")
'<
exe "normal O\<cr>def " . name ."(" . args . "):\<esc>"
'>
exe "normal o#return \<cr>\<esc>"
normal >'<
endfunction
"}}}
"insert/swap iScript debug statements {{{
function! Logging(level)
    let base_string = 'debug.log("' . a:level . '", "'
    let curr_line = getline('.')

    let match = match(curr_line, "debug")

    if match == -1
        execute "normal i" . base_string
    else
        for this_level in ['CRITICAL', 'ERROR', 'WARNING', 'NOTIFY', 'INFO', 'DEBUG']
            let new_string = substitute(curr_line, '"' . this_level . '"', '"' . a:level . '"', "")
            if new_string != curr_line
                execute "normal ddO" . new_string
                break
            endif
        endfor
    endif
endfunction
"}}}
" Refactor function to easily find/replace a dictionary of words with new words {{{
" Refactor the given lines using a dictionary
" replacing all occurences of each key in the dictionary with its value
function! Refactor(dict) range
  execute a:firstline . ',' . a:lastline .  's/\C\<\%(' . join(keys(a:dict),'\|'). '\)\>/\='.string(a:dict).'[submatch(0)]/ge'
endfunction

command! -range=% -nargs=1 Refactor :<line1>,<line2>call Refactor(<args>)
"}}}

"iScript imaps {{{

"these will input the beginning of a debug.log statement for iScriptDebug
imap \dc <Esc>:call Logging("CRITICAL")<CR>a
imap \de <Esc>:call Logging("ERROR")<CR>a
imap \dw <Esc>:call Logging("WARNING")<CR>a
imap \dn <Esc>:call Logging("NOTIFY")<CR>a
imap \di <Esc>:call Logging("INFO")<CR>a
imap \dd <Esc>:call Logging("DEBUG")<CR>a

"this will swap the current debug level for a new one
nmap \dc :call Logging("CRITICAL")<CR>
nmap \de :call Logging("ERROR")<CR>
nmap \dw :call Logging("WARNING")<CR>
nmap \dn :call Logging("NOTIFY")<CR>
nmap \di :call Logging("INFO")<CR>
nmap \dd :call Logging("DEBUG")<CR>

"}}}

let $PATH=$PATH . ':' . expand('~/.composer/vendor/bin')

" vim:foldmethod=marker:foldlevel=1:ft=vim:

cot-settings.json

{
    "coc.preferences.autoTrigger": "trigger",
    "coc.preferences.timeout": 300,
    "coc.tslint.enable": false,
    "coc.tsserver.enable": false,
    "languageserver": {
        "reason": {
            "command": "ocaml-language-server",
            "args": ["start", "--stdio"],
            "filetypes": ["reason"],
            "initializationOptions": {},
            "settings": {}
        },
        "flow": {
            "command": "flow-language-server",
            "args": ["--stdio"],
            "filetypes": ["javascript", "javascript.jsx"],
            "initializationOptions": {},
            "settings": {}
        }
    }
}

Completion with RLS doesn't work

Describe the bug
I am trying to get the rust language server to work.
In case it helps there is a vscode plugin for it as well

To Reproduce
coc-settings.json:

    "rls": {
      "command": "rustup",
      "args": ["run", "nightly", "rls"],
      "filetypes": ["rust"],
      "settings": {},
      "enable": true

Note: without the empty settings it won't even start...

Additional context
rls logs:

ERROR 2018-08-29T02:00:47Z: rls::actions: failed to fetch project model, using fallback: unable to get packages from source
ERROR 2018-08-29T02:00:49Z: rls::actions: failed to fetch project model, using fallback: unable to get packages from source
ERROR 2018-08-29T02:00:50Z: rls::server: dispatch error, Error { code: InvalidParams, message: "invalid value: integer `0`, expected value between 1 and 2 (inclusive)", data: None }
[3  - 04:00:50] Request textDocument/completion failed.
  Message: invalid value: integer `0`, expected value between 1 and 2 (inclusive)
  Code: -32602 

autocomplete trigger when enter new line

Describe the bug

the autocomplete menu popup after enter new line.

To Reproduce
Steps to reproduce the behavior:

test test $

$ is the cursor in normal mode, when i type o enter a new line.

test test
$

the autocomplete popup.

coc.nvim conflict with vim-go

Describe the bug
coc conflicts with vim-go completion.

To Reproduce

  1. minimal init.vim
call plug#begin()
Plug 'neoclide/coc.nvim', {'do': 'yarn install'}
Plug 'fatih/vim-go', { 'for': 'go' }
call plug#end()
  1. reproduce, nvim main.go:
package main

import "log"

func main() {

}
  • A: move L6, input log. will trigger completion popup, and completion items is correct. It's OK.
  • B: move L6, save action first, then input log. also trigger popup, but with wrong items.
  • C: CocRestart will fix this.

Expected behavior
A

Screenshots
no

Desktop (please complete the following information):

  • Terminal: iTerm2 3.2
  • Neovim 0.3.1
  • Coc: 0.0.11

Additional context
Add any other context about the problem here.

[coc.nvim] Initialize failed, try :UpdateRemotePlugins and restart

Tried everything, does want to work:

Minimal init.vim

if &compatible
 set nocompatible
endif
" Add the dein installation directory into runtimepath
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim

if dein#load_state('~/.cache/dein')
 call dein#begin('~/.cache/dein')

 call dein#add('~/.cache/dein')
 call dein#add('Shougo/deoplete.nvim')
 if !has('nvim')
   call dein#add('roxma/nvim-yarp')
   call dein#add('roxma/vim-hug-neovim-rpc')
 endif

 call dein#add('neoclide/coc.nvim', {
   \ 'build': 'npm install'
   \})

 call dein#end()
 call dein#save_state()
endif

filetype plugin indent on
syntax enable

UpdateRemote

remote/host: node host registered plugins ['coc.nvim']
remote/host: python3 host registered plugins ['deoplete']
remote/host: generated rplugin manifest: /Users/bogdan/.local/share/nvim/rplugin.vim

Improve auto trigger completion

Describe the solution you'd like

Add triggerAfterInsertEnter and triggerAfterCompletionSelected, make them defaults to true.

[coc.nvim] Initialize failed, Cannot create property 'uri' on number '0'

Describe the bug
When I open vim, it jump a error

[coc.nvim] Initialize failed, Cannot create property 'uri' on number '0'

To Reproduce
Steps to reproduce the behavior:

1. Install npm, install yarn
2. vim && :PlugInstall 
3. auto install vim-node-rpc, exit vim
4. vim enter

Expected behavior
work fine.

Desktop (please complete the following information):

  • Terminal: [xshell]
  • Version: [6]
  • vim 8.1-1-229

stylelint-vscode module too big

Is your feature request related to a problem? Please describe.

stylelint-vscode module have some blowed up dependencies.

Describe the solution you'd like

separate it from core.

[coc.nvim] uncaught exception: Error: read ENOTCONN

Describe the bug
Right after neovim launched, a vertically split pane will show some error info about coc.nvim as shown below:

[coc.nvim] uncaught exception: Error: read ENOTCONN
    at _errnoException (util.js:992:11)
    at Socket._read (net.js:493:20)
    at Socket.Readable.read (_stream_readable.js:442:10)
    at resume_ (_stream_readable.js:822:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3

To Reproduce
Steps to reproduce the behavior:

  1. Install coc.nvim according to its official installation instructions, but without {'do', 'yarn install --prod=false'} since it failed :P
  2. Manually run yarn install --prod=false in coc.nvim directory
  3. Two warnings show up
  4. Launch neovim
  5. Error pane shows up

Expected behavior
No error occurs.

Screenshots
1
2

Desktop (please complete the following information):

  • OS: Windows 10 Pro 1803
  • Neovim: 0.3.0
  • node.js: v8.11.3
  • yarn: 1.7.0

Additional context
N/A

Ultisnips source

Seems as snippets from Ultisnips doesn't work. Ultisnips works fine but no snippets are included in the completion list.

Swallows first letter

Thanks for the awesome plugin!

However I have a problem that makes it very hard to work with.
Right now whenever I start typing something the first letter of whatever I type disappears.
So for example, I go to insert mode, type the letter a. The a goes away and the autocompletion opens. Any subsequent typing while the completion window is open works fine.

It seems to me that the opening of the autocompletion (not sure what to call it, the window that has all the choices), removes whatever you typed.

Can't uninstall coc

I tried to remove it by PlugClean but it didn't work, also I remove .vim/plugged directory but without results. So how can I remove it ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.