<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Takehiro Adachi</title>
    <description>The latest articles on Forem by Takehiro Adachi (@take).</description>
    <link>https://forem.com/take</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F394870%2F17f56d56-8392-4327-8fa8-27503350c025.jpeg</url>
      <title>Forem: Takehiro Adachi</title>
      <link>https://forem.com/take</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/take"/>
    <language>en</language>
    <item>
      <title>Using neovim's official LSP plugin</title>
      <dc:creator>Takehiro Adachi</dc:creator>
      <pubDate>Wed, 03 Jun 2020 10:55:06 +0000</pubDate>
      <link>https://forem.com/take/using-neovim-s-official-lsp-plugin-11n0</link>
      <guid>https://forem.com/take/using-neovim-s-official-lsp-plugin-11n0</guid>
      <description>&lt;p&gt;We all wan't &lt;a href="https://microsoft.github.io/language-server-protocol/"&gt;LSP&lt;/a&gt; support when we write code even in dynamic typing language like Ruby. It's 2020 😉&lt;/p&gt;

&lt;p&gt;The next neovim will support LSP out of the box, so I thought about giving it a try since the old plugin I was using wasn't supporting LSP's &lt;code&gt;completionItem/resolve&lt;/code&gt; just like below&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Before&lt;/em&gt; - autozimu/LanguageClient-neovim&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gzKhx1ae--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7giw4ylcb04wx4pw65nd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gzKhx1ae--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7giw4ylcb04wx4pw65nd.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
no function documents.... :(&lt;/p&gt;

&lt;p&gt;&lt;em&gt;After&lt;/em&gt; - neovim/nvim-lsp(official LSP temporary plugin)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--st4McaO2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mehdbn35w4r4up9ae27e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--st4McaO2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mehdbn35w4r4up9ae27e.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
documents yay!&lt;/p&gt;
&lt;h2&gt;
  
  
  Steps
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Updating Neovim
&lt;/h3&gt;

&lt;p&gt;First you'll need to install the unreleased latest neovim(aka Nightly)&lt;br&gt;
&lt;a href="https://github.com/neovim/neovim/releases/tag/nightly"&gt;Here's&lt;/a&gt; the link for it, but if you're using Mac &amp;amp; homebrew, you can do it as below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ brew unlink neovim
$ brew install neovim --HEAD
$ nvim --version
NVIM v0.5.0-60c581b
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Installing official LSP plugin
&lt;/h3&gt;

&lt;p&gt;The official LSP support will be included inside the next 0.5 neovim release version, but it's a plugin ATM so you'll have to install after you install Nightly neovim&lt;/p&gt;

&lt;p&gt;I use &lt;a href="https://github.com/Shougo/dein.vim"&gt;dein.vim&lt;/a&gt; for plugin management so it'll be as below&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  call dein#add('neovim/nvim-lsp')
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I use &lt;a href="https://github.com/Shougo/deoplete.nvim"&gt;deoplete.nvim&lt;/a&gt; for autocomplete, so below is necessary in this case&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  call dein#add('Shougo/deoplete.nvim')
  call dein#add('Shougo/deoplete-lsp')
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Please note that neovim's default autocomplete supports nvim-lsp, so deoplete isn't required&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up nvim-lsp
&lt;/h3&gt;

&lt;p&gt;This is the hard part for most plugins, but nvim-lsp configuration is really simple&lt;/p&gt;

&lt;p&gt;All you have to do is add the following to you init.vim:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:lua &amp;lt;&amp;lt; END
  require'nvim_lsp'.tsserver.setup{}
END
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is when you want to write typescript, if you want to write Ruby too, add the corresponding language server as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:lua &amp;lt;&amp;lt; END
  require'nvim_lsp'.tsserver.setup{}
  require'nvim_lsp'.solargraph.setup{}
END
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Don't forget to install the language server itself if you haven't&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/neovim/nvim-lsp#tsserver"&gt;https://github.com/neovim/nvim-lsp#tsserver&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/neovim/nvim-lsp#solargraph"&gt;https://github.com/neovim/nvim-lsp#solargraph&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's all! 😆&lt;/p&gt;

&lt;p&gt;P.S.&lt;/p&gt;

&lt;p&gt;You also might want to set belows keybinds as well 😉&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nnoremap &amp;lt;silent&amp;gt;gd    &amp;lt;cmd&amp;gt;lua vim.lsp.buf.declaration()&amp;lt;CR&amp;gt;
nnoremap &amp;lt;silent&amp;gt;&amp;lt;c-]&amp;gt; &amp;lt;cmd&amp;gt;lua vim.lsp.buf.definition()&amp;lt;CR&amp;gt;
nnoremap &amp;lt;silent&amp;gt;K     &amp;lt;cmd&amp;gt;lua vim.lsp.buf.hover()&amp;lt;CR&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
      <category>vim</category>
      <category>neovim</category>
      <category>editor</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
