This repository contains YARD documentation for the main Dragonruby APIs.
Used in conjunction with Solargraph as your LSP, you'll be able to get rich API autocomplete and type support for the Dragonruby APIs.
alacritty_BG37G8KCEO.mp4
Code.Ldvkejagpw-1.mp4
- A CRuby runtime
- The solargraph gem
- An editor that can be configured to use the Solargraph LSP:
- Vim/neovim
- VS-Code
- Emacs
- Zed
- Sublime Text
- etc.
If you confidently work with Ruby, gems and solargraph then the TLDR is:
- clone this repository to a convenient location
- configure solargraph to include the checked out repository
include:
- "mygame/app/*.rb"
- "../dragonruby-yard-doc/*.rb"
If you'd like more detailed instructions, read on.
Clone this repository to a directory that is a peer of your normal dragronruby projects.
For example, if your game project is located at ~/devel/games/myawesomegame
, clone this repo to ~/devel/games/dragonruby-yard-doc
$ cd ~/devel/games/
$ git clone git@github.com:owenbutler/dragonruby-yard-doc.git
Dragonruby itself does not require a ruby runtime to work. So, you might be wondering why we need another Ruby installed here? The answer is that the solargraph gem, which we will use as an LSP, does need a ruby runtime.
Download and run the latest ruby installer from rubyinstaller.org. Choose the one that includes the DevKit.
Or use your favorite package manager. For scoop, scoop install ruby
, and follow it's instructions: scoop install msys2
and ridk install
. This will start the cli version of the rubyinstaller. Choose the option to install msys2 with the mingw development toolchain.
Use the package management system of your distribution or third-party tools (asdf, rbenv or RVM).
Use third-party tools (asdf, rbenv or RVM).
Once you have a ruby installed, install the solargraph gem:
$ gem install solargraph
Solargraph needs to be configured to include this repo. Create a solargraph config file inside your game directory:
$ cd ~/devel/games/myawesomegame
$ solargraph config
This creates a default .solargraph.yml
file in the root of your project dir.
Edit the include section of the config file to include our checked out repo:
include:
- "mygame/app/*.rb"
- "../dragonruby-yard-doc/*.rb"
If you'd like to further configure solargraph, explore the config reference.
VSCode supports running solargraph through an extension.
- Open the extensions view
- Search for Solargraph
- Install the extension
- Install solargraph LSP via Mason
...
...
LSP for Sublime Text can be configured to run Solargraph.
- Install the LSP package using the command palette (
Tools > Command Palette
):- Enter the command
Package Control: Install Package
- Choose the LSP package
- Enter the command
- Add Solargraph to the list of LSP clients in the package's settings (
Settings > Package Settings > LSP > Settings
):
{
"clients": {
"solargraph": {
"enabled": true,
"command": [
"solargraph", "stdio"
],
"selector": "source.ruby",
"initializationOptions": {
"diagnostics": true
}
}
}
}
The LSP package supports automatic formatting but doesn't enable it by default. If you'd like to use it:
- Open a
.rb
file - Open the syntax-specific settings (
Settings > Settings - Syntax Specific
) - Enable format on save:
{
"lsp_format_on_save": true
}