Add vim-lsp
for working with LSPs
#56
Open
+23
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
It's been a while since we wanted to enable seamless navigation through classes and definitions across the working directory and the different Ruby gems. We kinda had the first one with
ctags
– even though you'd have to re-generate thectags
from time to time to pick up the new definitions – but we couldn't get to make an approach for navigating through the definitions in the gems work properly.Therefore, after quite some time, we got to give Language Server Protocols a try and managed to accomplish this goal.
Details
This pull request includes the addition of new submodules for
vim-lsp
andvim-lsp-settings
which allows for installing Language Server Protocols. It also sets custom configurations such as:typeprof
for now as it was throwing some errors – let's re-consider enabling back in a follow up PR.A>
string at the left of the numbers on the line where the cursos is placed.vim-lsp
:gd
for navigating to the definition of the word under the cursorgpd
for peek at the definition of the word under the cursorgs
to take a look and navigate across the document symbolsgS
to search through the workspace symbolsUsing with Ruby
vim-lsp-settings
– which is used to easily install and configure LSPs – supports installing Ruby LSP:https://shopify.github.io/ruby-lsp/
In order to install it we just have to do:
:LspInstallServer ruby-lsp
. Note that this will clone the repo forruby-lsp
gem into thevim-lsp-settings
default dir and install it dependencies invendor/bundle
meaning that theruby-lsp
gem won't be available globally for your ruby versions, so you might have to install the gem usinggem install
.After that, it should work properly!
gd
for navigating to the definition of the Class or method under the cursorgpd
for peek at the definition of the Class or method under the cursorgs
to take a look and navigate across the classes, modules, methods, etc.gS
to search for classes, modules, methods, etc, for the workspace – including gems!Screen.Recording.2024-11-29.at.15.04.55.mov