Gamefic

Adventure Games and Interactive Fiction

A New Visual Studio Code Extension for Ruby

by Gamefic on March 20, 2017

Working on Gamefic has had the unexpected side effect of leading me to work on IDEs. Originally I wanted to make authoring software for Gamefic, but that project gradually turned into a suite of general-purpose Ruby tools. One of those tools is code completion: the ability for editors to recommend snippets of code that fit what you're trying to do. This weekend I released the code completion tool as a Ruby gem and a Visual Studio Code extension.

Solargraph uses a combination of code analysis and generated documentation to suggest keywords, variables, constants, and methods to complete what you're currently entering. Anyone who's used an IDE has probably seen code completion in action. Unfortunately, with dynamic languages like Ruby, it can be difficult to get comprehensive suggestions from static analysis. Solargraph depends on YARD to fill in some of the missing parts.

I integrated with VS Code first simply because it's what I use, but it should be possible to integrate with just about any IDE.

Solargraph is still in its early stages, so I expect bugs. Anyone who gives it a try should feel free to submit issues or pull requests.