
Coc.nvim – Intellisense Engine for Vim8 and Neovim - ducaale
https://github.com/neoclide/coc.nvim
======
dmitryminkovsky
Language servers are very exciting for me. This past summer I finally
installed ALE [0] and it drastically improved my experience and code quality
in JS. The live in-editor linting with eslint and formatting with prettier is
awesome (and these aren’t even language servers, ALE just uses them as
“fixers” and “linters”). So many people denigrade these things as “crutches”
for bad programming languages or underdeveloped skills, but I don’t know how
you can beat getting live feedback as you type. We are mere mortals! If you
don’t have something like ALE installed and you use Vim, you won’t regret the
time spent getting it up and running.

[0] [https://github.com/w0rp/ale](https://github.com/w0rp/ale)

~~~
userbinator
_So many people denigrade these things as “crutches” for bad programming
languages or underdeveloped skills, but I don’t know how you can beat getting
live feedback as you type._

As someone who turns off autocomplete and other features when forced to use an
IDE, and otherwise works entirely with code in a plain text editor (sometimes
Vim, sometimes Notepad --- and sometimes just good old pencil-and-paper), I
can tell you that "live feedback" is a _distraction_. It interrupts the
thinking process like a backseat driver.

~~~
nswest23
I code exclusively with pen and paper. Pencils are for people that make
mistakes.

------
enitihas
One major advantage of Jetbrains products which I realised after getting a
corporate job is I don't need almost any plugins and the experience out of the
box is better than anything offered by vim or emacs(granted this is
subjective). One major advantage is I don't need to worry about licenses of
plugins or having a trust relationship with plugins, which is very essential
as I don't want something like the kite episode to happen on my PC. (The kite
episode was a company buying some open source plugins for atom and sublime and
adding invasive telemetry). If you use jetbrains products, you need to trust
only one entity. When using random plugins you are always in the danger of
some malicious plugin sending your IP to some random server (rare, but worth
keeping in mind.

~~~
ilovecaching
Let me give you a counterpoint. I have worked at two companies in FAANG now,
and I've also worked on the Linux kernel on ethernet drivers. None of those
situations allowed the use of Jetbrains. In fact, I've never worked for a
place or on a product that didn't allow for vim.

Sometimes you will also be required to work from a remote server. I'm not
talking about to fiddle bits, I'm talking about real development.

There is also a lot of downsides to not working from the terminal. Vim users
are consistently better interviewers because they spend more time interacting
at the system level. There are a lot of disadvantages to working with an IDE
that turns valuable knowledge into a series of black box buttons.

~~~
ma2rten
Google allows both Vim and Jetbrains, but Jetbrains is considered to
officially supported while vim is just supported by 20% time.

~~~
throwawaytoday5
Could you explain what you mean by Vim being support 20% of the time?

~~~
ma2rten
Google employees can use 20% of their time to work on projects of their
choosing.

------
danilocesar
/me looking for comments/comparisons about this from people used with
YouCompleteMe, which is, IMO, the best completer for vim today.

~~~
wincent
I used to use YouCompleteMe with Vim, then switched to deoplete on Neovim,
because deoplete was easier to extend without having to maintain a fork and
the user experience was pretty much the same.

I briefly tried out Coc but didn't find it to deliver anything compelling to
make me switch away from a relatively fine-tuned deoplete-powered set-up
(along with UltiSnips, LanguageClient-neovim, and javascript-typescript-stdio
etc). I like the fact that there is competition though and an LSP ecosystem
that's getting more and more robust all the time. We finally have multiple
high-quality options to bring IDE-like features to Vim.

~~~
chemzqm
Let me tell you why coc.nvim is created.

I used to use deoplete.nvim, LanguageClient-neovim with javascript-typescript-
stdio, but they easily broken lots of time everyday and debug the problems is
also quite challenging. So I made it to be able to load fork of vscode
extension, and coc-tsserver implemented more than 95% features that vscode
could provide. It's not easier to switch vim plugins, consider come back when
you would like to try out some new features.

------
ttiurani
I switched my neovim setup from ale and deoplete to coc.nvim a few months ago,
and am thrilled about finally being able to write also all my java with
neovim. There are a few rough edges, and of course java features are miles
behind IntelliJ, but the benefit of being able to use one editor to rule them
all, is a massive productivity boost. Don't think I'll switch back. Also
Typescript with a language server is working really well.

~~~
jeremija
I was a long time YCM user but it seemed to slow down my editor, then I
switched to ALE and it was much better. I'm curious to see what improvements
CoC brings to the table. From the screencast it looks like it can
automatically add import statements to TypeScript projects which would be a
huge productivity boost for me!

~~~
daliusd
Try nvim, deoplete and nvim-typescript. Maybe try importjs as well.

------
swebs
From what I understand, Intellisense is Microsoft's branding for their
autocomplete engine. So is this Intellisense™ or a completely separate engine?

~~~
oneplane
I'm also not sure why people keep calling autocomplete "intellisense". Using a
brand name in place of the actual name of the feature seems like going a step
back to me. We got the correct words, might as well use them.

~~~
sjellis
"Using a brand name in place of the actual name of the feature seems like
going a step back to me."

It's a sign of massive success, too. Like "Hoover" now being a synonym for
vacuum cleaner.

~~~
oneplane
Well, yes and no. Hoover means nothing here... That is why brand names as
specific names seems like an issue to me; a lot of brands don't exist
worldwide.

------
todd3834
I’m still waiting for a day where I can write Swift and Kotlin with VIM and
still be productive. Maybe this will let me do that but after the last few
tries I’m not going to get my hopes up.

~~~
greysonp
I recommend installing the VIM plugin for IntelliJ. It's pretty good and
supports most things in .vimrc's. Best of both worlds, really.

~~~
todd3834
Does it support vim plugins?

------
cletus
I'm honestly confused at how much effort people spend on .vimrc and .emacs
files to get poor versions of narrow slices of functionality that comes out of
the box with the most basic of IDEs.

Want to dev in Rust? Get IntelliJ Community Edition (free) with the Rust
plugin. I'm sure VSCode can do this too (personally I prefer Jetbrains
products and have been using them for 15+ years).

