├── .github └── workflows │ └── ruby.yml ├── .gitignore ├── .rubocop.yml ├── .ruby-version ├── CODE_OF_CONDUCT.md ├── Gemfile ├── Gemfile.lock ├── LICENSE.txt ├── README.md ├── Rakefile ├── bin ├── console └── setup ├── lib ├── ruby │ └── lsp │ │ ├── rubyfmt.rb │ │ └── rubyfmt │ │ └── version.rb └── ruby_lsp │ └── ruby-lsp-rubyfmt │ └── addon.rb ├── ruby-lsp-rubyfmt.gemspec └── test ├── ruby └── lsp │ └── rubyfmt_test.rb └── test_helper.rb /.github/workflows/ruby.yml: -------------------------------------------------------------------------------- 1 | # This workflow uses actions that are not certified by GitHub. 2 | # They are provided by a third-party and are governed by 3 | # separate terms of service, privacy policy, and support 4 | # documentation. 5 | # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake 6 | # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby 7 | 8 | name: Ruby 9 | 10 | on: 11 | push: 12 | branches: [ "main" ] 13 | pull_request: 14 | branches: [ "main" ] 15 | 16 | permissions: 17 | contents: read 18 | 19 | jobs: 20 | test: 21 | 22 | runs-on: macos-latest 23 | strategy: 24 | matrix: 25 | ruby-version: ['3.0', '3.1', '3.2', '3.3'] 26 | 27 | steps: 28 | - uses: actions/checkout@v3 29 | - name: Set up Ruby 30 | # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, 31 | # change this to (see https://github.com/ruby/setup-ruby#versioning): 32 | uses: ruby/setup-ruby@v1 33 | with: 34 | ruby-version: ${{ matrix.ruby-version }} 35 | bundler-cache: true # runs 'bundle install' and caches installed gems automatically 36 | - name: Set up Homebrew 37 | id: set-up-homebrew 38 | uses: Homebrew/actions/setup-homebrew@master 39 | - name: Set up rubyfmt 40 | run: brew install rubyfmt 41 | - name: Run RuboCop 42 | run: bundle exec rubocop --parallel 43 | - name: Run tests 44 | run: bundle exec rake test 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /_yardoc/ 4 | /coverage/ 5 | /doc/ 6 | /pkg/ 7 | /spec/reports/ 8 | /tmp/ 9 | .vscode -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_gem: 2 | rubocop-shopify: rubocop.yml 3 | 4 | require: 5 | - rubocop-sorbet 6 | - rubocop-minitest 7 | - rubocop-rake 8 | 9 | AllCops: 10 | NewCops: disable 11 | SuggestExtensions: false 12 | TargetRubyVersion: 3.2 13 | 14 | Naming/FileName: 15 | Enabled: true 16 | 17 | Style/StderrPuts: 18 | Enabled: true 19 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 3.3.0 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at joshua.scharf@fullscript.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org" 4 | 5 | git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } 6 | 7 | # Specify your gem's dependencies in ruby-lsp-rubyfmt.gemspec 8 | gemspec 9 | 10 | # sorbet-static is not available on Windows. We also skip Tapioca since it depends on sorbet-static-and-runtime 11 | # C Ruby (MRI), Rubinius or TruffleRuby, but NOT Windows 12 | NON_WINDOWS_PLATFORMS = [:ruby] 13 | 14 | group :development do 15 | gem "bundler", "~> 2.4.2" 16 | gem "debug", "~> 1.8", require: false 17 | gem "minitest", "~> 5.20" 18 | gem "minitest-reporters", "~> 1.6" 19 | gem "rake", "~> 13.1" 20 | gem "rubocop", "~> 1.57" 21 | gem "rubocop-shopify", "~> 2.14", require: false 22 | gem "rubocop-minitest", "~> 0.33.0", require: false 23 | gem "rubocop-rake", "~> 0.6.0", require: false 24 | gem "rubocop-sorbet", "~> 0.7", require: false 25 | gem "sorbet-static-and-runtime", platforms: NON_WINDOWS_PLATFORMS 26 | gem "tapioca", require: false, platforms: NON_WINDOWS_PLATFORMS 27 | end 28 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: . 3 | specs: 4 | ruby-lsp-rubyfmt (0.1.0) 5 | ruby-lsp (>= 0.12.0) 6 | sorbet-runtime (>= 0.5.5685) 7 | 8 | GEM 9 | remote: https://rubygems.org/ 10 | specs: 11 | ansi (1.5.0) 12 | ast (2.4.2) 13 | builder (3.2.4) 14 | debug (1.8.0) 15 | irb (>= 1.5.0) 16 | reline (>= 0.3.1) 17 | erubi (1.12.0) 18 | io-console (0.6.0) 19 | irb (1.9.1) 20 | rdoc 21 | reline (>= 0.3.8) 22 | json (2.7.0) 23 | language_server-protocol (3.17.0.3) 24 | minitest (5.20.0) 25 | minitest-reporters (1.6.1) 26 | ansi 27 | builder 28 | minitest (>= 5.0) 29 | ruby-progressbar 30 | netrc (0.11.0) 31 | parallel (1.24.0) 32 | parser (3.2.2.4) 33 | ast (~> 2.4.1) 34 | racc 35 | prettier_print (1.2.1) 36 | prism (0.17.1) 37 | psych (5.1.1.1) 38 | stringio 39 | racc (1.7.3) 40 | rainbow (3.1.1) 41 | rake (13.1.0) 42 | rbi (0.1.4) 43 | prism (>= 0.17.1, < 0.18) 44 | sorbet-runtime (>= 0.5.9204) 45 | rdoc (6.6.0) 46 | psych (>= 4.0.0) 47 | regexp_parser (2.8.2) 48 | reline (0.4.1) 49 | io-console (~> 0.5) 50 | rexml (3.2.6) 51 | rubocop (1.58.0) 52 | json (~> 2.3) 53 | language_server-protocol (>= 3.17.0) 54 | parallel (~> 1.10) 55 | parser (>= 3.2.2.4) 56 | rainbow (>= 2.2.2, < 4.0) 57 | regexp_parser (>= 1.8, < 3.0) 58 | rexml (>= 3.2.5, < 4.0) 59 | rubocop-ast (>= 1.30.0, < 2.0) 60 | ruby-progressbar (~> 1.7) 61 | unicode-display_width (>= 2.4.0, < 3.0) 62 | rubocop-ast (1.30.0) 63 | parser (>= 3.2.1.0) 64 | rubocop-minitest (0.33.0) 65 | rubocop (>= 1.39, < 2.0) 66 | rubocop-rake (0.6.0) 67 | rubocop (~> 1.0) 68 | rubocop-shopify (2.14.0) 69 | rubocop (~> 1.51) 70 | rubocop-sorbet (0.7.5) 71 | rubocop (>= 0.90.0) 72 | ruby-lsp (0.12.5) 73 | language_server-protocol (~> 3.17.0) 74 | prism (>= 0.17.1, < 0.18) 75 | sorbet-runtime (>= 0.5.5685) 76 | ruby-progressbar (1.13.0) 77 | sorbet (0.5.11164) 78 | sorbet-static (= 0.5.11164) 79 | sorbet-runtime (0.5.11164) 80 | sorbet-static (0.5.11164-universal-darwin) 81 | sorbet-static-and-runtime (0.5.11164) 82 | sorbet (= 0.5.11164) 83 | sorbet-runtime (= 0.5.11164) 84 | spoom (1.2.4) 85 | erubi (>= 1.10.0) 86 | sorbet-static-and-runtime (>= 0.5.10187) 87 | syntax_tree (>= 6.1.1) 88 | thor (>= 0.19.2) 89 | stringio (3.1.0) 90 | syntax_tree (6.2.0) 91 | prettier_print (>= 1.2.0) 92 | tapioca (0.11.14) 93 | bundler (>= 2.2.25) 94 | netrc (>= 0.11.0) 95 | parallel (>= 1.21.0) 96 | rbi (>= 0.1.4, < 0.2) 97 | sorbet-static-and-runtime (>= 0.5.10187) 98 | spoom (~> 1.2.0, >= 1.2.0) 99 | thor (>= 1.2.0) 100 | yard-sorbet 101 | thor (1.3.0) 102 | unicode-display_width (2.5.0) 103 | yard (0.9.34) 104 | yard-sorbet (0.8.1) 105 | sorbet-runtime (>= 0.5) 106 | yard (>= 0.9) 107 | 108 | PLATFORMS 109 | arm64-darwin-22 110 | arm64-darwin-23 111 | x86_64-darwin-20 112 | 113 | DEPENDENCIES 114 | bundler (~> 2.4.2) 115 | debug (~> 1.8) 116 | minitest (~> 5.20) 117 | minitest-reporters (~> 1.6) 118 | rake (~> 13.1) 119 | rubocop (~> 1.57) 120 | rubocop-minitest (~> 0.33.0) 121 | rubocop-rake (~> 0.6.0) 122 | rubocop-shopify (~> 2.14) 123 | rubocop-sorbet (~> 0.7) 124 | ruby-lsp-rubyfmt! 125 | sorbet-static-and-runtime 126 | tapioca 127 | 128 | BUNDLED WITH 129 | 2.4.21 130 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2023 Joshua Scharf 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ruby::Lsp::Rubyfmt 2 | 3 | ## Installation 4 | 5 | Add this line to your application's Gemfile: 6 | 7 | ```ruby 8 | gem 'ruby-lsp-rubyfmt' 9 | ``` 10 | 11 | And then execute: 12 | 13 | $ bundle 14 | 15 | Or install it yourself as: 16 | 17 | $ gem install ruby-lsp-rubyfmt 18 | 19 | ## Dependency 20 | 21 | To use this Ruby LSP Addon, you need to have [`rubyfmt`](https://github.com/fables-tales/rubyfmt) installed as it's an external dependency. 22 | 23 | This addon calls the `rubyfmt` executable in `addon.rb` 24 | 25 | If you already have homebrew installed, you can install `rubyfmt` by running the following 26 | 27 | ``` 28 | brew install rubyfmt 29 | ``` 30 | 31 | If you don't, go to https://brew.sh and install it on your machine. 32 | 33 | Check if the installation was successfully by running the following 34 | ``` 35 | rubyfmt --version 36 | ``` 37 | 38 | If it was successful, you should see a version number printed. 39 | 40 | ## Usage 41 | 42 | To use this addon, you need to modify the VS code setting `rubyLsp.formatter` in `settings.json` 43 | ``` 44 | "rubyLsp.formatter": "rubyfmt" 45 | ``` 46 | 47 | After that, open the VS code command pallete and select the option `Developer: Reload Window`. 48 | 49 | ## Development 50 | 51 | After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. 52 | 53 | To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). 54 | 55 | ## Contributing 56 | 57 | Bug reports and pull requests are welcome on GitHub at https://github.com/jscharf/ruby-lsp-rubyfmt. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. 58 | 59 | ## License 60 | 61 | The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). 62 | 63 | ## Code of Conduct 64 | 65 | Everyone interacting in the Ruby::Lsp::Rubyfmt project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ruby-lsp-rubyfmt/blob/master/CODE_OF_CONDUCT.md). 66 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require "bundler/gem_tasks" 4 | require "rake/testtask" 5 | 6 | Rake::TestTask.new(:test) do |t| 7 | t.libs << "test" 8 | t.libs << "lib" 9 | t.test_files = FileList["test/**/*_test.rb"] 10 | end 11 | 12 | task default: :test 13 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | require "bundler/setup" 5 | require "ruby/lsp/rubyfmt" 6 | 7 | # You can add fixtures and/or initialization code here to make experimenting 8 | # with your gem easier. You can also use a different console, if you like. 9 | 10 | # (If you use this, don't forget to add pry to your Gemfile!) 11 | # require "pry" 12 | # Pry.start 13 | 14 | require "irb" 15 | IRB.start(__FILE__) 16 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | set -vx 5 | 6 | bundle install 7 | 8 | # Do any other automated setup that you need to do here 9 | -------------------------------------------------------------------------------- /lib/ruby/lsp/rubyfmt.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require "ruby/lsp/rubyfmt/version" 5 | 6 | module Ruby 7 | module Lsp 8 | module Rubyfmt 9 | class Error < StandardError; end 10 | # Your code goes here... 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/ruby/lsp/rubyfmt/version.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | module Ruby 5 | module Lsp 6 | module Rubyfmt 7 | VERSION = "0.1.0" 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/ruby_lsp/ruby-lsp-rubyfmt/addon.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require "open3" 5 | 6 | module RubyLsp 7 | module RubyLspRubyfmt 8 | class Addon < RubyLsp::Addon 9 | def name 10 | "Ruby Fmt Formatter" 11 | end 12 | 13 | def activate 14 | # The first argument is an identifier users can pick to select this formatter. To use this formatter, users must 15 | # have rubyLsp.formatter configured to "rubyfmt" 16 | # The second argument is a singleton instance that implements the `FormatterRunner` interface (see below) 17 | RubyLsp::Requests::Formatting.register_formatter("rubyfmt", RubyFmtFormatterRunner.instance) 18 | end 19 | 20 | def deactivate 21 | end 22 | end 23 | 24 | # Custom formatting runner 25 | class RubyFmtFormatterRunner 26 | # Make it a singleton class 27 | include Singleton 28 | # If using Sorbet to develop the addon, then include this interface to make sure the class is properly implemented 29 | include RubyLsp::Requests::Support::FormatterRunner 30 | 31 | # Use the initialize method to perform any sort of ahead of time work. 32 | # For example, reading configurations for yourformatter since they are unlikely to change between requests 33 | def initialize 34 | end 35 | 36 | # The main part of the interface is implementing the run method. 37 | # It receives the URI and the document being formatted. 38 | # IMPORTANT: This method must return the formatted document source without mutating the original one in document 39 | def run(uri, document) 40 | output, _status = Open3.capture2("rubyfmt", stdin_data: document.source) 41 | output 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /ruby-lsp-rubyfmt.gemspec: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | lib = File.expand_path("../lib", __FILE__) 4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 5 | require "ruby/lsp/rubyfmt/version" 6 | 7 | Gem::Specification.new do |spec| 8 | spec.name = "ruby-lsp-rubyfmt" 9 | spec.version = Ruby::Lsp::Rubyfmt::VERSION 10 | spec.authors = ["Joshua Scharf"] 11 | spec.email = ["joshua@scharf.dev"] 12 | 13 | spec.summary = "Ruby LSP rubyfmt" 14 | spec.description = "An addon for the Ruby LSP that enables formatting with rubyfmt" 15 | spec.homepage = "https://github.com/jscharf/ruby-lsp-rubyfmt" 16 | spec.license = "MIT" 17 | 18 | # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' 19 | # to allow pushing to a single host or delete this section to allow pushing to any host. 20 | if spec.respond_to?(:metadata) 21 | spec.metadata["allowed_push_host"] = "https://rubygems.org" 22 | 23 | spec.metadata["homepage_uri"] = spec.homepage 24 | spec.metadata["source_code_uri"] = "https://github.com/jscharf/ruby-lsp-rubyfmt" 25 | spec.metadata["changelog_uri"] = "https://github.com/jscharf/ruby-lsp-rubyfmt" 26 | else 27 | raise( 28 | "RubyGems 2.0 or newer is required to protect against " \ 29 | "public gem pushes.", 30 | ) 31 | end 32 | 33 | # Specify which files should be added to the gem when it is released. 34 | # The `git ls-files -z` loads the files in the RubyGem that have been added into git. 35 | spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do 36 | %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 37 | end 38 | 39 | spec.bindir = "exe" 40 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 41 | spec.require_paths = ["lib"] 42 | 43 | spec.add_dependency("ruby-lsp", ">= 0.12.0") 44 | spec.add_dependency("sorbet-runtime", ">= 0.5.5685") 45 | end 46 | -------------------------------------------------------------------------------- /test/ruby/lsp/rubyfmt_test.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | require "test_helper" 5 | 6 | module RubyLsp 7 | module RubyLspRubyfmt 8 | class RubyfmtTest < Minitest::Test 9 | def test_that_it_has_a_version_number 10 | refute_nil(::Ruby::Lsp::Rubyfmt::VERSION) 11 | end 12 | 13 | def test_basic_formatting 14 | doc = RubyLsp::RubyDocument.new(source: +<<~RUBY, version: 1, uri: URI::Generic.from_path(path: __FILE__)) 15 | class Foo; def foo 16 | puts("Hello!") 17 | 'singles' + "doubles" 18 | end 19 | end 20 | RUBY 21 | 22 | output = RubyLspRubyfmt::RubyFmtFormatterRunner.instance.run("", doc) 23 | 24 | assert_equal(<<~RUBY, output) 25 | class Foo 26 | def foo 27 | puts("Hello!") 28 | "singles" + "doubles" 29 | end 30 | end 31 | RUBY 32 | end 33 | end 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # typed: false 2 | # frozen_string_literal: true 3 | 4 | $LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__)) 5 | require "ruby_lsp/internal" 6 | require "ruby_lsp/ruby-lsp-rubyfmt/addon" 7 | 8 | require "minitest/autorun" 9 | require "minitest/reporters" 10 | 11 | minitest_reporter = if ENV["SPEC_REPORTER"] 12 | Minitest::Reporters::SpecReporter.new(color: true) 13 | else 14 | Minitest::Reporters::DefaultReporter.new(color: true) 15 | end 16 | Minitest::Reporters.use!(minitest_reporter) 17 | --------------------------------------------------------------------------------