Coc-solargraph: Difference between revisions
From wikinotes
(3 intermediate revisions by the same user not shown) | |||
Line 30: | Line 30: | ||
gem install neovim | gem install neovim | ||
gem install solargraph | gem install solargraph | ||
gem install solargraph-rails --pre # if using rails | gem install solargraph-rails --pre # if using rails (I've had a lot of issues with this) | ||
</source> | </source> | ||
Line 41: | Line 41: | ||
# add docs from project's gems to solargraph | # add docs from project's gems to solargraph | ||
solargraph bundle | solargraph bundle | ||
# generate a solargraph config | |||
# (add 'plugins: ["solargraph-rails"]' if wanted) | |||
solargraph config . | |||
</source> | </source> | ||
Line 74: | Line 78: | ||
from -e:1:in `<main>' | from -e:1:in `<main>' | ||
</pre> | </pre> | ||
One way around this is to add <code>solargraph</code> to your <code>Gemfile</code> and tell solargraph to use bundler.<br> | |||
solargraph has it's own requirements however, which may conflict with your own. | |||
<syntaxhighlight lang="json"> | |||
// ~/.config/nvim/coc-settings.json | |||
{ | |||
"solargraph.useBundler": true | |||
} | |||
</syntaxhighlight> | |||
</blockquote><!-- could not find X-Y.Y.Y in any of the sources --> | </blockquote><!-- could not find X-Y.Y.Y in any of the sources --> | ||
</blockquote><!-- Troubleshooting --> | </blockquote><!-- Troubleshooting --> |
Latest revision as of 18:26, 28 December 2021
COC LSP extension built overtop of ruby solargraph.
Documentation
github https://github.com/neoclide/coc-solargraph solargraph homepage https://github.com/castwide/solargraph
Tutorials
solagraph w/ rails http://iftheshoefritz.com/code%20completion/intellisense/rails/ruby/vscode/emacs/2020/06/18/rails-code-completion-with-lsp-and-solargraph.html
Install
NOTE:
If using a nix-provided nvim, coc-solargraph may fail to start within vim because directories are not writable.
If you are not getting completions, see
:CocInfo
.gem install neovim gem install solargraph gem install solargraph-rails --pre # if using rails (I've had a lot of issues with this):CocInstall coc-solargraph " uses solargraph on backendFor each project:
# add docs from project's gems to solargraph solargraph bundle # generate a solargraph config # (add 'plugins: ["solargraph-rails"]' if wanted) solargraph config .Make sure to see ruby solargraph instructions for additional optimizations.
Usage
- ctrl+space triggers coc completion.
- ctrl+n/p will continue to use vim's builtin keyword completion.
Troubleshooting
Tools
:CocInfo " see logs, exceptions :CocList commands " fuzzy-search solargraph commands, enter to runcould not find X-Y.Y.Y in any of the sources
2021-12-28T10:55:26.265 INFO (pid:11001) [extension:coc-solargraph] - [WARN] /Users/will/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find racc-1.6.0 in any of the sources (Bundler::GemNotFound) from /Users/will/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/spec_set.rb:85:in `map!' from /Users/will/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/spec_set.rb:85:in `materialize' from /Users/will/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/definition.rb:170:in `specs' from /Users/will/.gem/ruby/2.7.2/gems/bundler-1.17.3/lib/bundler/definition.rb:237:in `specs_for' from -e:1:in `block in <main>' from -e:1:in `chdir' from -e:1:in `<main>'One way around this is to add
solargraph
to yourGemfile
and tell solargraph to use bundler.
solargraph has it's own requirements however, which may conflict with your own.// ~/.config/nvim/coc-settings.json { "solargraph.useBundler": true }