ruby-lsp 0.0.3 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +6 -0
  3. data/.rubocop.yml +25 -0
  4. data/CHANGELOG.md +35 -0
  5. data/Gemfile +10 -6
  6. data/Gemfile.lock +63 -16
  7. data/README.md +41 -0
  8. data/Rakefile +8 -1
  9. data/VERSION +1 -1
  10. data/bin/console +19 -0
  11. data/bin/tapioca +29 -0
  12. data/dev.yml +3 -0
  13. data/exe/ruby-lsp +19 -4
  14. data/lib/ruby-lsp.rb +2 -1
  15. data/lib/ruby_lsp/cli.rb +13 -5
  16. data/lib/ruby_lsp/document.rb +43 -14
  17. data/lib/ruby_lsp/handler.rb +107 -37
  18. data/lib/ruby_lsp/internal.rb +7 -0
  19. data/lib/ruby_lsp/requests/base_request.rb +18 -5
  20. data/lib/ruby_lsp/requests/code_actions.rb +20 -8
  21. data/lib/ruby_lsp/requests/diagnostics.rb +25 -7
  22. data/lib/ruby_lsp/requests/document_highlight.rb +113 -0
  23. data/lib/ruby_lsp/requests/document_symbol.rb +56 -16
  24. data/lib/ruby_lsp/requests/folding_ranges.rb +70 -34
  25. data/lib/ruby_lsp/requests/formatting.rb +24 -14
  26. data/lib/ruby_lsp/requests/selection_ranges.rb +18 -4
  27. data/lib/ruby_lsp/requests/semantic_highlighting.rb +187 -34
  28. data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +16 -3
  29. data/lib/ruby_lsp/requests/support/rubocop_diagnostics_runner.rb +61 -0
  30. data/lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb +50 -0
  31. data/lib/ruby_lsp/requests/support/selection_range.rb +4 -0
  32. data/lib/ruby_lsp/requests/support/semantic_token_encoder.rb +24 -3
  33. data/lib/ruby_lsp/requests/support/syntax_error_diagnostic.rb +6 -0
  34. data/lib/ruby_lsp/requests.rb +13 -1
  35. data/lib/ruby_lsp/store.rb +20 -3
  36. data/rakelib/check_docs.rake +34 -6
  37. data/ruby-lsp.gemspec +7 -5
  38. data/sorbet/config +4 -0
  39. data/sorbet/rbi/.rubocop.yml +8 -0
  40. data/sorbet/rbi/gems/ansi@1.5.0.rbi +338 -0
  41. data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
  42. data/sorbet/rbi/gems/builder@3.2.4.rbi +418 -0
  43. data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
  44. data/sorbet/rbi/gems/debug@1.5.0.rbi +1273 -0
  45. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +867 -0
  46. data/sorbet/rbi/gems/io-console@0.5.11.rbi +8 -0
  47. data/sorbet/rbi/gems/irb@1.4.1.rbi +376 -0
  48. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +7325 -0
  49. data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
  50. data/sorbet/rbi/gems/minitest-reporters@1.5.0.rbi +612 -0
  51. data/sorbet/rbi/gems/minitest@5.15.0.rbi +994 -0
  52. data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
  53. data/sorbet/rbi/gems/parser@3.1.2.0.rbi +3968 -0
  54. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +734 -0
  55. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  56. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
  57. data/sorbet/rbi/gems/rake@13.0.6.rbi +1853 -0
  58. data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
  59. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1854 -0
  60. data/sorbet/rbi/gems/reline@0.3.1.rbi +1274 -0
  61. data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
  62. data/sorbet/rbi/gems/rubocop-ast@1.18.0.rbi +4180 -0
  63. data/sorbet/rbi/gems/rubocop-minitest@0.20.0.rbi +1369 -0
  64. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +246 -0
  65. data/sorbet/rbi/gems/rubocop-shopify@2.6.0.rbi +8 -0
  66. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +652 -0
  67. data/sorbet/rbi/gems/rubocop@1.30.0.rbi +36729 -0
  68. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
  69. data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
  70. data/sorbet/rbi/gems/syntax_tree@2.7.1.rbi +6777 -0
  71. data/sorbet/rbi/gems/tapioca@0.8.1.rbi +1972 -0
  72. data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
  73. data/sorbet/rbi/gems/unicode-display_width@2.1.0.rbi +27 -0
  74. data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
  75. data/sorbet/rbi/gems/webrick@1.7.0.rbi +1779 -0
  76. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +289 -0
  77. data/sorbet/rbi/gems/yard@0.9.27.rbi +13048 -0
  78. data/sorbet/rbi/shims/fiddle.rbi +4 -0
  79. data/sorbet/rbi/shims/hash.rbi +6 -0
  80. data/sorbet/rbi/shims/rdoc.rbi +4 -0
  81. data/sorbet/tapioca/config.yml +13 -0
  82. data/sorbet/tapioca/require.rb +7 -0
  83. metadata +62 -13
  84. data/lib/ruby_lsp/requests/rubocop_request.rb +0 -49
  85. data/shipit.production.yml +0 -1
