Coder Social home page Coder Social logo

orta / vscode-ruby Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rubyide/vscode-ruby

1.0 3.0 0.0 752 KB

Provides Ruby language and debugging support for Visual Studio Code

Home Page: https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby

License: MIT License

JavaScript 26.97% TypeScript 72.80% Ruby 0.23%

vscode-ruby's Introduction

Ruby Language and Debugging Support for Visual Studio Code

Join the chat at https://gitter.im/rebornix/vscode-ruby Build Status Build status

This extension provides rich Ruby language and debugging support for Visual Studio Code. Fully tested against *nix/Windows and Ruby 1.9.3 to 2.2.0. It's still in progress ( GitHub ), please expect frequent updates with breaking changes before 1.0. If you are interested in this project, feel free to

  • Subscribe to our mailing list, get notified when we release new features or fix bugs.
  • File GitHub issues anytime you ran into unexpected situations/bugs.
  • Fork our project, hack it around and send us PRs!

Install

Install Extension

Press F1, type ext install ruby.

Debugger

Install Ruby Dependencies

In this extension, we implement ruby debug ide protocol to allow VS Code to communicate with ruby debug, it requires ruby-debug-ide to be installed on your machine. This is also how RubyMine/NetBeans does by default.

  • If you are using JRuby or Ruby v1.8.x (jruby, ruby_18, mingw_18)
    • gem install ruby-debug-ide, the latest version is 0.6.0. Make sure ruby-debug-base is installed together with ruby-debug-ide`.
  • If you are using Ruby v1.9.x (ruby_19, mingw_19)
    • gem install ruby-debug-ide, the latest version is 0.6.0. Make sure ruby-debug-base19x is installed together with ruby-debug-ide.
  • If you are using Ruby v2.x
    • gem install ruby-debug-ide -v 0.4.32 or higher versions
    • gem install debase -v 0.2.1 or higher versions

Add VS Code config to your project

Go to the debugger view of VS Code and hit the gear icon. Choose Ruby or Ruby Debugger from the prompt window, then you'll get the sample launch config in .vscode/launch.json. The sample launch configurations include debuggers for RSpec (complete, and active spec file) and Cucumber runs. These examples expect that bundle install --binstubs has been called.

Detailed instruction for debugging Ruby Scripts/Rails/etc

Read following instructions about how to debug ruby/rails/etc locally or remotely

Linters

Available Linter hooks

You will need to install the ruby gem for eacy of these for linting to work (except ruby -wc of course)

  • ruby -wc
  • rubocop
  • ruby-lint
  • reek
  • fasterer
  • debride

Enable each one in your workspace or user settings:

// Basic settings: turn linter(s) on
"ruby.lint": {
	"reek": true,
	"rubocop": true,
	"ruby": true, //Runs ruby -wc
	"fasterer": true,
	"debride": true,
	"ruby-lint": true
}

//advanced: set command line options for some linters:
"ruby.lint": {
	"rubocop": {
		"only": ["SpaceInsideBlockBraces", "LeadingCommentSpace"],
		"lint": true,
		"rails": true
	},
	"reek": true
}

By default no linters are turned on.

Each linter runs only on the newly opened or edited file. This excludes some of the linters functionality, and makes some overly chatty - such as ruby-lint reporting undefined methods. The usual configuration file for each linter will be use as they would be when running from the command line, however settings that include/exclude files will not likely be followed.

Relevant configuration files:

Settings available (in your VSCode workspace) for each of the linters:

"debride": {
	"rails": true //Add some rails call conversions.
}

"ruby"//no settings
"reek" //no settings
"fasterer" //no settings

"ruby-lint": {
	"levels": [/* a subset of these */ "error","warning","info"],
	"classes":[ /* a subset of these */ "argument_amount", "loop_keywords", "pedantics", "shadowing_variables", "undefined_methods", "undefined_variables", "unused_variables", "useless_equality_checks" ]
}

"rubocop": {
	"lint": true, //enable all lint cops.
	"only": [/* array: Run only the specified cop(s) and/or cops in the specified departments. */],
	"except": [/* array: Run all cops enabled by configuration except the specified cop(s) and/or departments. */],
	"require": [/* array: Require Ruby files. */],
	"rails": true //Run extra rails cops
}

Features

  • Ruby scripts debugging

    • Line breakpoints (add, delete, disable, enable)
    • Step over, step in, step out, continue, pause
    • Multiple, parallel threads
    • Call stack
    • Scope variables
    • Debug console
    • Watch window
    • Variables evaluate/inspect
    • Stop on entry
    • Breaking on uncaught exceptions and errors
    • Attach requests
    • Breakpoints can also be set in .erb files
  • Unit/Integration tests debugging

    • RSpec
    • Cucumber
  • Ruby remote debug

  • Rails debugging

  • Language colorization support

  • Linting

TODO

  • Ruby scripts debugging
    • Conditional breakpoints
  • Unit/Integration tests debugging
    • Shoulda
    • Test::Unit
  • Rack
  • Rake
  • Gem
  • IRB console
  • IntelliSense and autocomplete

Main contributors

License

This extension is licensed under the MIT License.

vscode-ruby's People

Contributors

factormystic avatar gitter-badger avatar hookyqr avatar lextm avatar meritozh avatar rebornix avatar vaughns avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.