Neovim - Setting Up VSCode Intellisense with CoC [LSP]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys in this video we're gonna be setting up intellisense for neo vem using conquer of completion or csa so I do not have everything about this this this plugin documented here and that's because it's a very big plugin there's a lot of things that go into it so I have enough to get you started but the documentation is also linked in my blog like all of the documentation is linked in there so let's open up them plug plugins and if you're not familiar with this directory structure all this kind of stuff I go over it in all the previous videos so we'll open this up and let's add a plug-in for intellisense or for COC so we'll have over all so I added this down here so anytime you open up and you of em it will automatically install missing plugins alright so let's open it up and install and now it should be installed the next thing we'll do and if you want to build it from source you can build it from source using this command right here instead and then running you have to make sure you have yarn installed first so you can to install yarn you can run that now what we'll do is we'll make a directory called plug config and this is where we're gonna keep all of the config for all of our plugins it just so happens that COC is the first one that we that we're installing so let's go in here and open this guy up now I didn't leave an example configuration here because the example configuration provided by the repo and neoglide here is pretty big so we'll just go to the repo and when you see example vim configuration take all of this copy and paste it into here and then the only thing that I do not like about it is that it has this stuff here and the reason I don't like these two lines 106 and 107 is because I use tab to move between buffers and this remaps it so we're just going to get rid of that alright and then the last thing we need to do is open up in it them and what we'll do is we will source the configuration file that we just added so there it goes all right and now we should be ready to go so we'll we're on knee of M and check health all right and you could ignore this top thing this is just um polyglot a bug and polyglot right now what you're looking for is this guy right here this COC check so if you do not have note installed this may not have worked for you and if it didn't just install node and that should fix it if you want to point to a custom node path you can do that with this variable right here and you should see all K all okay's in here before proceeding so the next thing we'll do is Co see info just to get some info that COC provides us it lets us know our knee of inversion the node version is going off of and the version of COC itself also I guess your terminal and platform all right now let's install some extensions so COC we can tap complete this install and we'll do COC JSON Python snippets COC mlsp and we'll also do COC TS server all right and the TS server one typically takes the longest and there it goes all right and now the next thing that we can do is by the way these are extensions that we extol so it doesn't necessarily have to be a language support extension right it could be like this is one for vim this is one for Python I installed one 40s or typescript in JavaScript but you can also install them for snippets and other things so we can click on this link to the COC extensions and here are all the extensions that are provided so like for instance if you wanted to add like C++ support you would click on this one you would see OC install that and then you would change some of the configurations and we'll go over configurations in a second but you can add some configurations to it so they all have configurations but so that some of them are LSB like this one but see make isn't really LSP I mean it kind of is but let's see like discord that's definitely not LSP right and let's see what else snippets we installed those it has like a spell checker and like a yank tool it also has like an explorer I think in here somewhere so you know you can check these out and see what it provides you but it's not just for language support all right so after installing those extensions we can go through some of the commands that we now get with the extension so we can do COC list or yeah so let's go back to the list and then we'll do commands and these are all the commands so you'll notice that we install Python so and then we have like on commands we installed TS snippets so now we have snippet commands we installed a TS server so now we have TS server commands another thing you can do is uninstall stuff we won't do that right now but you can uninstall stuff like extensions just by doing this right here like CFC uninstall that we can also do something like extensions and then you can if you press tab on top of the extension then you can toggle it go to its configuration and disable it enable it uninstall it reload it etc etc right so that's that's pretty nice the next thing we will do is we run a COC configuration you only need it or you only need to do this once so we'll do COC config alright and you'll notice that it brought us to a COC settings file and it'll be very obvious where this is in a second I'll show it to you so what we'll do is we'll grab this and this is also a place where you can set up other language server protocol support so if you didn't want to use COC Python the extension that does that you could just set up the language server down here in this in this config so what we're gonna do is we're gonna add things to Auto and save so markdown and JavaScript Python I think is in this list somewhere and also we're going to enable Python linting and you might be wondering well how did I know how to add this stuff here you know what did I just make this stuff up you know and I didn't so we can go to COC extensions and click on an extension so we will look at Python for instance and if you scroll down and look through all of the options that you're given here we can see okay pilots of Python linting duh and I'll make this a little bit bigger so you can see maybe even bigger Python glinting pilot enabled and it's a boolean so it can be true or false right so I did not make this stuff up this stuff just comes directly from all of the configuration that you can find in the repo under extension so you can set it up however you want but there's a lot of ways to configure it right so I wonder if this whole time should have been fine alright let's go back here all right so now the next thing we'll do is if you want to install watch man you can install watch man like this if you notice that it's taking up a lot of memory you can run this watch main command to get rid of that if you'd like to bring your configuration with you you can download this shell script or not download the shell script but create the shell script and install all of the COC stuff that you typically would have installed so now what we'll do is we can demo some of this stuff so let's do and it dot them and let's add some nonsense data though all right and already the vim LSP is noticing that this is nonsense so that's good we can also do something like source and we'll notice ok these are like all the things that are built into them so that's kind of nice right the next thing that we'll do is we will open up a Python file so pull CD home and we'll open up PI test here whoops and then PI test and we will open up this guy and you'll notice if I cover of our class well for instance we don't have the right pilot is letting us now I can't find these right so we don't have the right interpreter set so what we'll go and do is we will do COC command go down to python set interpreter and they will choose what interpreter we want so for instance this one will be used in the test so you can see number 15 up there is the test so we'll do 15 all right and that goes away so what we can do now is it should find everything say so def get light objects there seems to be some sort of like error down here at the bottom but I don't think that that matters I think everything should be fine then what we'll do is add some nonsense here and pilot picks up on that being nonsense so we'll get rid of that all right and let's see we can do B dot and now we get all the Jedi completion which is nice and it if it has a PI doc string then there you go you can get some more information about it also if you want to see like okay well where's this defined type Gd on top of it and we got to where it's defined then press ctrl out o to get out of there we can also press we can also do like I think gr to find references I don't think there was a reference for that one though and then let's see that should be pretty much it for demoing this stuff actually the last thing I wanted to show was formatting right so what we'll do is add a bunch of space here and then at Auto formats and that'll happen for everything that you set in the configuration we can also show off this working in JavaScript so we'll go over here open this up of the templates open this and we can do things like I don't know gr on this and we can see everywhere that's being used so at the top and at the bottom this is all references to the layout component something else we could do like the shift K and get shift cave-like get the help for that so we know the full path to that module we can run shift K on everything this is what we were doing Python to when we were getting all the information it's just pressing shift K on top of things right won't give you much about that other than because it's a class I just defined right here but yeah so this is you know what you get out of the box with it you also get the same thing so if I start typing this dot props dot okay and here's all the props and stuff right so yeah it's just uh it's pretty much just intellisense so that's pretty much all I wanted to demo for this and you should definitely be checking out this guy's documentation on their their github you'll just when you go to their repo you just click on wiki and you'll have all of the documentation you should definitely be looking at the COC extensions here and also you can follow my development for this over on my github I'm basically building it from scratch if you're interested in the old config that I had it's in another branch called stable right now alright and make sure to LIKE and subscribe and I'll see you in the next video
Info
Channel: chris@machine
Views: 104,781
Rating: undefined out of 5
Keywords: neovim, vim, neovim intellisense, vim vscode, vim ide, neovim ide, vim coc, coc, neovim vscode
Id: OXEVhnY621M
Channel Id: undefined
Length: 12min 26sec (746 seconds)
Published: Sun Apr 26 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.