Skip to content

Commit

Permalink
Merge pull request #2190 from Shopify/ko/ignore-test-files
Browse files Browse the repository at this point in the history
[Tapioca add-on] Use more accurate heuristic to ignore test files in lsp addon
  • Loading branch information
KaanOzkan authored Feb 11, 2025
2 parents 2857c61 + 0d96a35 commit 9fb659e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/ruby_lsp/tapioca/addon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,10 @@ def workspace_did_change_watched_files(changes)

constants = changes.flat_map do |change|
path = URI(change[:uri]).to_standardized_path
next if path.end_with?("_test.rb", "_spec.rb")
next unless file_updated?(change, path)

if File.fnmatch?("**/tapioca/**/compilers/**/*.rb", path, File::FNM_PATHNAME)
needs_compiler_reload = true
if File.fnmatch("**/fixtures/**/*.yml{,.erb}", path, File::FNM_PATHNAME | File::FNM_EXTGLOB)
has_fixtures_change = true
next
end

Expand All @@ -105,9 +104,10 @@ def workspace_did_change_watched_files(changes)
next
end

# NOTE: We only get notification for fixtures if ruby-lsp-rails is v0.3.31 or higher
if File.fnmatch("**/fixtures/**/*.yml{,.erb}", path, File::FNM_PATHNAME | File::FNM_EXTGLOB)
has_fixtures_change = true
next if File.fnmatch?("**/{test,spec,features}/**/*", path, File::FNM_PATHNAME | File::FNM_EXTGLOB)

if File.fnmatch?("**/tapioca/**/compilers/**/*.rb", path, File::FNM_PATHNAME)
needs_compiler_reload = true
next
end

Expand Down

0 comments on commit 9fb659e

Please sign in to comment.