Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply indexing configuration to ruby-lsp-doctor #1827

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

andyw8
Copy link
Contributor

@andyw8 andyw8 commented Mar 25, 2024

Motivation

Due to the changes in #1814, the ruby-lsp-doctor tool needs to have the configuration loaded.

Implementation

Check if an .index.yml exists, and load configuration if so.

Automated Tests

Since this is a troubleshooting tool, I think tests are not critical.

Manual Tests

  • Create a file "foo/bar.rb"
  • Run the index and pipe through grep to confirm foo/bar.rb is listed
  • Update .index.yml to exclude "**/foo**"
  • Run the index and pipe through grep to confirm foo/bar.rb is no longer listed

Notes:

@andyw8 andyw8 added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels Mar 25, 2024
@andyw8 andyw8 requested a review from a team as a code owner March 25, 2024 19:26
@andyw8 andyw8 requested review from st0012 and egiurleo March 25, 2024 19:26
@@ -4,6 +4,9 @@
$LOAD_PATH.unshift(File.expand_path("../lib", __dir__))
require "ruby_lsp/internal"

if File.exist?(".index.yml")
RubyIndexer.configuration.apply_config(YAML.parse_file(".index.yml").to_ruby)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may file to parse. Let's rescue here and warn if the YAML file is invalid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made it abort instead of warn, since a warn might be easy to miss among the other output.

@andyw8 andyw8 enabled auto-merge (squash) March 27, 2024 18:50
@andyw8 andyw8 merged commit f57d2b6 into main Mar 27, 2024
39 checks passed
@andyw8 andyw8 deleted the andyw8/apply-index-config-to-ruby-lsp-doctor branch March 27, 2024 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants