Skip to content

Commit

Permalink
Introduce .ruby-lsp.yml config file
Browse files Browse the repository at this point in the history
  • Loading branch information
andyw8 committed Feb 29, 2024
1 parent 4d5bc2e commit 8aeeaa7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
File renamed without changes.
12 changes: 8 additions & 4 deletions lib/ruby_indexer/lib/ruby_indexer/configuration.rb
Expand Up @@ -45,16 +45,20 @@ def initialize

sig { void }
def load_config
return unless File.exist?(".index.yml")
config_file = if File.exist?(".ruby-lsp.yml")
".ruby-lsp.yml"
elsif File.exist?(".index.yml") # previously used name. Add a deprecation warning?
".index.yml"
end

config = YAML.parse_file(".index.yml")
return unless config
config = YAML.parse_file(config_file)
return unless config # TODO: why would this be nil?

config_hash = config.to_ruby
validate_config!(config_hash)
apply_config(config_hash)
rescue Psych::SyntaxError => e
raise e, "Syntax error while loading .index.yml configuration: #{e.message}"
raise e, "Syntax error while loading #{config_file} configuration: #{e.message}"
end

sig { returns(T::Array[IndexablePath]) }
Expand Down

0 comments on commit 8aeeaa7

Please sign in to comment.