You can of course use a tty-based text editor over an ssh connection and I use
that for Linux servers I connect to of course. I just don't write code that
way and don't know why someone would.

~~~
asaddhamani
I know right? I don't get all the hype, honestly. I've been using JetBrains
products too, and they blow everything else out of the water. Even VSCode is
good (though nowhere near as good as JetBrains, atleast in terms of
Intellisense).

I tried looking into Vim / NeoVim a few times to understand what all the hype
was about.

I had to install:

* Fugitive * Nerd tree * Airline * YouCompleteMe * Emmet

And I don't remember how many other plugins just to get a halfway decent
editor experience. I get using Vim if you're SSHed to a server, but otherwise
it feels like intentionally handicapping yourself. In case you find yourself
needing keyboard based navigation, I'm pretty sure Command+P is much better
than anything Vim could offer for quickly opening files, and there's a Vim
plugin for VSCode for moving around in files.

I will probably get heavily downvoted for saying this, I know. But if someone
feels like enlightening me instead, please do so.

~~~
kitotik
“I tried looking into Vim / NeoVim a few times to understand what all the hype
was about.”

Is vim really getting hyped anywhere? If so that must be one of the longest
running hype trains in tech.

~~~
sophacles
It's there more or less all the time in the background. Every 2-3 years you'll
see a resurgence in "Why I vim" posts. It's also part of the shell world.
Usually it's tied to new waves of tooling...

* A new language or paradigm comes out

* Clicky tool makers (IDE, management software, etc) can't really keep up with the rapid change, and they aren't sure if this will catch on, so they don't make great tools for it. People have to use the cli tools to take advantage of all the features.

* Since folks are already in the shell, they want to make their environment better, so new folks are introduced to shell stack, and new customization options for tmux or shell or vim come out.

* Eventually if the thing catches on Clicky tool makers catch up and the shell scene quiets down a bit - people abandon shell stack for clicky tools if that's their preference, and the new shell converts integrate with the broader "shell folks community". (That community is always there, just quietly using the relatively stable interfaces in the background).

* At some point a new language or paradigm comes out...

------
chmln
As a heavy user of this plugin on a daily basis, it has made me so much more
productive. Recently it also got support for floating windows added in neovim,
inching even closer to the quality of completions in VSCode.

------
mailslot
I’m going to get heavily downvoted for this, I’m sure, but... If I find myself
needing, or even using, code completion, I’ve fucked up my implementation. My
interfaces are not intuitive nor consistent... or it’s just glue lacking
adequate abstraction.

I strongly suggest all developers disable completion & tag jumping, not
because I’m an elitist, but because it forces you to write better code. Not a
troll. I’m serious.

On projects I’ve worked on that started with Intellisense, they quickly
evolved into being unmaintainable without it. It’s an asset to skilled hands,
but a debilitating crutch for the novice.

It’s like never operating a vehicle without a GPS. You never develop certain
types of skills.

~~~
greysonp
I get what you're trying to say, but I feel like it also implies that you've
written everything you're using. I'm an Android developer, and I've worked on
some huge java code bases. Not only do I rely on autocomplete to
discover/remember various parts of the Android SDK, but things like "go to
declaration" or "find usages" are incredibly useful for navigating large code
bases. Not to mention Java isn't known for being the most terse language, so
saving some keystrokes helps too :)

~~~
mirkules
Personally, it slows me down _considerably_ without intellisense, even when I
know the entire codebase. If you have overloaded methods, for example, just
remembering the order of the parameters is impossible without intellisense.

This makes me believe that either I have a really poor memory by not being
able to memorize thousands of method names, their parameters and orders or
other devs have a really, really good memory.

~~~
drenvuk
You're not alone. I strictly use kwargs in my functions because I can't be
arsed to remember the order of arguments in addition to the structure of the
rest of the program. It's more work but I need any simplification or hint I
can get for my feeble mind. And I don't even use Java.

------
n8henrie
I tried to get this set up for rust / go / python a few weeks ago and found it
surprisingly cumbersome, requiring a fair number of other plugins. I
ultimately stuck with ale / completor which support async LSP linting and
async (non-LSP) completion respectively, and which I found far simpler to set
up.

