@@ -13,7 +13,7 @@ def setup
13
13
14
14
def test_load_configuration_executes_configure_block
15
15
@config . apply_config ( { "excluded_patterns" => [ "**/fixtures/**/*.rb" ] } )
16
- uris = @config . indexables
16
+ uris = @config . indexable_uris
17
17
18
18
assert ( uris . none? { |uri | uri . full_path . include? ( "test/fixtures" ) } )
19
19
assert ( uris . none? { |uri | uri . full_path . include? ( "minitest-reporters" ) } )
@@ -22,16 +22,16 @@ def test_load_configuration_executes_configure_block
22
22
assert ( uris . none? { |uri | uri . full_path == __FILE__ } )
23
23
end
24
24
25
- def test_indexables_have_expanded_full_paths
25
+ def test_indexable_uris_have_expanded_full_paths
26
26
@config . apply_config ( { "included_patterns" => [ "**/*.rb" ] } )
27
- uris = @config . indexables
27
+ uris = @config . indexable_uris
28
28
29
29
# All paths should be expanded
30
30
assert ( uris . all? { |uri | File . absolute_path? ( uri . full_path ) } )
31
31
end
32
32
33
- def test_indexables_only_includes_gem_require_paths
34
- uris = @config . indexables
33
+ def test_indexable_uris_only_includes_gem_require_paths
34
+ uris = @config . indexable_uris
35
35
36
36
Bundler . locked_gems . specs . each do |lazy_spec |
37
37
next if lazy_spec . name == "ruby-lsp"
@@ -43,21 +43,21 @@ def test_indexables_only_includes_gem_require_paths
43
43
end
44
44
end
45
45
46
- def test_indexables_does_not_include_default_gem_path_when_in_bundle
47
- uris = @config . indexables
46
+ def test_indexable_uris_does_not_include_default_gem_path_when_in_bundle
47
+ uris = @config . indexable_uris
48
48
assert ( uris . none? { |uri | uri . full_path . start_with? ( "#{ RbConfig ::CONFIG [ "rubylibdir" ] } /psych" ) } )
49
49
end
50
50
51
- def test_indexables_includes_default_gems
52
- paths = @config . indexables . map ( &:full_path )
51
+ def test_indexable_uris_includes_default_gems
52
+ paths = @config . indexable_uris . map ( &:full_path )
53
53
54
54
assert_includes ( paths , "#{ RbConfig ::CONFIG [ "rubylibdir" ] } /pathname.rb" )
55
55
assert_includes ( paths , "#{ RbConfig ::CONFIG [ "rubylibdir" ] } /ipaddr.rb" )
56
56
assert_includes ( paths , "#{ RbConfig ::CONFIG [ "rubylibdir" ] } /erb.rb" )
57
57
end
58
58
59
- def test_indexables_includes_project_files
60
- paths = @config . indexables . map ( &:full_path )
59
+ def test_indexable_uris_includes_project_files
60
+ paths = @config . indexable_uris . map ( &:full_path )
61
61
62
62
Dir . glob ( "#{ Dir . pwd } /lib/**/*.rb" ) . each do |path |
63
63
next if path . end_with? ( "_test.rb" )
@@ -66,39 +66,39 @@ def test_indexables_includes_project_files
66
66
end
67
67
end
68
68
69
- def test_indexables_avoids_duplicates_if_bundle_path_is_inside_project
69
+ def test_indexable_uris_avoids_duplicates_if_bundle_path_is_inside_project
70
70
Bundler . settings . temporary ( path : "vendor/bundle" ) do
71
71
config = Configuration . new
72
72
73
73
assert_includes ( config . instance_variable_get ( :@excluded_patterns ) , "vendor/bundle/**/*.rb" )
74
74
end
75
75
end
76
76
77
- def test_indexables_does_not_include_gems_own_installed_files
78
- uris = @config . indexables
79
- indexables_inside_bundled_lsp = uris . select do |uri |
77
+ def test_indexable_uris_does_not_include_gems_own_installed_files
78
+ uris = @config . indexable_uris
79
+ uris_inside_bundled_lsp = uris . select do |uri |
80
80
uri . full_path . start_with? ( Bundler . bundle_path . join ( "gems" , "ruby-lsp" ) . to_s )
81
81
end
82
82
83
83
assert_empty (
84
- indexables_inside_bundled_lsp ,
85
- "Indexables should not include files from the gem currently being worked on. " \
86
- "Included: #{ indexables_inside_bundled_lsp . map ( &:full_path ) } " ,
84
+ uris_inside_bundled_lsp ,
85
+ "Indexable URIs should not include files from the gem currently being worked on. " \
86
+ "Included: #{ uris_inside_bundled_lsp . map ( &:full_path ) } " ,
87
87
)
88
88
end
89
89
90
- def test_indexables_does_not_include_non_ruby_files_inside_rubylibdir
90
+ def test_indexable_uris_does_not_include_non_ruby_files_inside_rubylibdir
91
91
path = Pathname . new ( RbConfig ::CONFIG [ "rubylibdir" ] ) . join ( "extra_file.txt" ) . to_s
92
92
FileUtils . touch ( path )
93
93
94
- uris = @config . indexables
94
+ uris = @config . indexable_uris
95
95
assert ( uris . none? { |uri | uri . full_path == path } )
96
96
ensure
97
97
FileUtils . rm ( T . must ( path ) )
98
98
end
99
99
100
100
def test_paths_are_unique
101
- uris = @config . indexables
101
+ uris = @config . indexable_uris
102
102
assert_equal ( uris . uniq . length , uris . length )
103
103
end
104
104
@@ -128,7 +128,7 @@ def test_magic_comments_regex
128
128
end
129
129
end
130
130
131
- def test_indexables_respect_given_workspace_path
131
+ def test_indexable_uris_respect_given_workspace_path
132
132
Dir . mktmpdir do |dir |
133
133
FileUtils . mkdir ( File . join ( dir , "ignore" ) )
134
134
FileUtils . touch ( File . join ( dir , "ignore" , "file0.rb" ) )
@@ -138,10 +138,10 @@ def test_indexables_respect_given_workspace_path
138
138
@config . apply_config ( { "excluded_patterns" => [ "ignore/**/*.rb" ] } )
139
139
@config . workspace_path = dir
140
140
141
- uris = @config . indexables
141
+ uris = @config . indexable_uris
142
142
assert ( uris . none? { |uri | uri . full_path . start_with? ( File . join ( dir , "ignore" ) ) } )
143
143
144
- # After switching the workspace path, all indexables will be found in one of these places:
144
+ # After switching the workspace path, all indexable URIs will be found in one of these places:
145
145
# - The new workspace path
146
146
# - The Ruby LSP's own code (because Bundler is requiring the dependency from source)
147
147
# - Bundled gems
@@ -162,7 +162,7 @@ def test_includes_top_level_files
162
162
FileUtils . touch ( File . join ( dir , "find_me.rb" ) )
163
163
@config . workspace_path = dir
164
164
165
- uris = @config . indexables
165
+ uris = @config . indexable_uris
166
166
assert ( uris . find { |u | File . basename ( u . full_path ) == "find_me.rb" } )
167
167
end
168
168
end
0 commit comments