@@ -0,0 +1,246 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rubocop-rake` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rubocop-rake`.
6
+
7
+ module RuboCop; end
8
+ module RuboCop::Cop; end
9
+ RuboCop::Cop::IgnoredPattern = RuboCop::Cop::AllowedPattern
10
+ module RuboCop::Cop::Rake; end
11
+
12
+ # This cop detects class or module definition in a task or namespace,
13
+ # because it is defined to the top level.
14
+ # It is confusing because the scope looks in the task or namespace,
15
+ # but actually it is defined to the top level.
16
+ #
17
+ # @example
18
+ # # bad
19
+ # task :foo do
20
+ # class C
21
+ # end
22
+ # end
23
+ #
24
+ # # bad
25
+ # namespace :foo do
26
+ # module M
27
+ # end
28
+ # end
29
+ #
30
+ # # good - It is also defined to the top level,
31
+ # # but it looks expected behavior.
32
+ # class C
33
+ # end
34
+ # task :foo do
35
+ # end
36
+ class RuboCop::Cop::Rake::ClassDefinitionInTask < ::RuboCop::Cop::Base
37
+ def on_class(node); end
38
+ def on_module(node); end
39
+ end
40
+
41
+ RuboCop::Cop::Rake::ClassDefinitionInTask::MSG = T.let(T.unsafe(nil), String)
42
+
43
+ # Rake task definition should have a description with `desc` method.
44
+ # It is useful as a documentation of task. And Rake does not display
45
+ # task that does not have `desc` by `rake -T`.
46
+ #
47
+ # Note: This cop does not require description for the default task,
48
+ # because the default task is executed with `rake` without command.
49
+ #
50
+ # @example
51
+ # # bad
52
+ # task :do_something
53
+ #
54
+ # # bad
55
+ # task :do_something do
56
+ # end
57
+ #
58
+ # # good
59
+ # desc 'Do something'
60
+ # task :do_something
61
+ #
62
+ # # good
63
+ # desc 'Do something'
64
+ # task :do_something do
65
+ # end
66
+ class RuboCop::Cop::Rake::Desc < ::RuboCop::Cop::Base
67
+ include ::RuboCop::Cop::Rake::Helper::OnTask
68
+ extend ::RuboCop::Cop::AutoCorrector
69
+
70
+ def on_task(node); end
71
+ def prerequisites(param0 = T.unsafe(nil)); end
72
+
73
+ private
74
+
75
+ # @return [Boolean]
76
+ def can_insert_desc_to?(parent); end
77
+
78
+ def parent_and_task(task_node); end
79
+
80
+ # @return [Boolean]
81
+ def task_with_desc?(node); end
82
+ end
83
+
84
+ RuboCop::Cop::Rake::Desc::MSG = T.let(T.unsafe(nil), String)
85
+
86
+ # If namespaces are defined with the same name, Rake executes the both namespaces
87
+ # in definition order.
88
+ # It is redundant. You should squash them into one definition.
89
+ # This cop detects it.
90
+ #
91
+ # @example
92
+ # # bad
93
+ # namespace :foo do
94
+ # task :bar do
95
+ # end
96
+ # end
97
+ # namespace :foo do
98
+ # task :hoge do
99
+ # end
100
+ # end
101
+ #
102
+ # # good
103
+ # namespace :foo do
104
+ # task :bar do
105
+ # end
106
+ # task :hoge do
107
+ # end
108
+ # end
109
+ class RuboCop::Cop::Rake::DuplicateNamespace < ::RuboCop::Cop::Base
110
+ include ::RuboCop::Cop::Rake::Helper::OnNamespace
111
+
112
+ # @return [DuplicateNamespace] a new instance of DuplicateNamespace
113
+ def initialize(*_arg0); end
114
+
115
+ def message_for_dup(previous:, current:, namespace:); end
116
+ def namespaces(node); end
117
+ def on_namespace(node); end
118
+ def source_location(node); end
119
+ end
120
+
121
+ RuboCop::Cop::Rake::DuplicateNamespace::MSG = T.let(T.unsafe(nil), String)
122
+
123
+ # If tasks are defined with the same name, Rake executes the both tasks
124
+ # in definition order.
125
+ # It is misleading sometimes. You should squash them into one definition.
126
+ # This cop detects it.
127
+ #
128
+ # @example
129
+ # # bad
130
+ # task :foo do
131
+ # p 'foo 1'
132
+ # end
133
+ # task :foo do
134
+ # p 'foo 2'
135
+ # end
136
+ #
137
+ # # good
138
+ # task :foo do
139
+ # p 'foo 1'
140
+ # p 'foo 2'
141
+ # end
142
+ class RuboCop::Cop::Rake::DuplicateTask < ::RuboCop::Cop::Base
143
+ include ::RuboCop::Cop::Rake::Helper::OnTask
144
+
145
+ # @return [DuplicateTask] a new instance of DuplicateTask
146
+ def initialize(*_arg0); end
147
+
148
+ def message_for_dup(previous:, current:, task_name:); end
149
+ def namespaces(node); end
150
+ def on_task(node); end
151
+ def source_location(node); end
152
+ end
153
+
154
+ RuboCop::Cop::Rake::DuplicateTask::MSG = T.let(T.unsafe(nil), String)
155
+ module RuboCop::Cop::Rake::Helper; end
156
+
157
+ module RuboCop::Cop::Rake::Helper::ClassDefinition
158
+ extend ::RuboCop::AST::NodePattern::Macros
159
+ extend ::RuboCop::Cop::Rake::Helper::ClassDefinition
160
+
161
+ def class_definition?(param0 = T.unsafe(nil)); end
162
+
163
+ # @return [Boolean]
164
+ def in_class_definition?(node); end
165
+ end
166
+
167
+ module RuboCop::Cop::Rake::Helper::OnNamespace
168
+ extend ::RuboCop::AST::NodePattern::Macros
169
+
170
+ def namespace?(param0 = T.unsafe(nil)); end
171
+ def on_send(node); end
172
+ end
173
+
174
+ module RuboCop::Cop::Rake::Helper::OnTask
175
+ extend ::RuboCop::AST::NodePattern::Macros
176
+
177
+ def on_send(node); end
178
+ def task?(param0 = T.unsafe(nil)); end
179
+ end
180
+
181
+ module RuboCop::Cop::Rake::Helper::TaskDefinition
182
+ extend ::RuboCop::AST::NodePattern::Macros
183
+ extend ::RuboCop::Cop::Rake::Helper::TaskDefinition
184
+
185
+ # @return [Boolean]
186
+ def in_task_or_namespace?(node); end
187
+
188
+ def task_or_namespace?(param0 = T.unsafe(nil)); end
189
+ end
190
+
191
+ module RuboCop::Cop::Rake::Helper::TaskName
192
+ extend ::RuboCop::Cop::Rake::Helper::TaskName
193
+
194
+ def task_name(node); end
195
+ end
196
+
197
+ # This cop detects method definition in a task or namespace,
198
+ # because it is defined to the top level.
199
+ # It is confusing because the scope looks in the task or namespace,
200
+ # but actually it is defined to the top level.
201
+ #
202
+ # @example
203
+ # # bad
204
+ # task :foo do
205
+ # def helper_method
206
+ # do_something
207
+ # end
208
+ # end
209
+ #
210
+ # # bad
211
+ # namespace :foo do
212
+ # def helper_method
213
+ # do_something
214
+ # end
215
+ # end
216
+ #
217
+ # # good - It is also defined to the top level,
218
+ # # but it looks expected behavior.
219
+ # def helper_method
220
+ # end
221
+ # task :foo do
222
+ # end
223
+ class RuboCop::Cop::Rake::MethodDefinitionInTask < ::RuboCop::Cop::Base
224
+ def on_def(node); end
225
+ def on_defs(node); end
226
+ end
227
+
228
+ RuboCop::Cop::Rake::MethodDefinitionInTask::MSG = T.let(T.unsafe(nil), String)
229
+ RuboCop::NodePattern = RuboCop::AST::NodePattern
230
+ RuboCop::ProcessedSource = RuboCop::AST::ProcessedSource
231
+ module RuboCop::Rake; end
232
+ RuboCop::Rake::CONFIG = T.let(T.unsafe(nil), Hash)
233
+ RuboCop::Rake::CONFIG_DEFAULT = T.let(T.unsafe(nil), Pathname)
234
+ class RuboCop::Rake::Error < ::StandardError; end
235
+
236
+ # Because RuboCop doesn't yet support plugins, we have to monkey patch in a
237
+ # bit of our configuration.
238
+ module RuboCop::Rake::Inject
239
+ class << self
240
+ def defaults!; end
241
+ end
242
+ end
243
+
244
+ RuboCop::Rake::PROJECT_ROOT = T.let(T.unsafe(nil), Pathname)
245
+ RuboCop::Rake::VERSION = T.let(T.unsafe(nil), String)
246
+ RuboCop::Token = RuboCop::AST::Token
@@ -0,0 +1,8 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `rubocop-shopify` gem.
5
+ # Please instead update this file by running `bin/tapioca gem rubocop-shopify`.
6
+
7
+ # THIS IS AN EMPTY RBI FILE.
8
+ # see https://github.com/Shopify/tapioca/wiki/Manual-Gem-Requires