Giter Club home page Giter Club logo

ruby-lsp's Introduction

Ruby LSP logo

Build Status Ruby LSP extension Ruby DX Slack

Ruby LSP

The Ruby LSP is an implementation of the language server protocol for Ruby, used to improve rich features in editors. It is a part of a wider goal to provide a state-of-the-art experience to Ruby developers using modern standards for cross-editor features, documentation and debugging.

Want to discuss Ruby developer experience? Consider joining the public Ruby DX Slack workspace.

Features

Ruby LSP demo

The Ruby LSP features include

  • Semantic highlighting
  • Symbol search and code outline
  • RuboCop errors and warnings (diagnostics)
  • Format on save (with RuboCop or Syntax Tree)
  • Format on type
  • Debugging support
  • Running and debugging tests through VS Code's UI
  • Go to definition for classes, modules, constants and required files
  • Showing documentaton on hover for classes, modules and constants
  • Completion for classes, modules, constants and require paths
  • Fuzzy search classes, modules and constants anywhere in the project and its dependencies (workspace symbol)

Adding method support for definition, completion, hover and workspace symbol is planned, but not yet completed.

See complete information about features here.

If you experience issues, please see the troubleshooting guide.

Usage

With VS Code

If using VS Code, all you have to do is install the Ruby LSP extension to get the extra features in the editor. Do not install the ruby-lsp gem manually.

With other editors

See editors for community instructions on setting up the Ruby LSP.

The gem can be installed by doing

gem install ruby-lsp

and the language server can be launched running ruby-lsp (without bundle exec in order to properly hook into your project's dependencies).

Documentation

See the documentation for more in-depth details about the supported features.

For creating rich themes for Ruby using the semantic highlighting information, see the semantic highlighting documentation.

Configuring code indexing

By default, the Ruby LSP indexes all Ruby files defined in the current project and all of its dependencies, including default gems, except for

  • Gems that only appear under the :development group
  • All Ruby files under test/**/*.rb

By creating a .index.yml file, these configurations can be overridden and tuned. Note that indexing dependent behavior, such as definition, hover, completion or workspace symbol will be impacted by the configurations placed here.

# Exclude files based on a given pattern. Often used to exclude test files or fixtures
excluded_patterns:
  - "**/spec/**/*.rb"

# Include files based on a given pattern. Can be used to index Ruby files that use different extensions
included_patterns:
  - "**/bin/*"

# Exclude gems by name. If a gem is never referenced in the project's code and is only used as a tool, excluding it will
# speed up indexing and reduce the amount of results in features like definition or completion
excluded_gems:
  - rubocop
  - pathname

# Include gems by name. Normally used to include development gems that are excluded by default
included_gems:
  - prism

Addons

The Ruby LSP provides an addon system that allows other gems to enhance the base functionality with more editor features. This is the mechanism that powers addons like

Other community driven addons can be found in rubygems by searching for the ruby-lsp prefix.

For instructions on how to create addons, see the addons documentation.

Learn More

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/ruby-lsp. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

If you wish to contribute, see CONTRIBUTING for development instructions and check out our pinned roadmap issue for a list of tasks to get started.

License

The gem is available as open source under the terms of the MIT License.

ruby-lsp's People

Contributors

vinistock avatar dependabot[bot] avatar github-actions[bot] avatar andyw8 avatar st0012 avatar wildmaples avatar morriar avatar paracycle avatar snutij avatar adisonlampert avatar ryanbrushett avatar kaanozkan avatar egiurleo avatar mutecipher avatar jenny-codes avatar technicalpickles avatar bitwise-aiden avatar quintasan avatar asok avatar earlopain avatar rafaelfranca avatar rzane avatar t-mario-y avatar dirceu avatar sambostock avatar francisbeaudoin avatar tk0miya avatar gmcgibbon avatar catlee avatar aryan-soni 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.