------
wodenokoto
I have only dabbled with intelligense and language servers, but my out-of-the-
box experience has been disappointing when working with pandas and I’m
wondering if anyone on HN can talk about whose fault it is and what can be
done to improve it.

Modern pandas is supposed to be written along the lines of

    
    
        import pandas as pd 
    
        df = pd.read_csv().transform().agg().pipe() #etc, etc
    

But I am very disappointing in the suggestions I get after the dots in the
chain, as well as the parameters inside the functions, when trying out jedi
and other language servers in different editors (even ipython is quite
disappointing to me)

------
corndoge
No C support :(

I tried YouCompleteMe but on a 500k line codebase, as well as it works, it's
just too slow to stay below the constant annoyance threshold. Would like to
play around with adding C support and see how this performs

~~~
IlGrigiore
This is not true. It has C/C++/Object C support by using the language server
for the language.

[https://github.com/neoclide/coc.nvim/wiki/Language-
servers#c...](https://github.com/neoclide/coc.nvim/wiki/Language-
servers#ccobjective-c)

I personally installed ccls and it works as expected.

------
mises
Seeing as this is a server, is there any way to run it over the network? This
seems like the sort of thing a shared codebase could benefit from, with
everyone sharing the same, custom-tweaked auto-completion.

~~~
cormacrelf
Nope. It's just another client that speaks LSP. A good one, that does other
VSCode-ish stuff, but still, just a client.

------
dfee
I’d love to switch back from VSCode to get better (native) vim bindings.
However, I like the documentation with auto complete.

~~~
Avi-D-coder
Coc has floating documentation on neovim. It even highlights code examples.

------
towb
This works really good for TS compared to anything else I've tried. I don't
think this is as flexible as some of the alternatives, this one is a bit weird
compared to many other vim plugins that I'm used to, but it works pretty much
out of the box.

Don't forget to install yarn, not super happy about that.

~~~
daliusd
Have you tried nvim-typescript as well? How it compares?

------
ilovecaching
So before your run off and install v8 just to get autocomplete in Vim, let me
make a few suggestions based on my experience:

1\. Check out the built in completion first. Vim actually has very powerful
autocomplete that can look in the current file, complete file paths, tags, and
more. It can look at includes, requires, etc. depending on your language's
built in support. For C like languages this is usually excellent. With ctags
and this built in completion, you can get 90% of what an LSP will give you.

2\. Chances are you've already installed ALE, it's a pretty standard plugin.
ALE has built in LSP support, and it's entirely written in vimscript. All you
have to do is create an ftplugin for your LSP language and add the LSP into
the configured linters list. This is in the primary docs.

------
mafro
Can anyone give a quick comparison to ALE? I'd only ever used YouCompleteMe
and found it a bit slow. ALE and COC seem to be pretty much the same - one in
vimscript and one node?

~~~
chemzqm
The big advantage of ALE is it has much more linters.

The big advantage of coc.nvim is it can load extensions forked from VSCode,
which have more features most of the time.

You can use both of them as the same time, and coc support send diagnostics to
ALE.

------
fourseventy
very cool, ill definitely be trying it out. I'm currently using deoplete which
is fine but this looks like it could definitely be better!

------
aptxkid
To me, using vim is more about forcing me to understand how things work, or
rely less on some IDE magic. IDEs are powerful. It’s too powerful that I don’t
know how certain functionalities work. Maybe it’s just me lol.

~~~
aphextron
Sure. But once you know how everything works, you switch back to an IDE. Use
the tools that make your life easier, and lose the elitism. There’s nothing
more frustrating to me than watching junior engineers struggle to dig through
a problem using Vim or Sublime because “That’s What Real Programmers Use”,
thinking it’s somehow a crutch to have things like autocomplete or code click
through. These tools were built by people far more talented and knowledgeable
than you or I because professionals need productivity, not some ephemeral
feeling of superiority or nerd cred.

~~~
chmln
Autocompletions are not limited to IDEs these days. With the advent of editor-
agnostic language servers, I have high quality autocomplete in vim, with the
bonus of not having to use a slow and clunky IDE.

------
fxfan
Vim needs to come with its own package management and all languages should
have a single-script which setup their features. I don't want to install 20
different packages manually and not have them work

~~~
codebase
[https://vim-bootstrap.com/](https://vim-bootstrap.com/)

~~~
johnchristopher
Interesting. But the PHP/JS/neovim file I got fails to install vim-plug.

------
Foober223
Master grep. Searching is not perfect, but it's a trick that gets your petty
close to any IDE feature. Find refs, go-to def. Even completion becomes
possible via searches. Search to open the class/struct... boom now you can use
dumb textual completions on the members.

Master your debugger. GDB? learn to use it.

You are set for life and can work on any language, anywhere, any time.
Everyone wants a ready-made IDE, and it's great when it works out that way for
your current dev environment. But it won't work for all languages, or for all
project set ups.

~~~
travv0
> But it won't work for all languages, or for all project set ups.

Unlike GDB, right?

