Skip to content
Related Articles

Related Articles

How to configure VSCode for Ruby Developers?

View Discussion
Improve Article
Save Article
  • Last Updated : 27 Jul, 2022
View Discussion
Improve Article
Save Article

One can easily configure VSCode for Ruby with some steps mentioned below, but first, let’s see what these terms are. Ruby is nothing but a high-level and general-purpose programming language. It was developed by Yukihiro Matsumoto in the mid-1990s. It is a simple language because its syntax is more like the English language. In this language, everything is an object, including the primitive data types. It is used for web servers, DevOps, and web scraping. It’s also an open-source language with a big community, It’s a robust, dynamically typed, object-oriented language, and it has clean and simple syntax that allows users to solve problems with just fewer lines of code and write more appropriate code. 

Whereas Visual Studio Code, also commonly referred to as VSCode, can be classed as a development environment (IDE), meaning that developers can write and test code at the same time in the same place. VSCode supports multiple languages like C, C++, Python, Ruby, etc. it includes features like debugging, syntax highlighting, intelligent code completion, snippets, code refactoring, and embedded Git.

Steps to configure VSCode for Ruby 

Step 1: Install Ruby

All the latest versions of Ruby for Windows can be downloaded from rubyinstaller.org. Download the latest version. Also, you can follow this GFG article for more details on How to install ruby. When you install Ruby, also set its bin path in the Environment variable. To set its path, follow these steps (ignore this if you have already done it).

  • Go to the bin folder of ruby and copy its path.
Copying-path-in-bin-folder

 

  • Then open the environment variable from the window button; here now we have to add the path in the system environment, so click on path in the system environment, then click edit and then click on ‘New’ to add a new path, paste the copied link, then click ok and ok, that’s it.
Adding-path-in-system-environment

 

Step 2: Install VSCode

VSCode can be downloaded from here. If you already have VSCode, then ignore this step. For more details, refer to this article How to install Visual Studio Code.

Step 3: Open VSCode, then open the extensions window, type “ruby” in the search bar, then you will see all the ruby plugins there. Install Ruby plug-in extensions. Ruby language support and debugging for Visual Studio Code.

Installing-ruby-plug-in-extensions

 

VSCode Ruby: Syntax highlighting, snippet, and language configuration support for Ruby.

VSCode-ruby-extensions

 

The above two extensions are very important; apart from this, you can download furthermore extensions of ruby according to your need like:

  • Endwise: This is an extension that just adds the “end” keyword to code structures in languages like Ruby.
  • Solargraph: It provides features like context-aware auto-completion, documentation for the Ruby core, and gem support.
  • Ruby-rubocop: RuboCop is a Ruby code style checker and code analyzer.

Step 4: Now your IDE is set to run Ruby. You can check by running an example ‘Hello world’ program. For that, create a new file ‘Test.rb’ the written code for printing hello world by writing this 

Ruby




puts "Hello world!!"

And then save the file with ctrl+s. Then right-click your mouse button and click on ‘Run code’.

Running-code-for-Hello-world

 

You will see the output in your terminal like this:

Hello-world-output

 

That’s it, and you’ve successfully configured your VSCode for Ruby.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!