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,4 @@
1
+ # typed: true
2
+
3
+ module Fiddle::CParser; end
4
+ module Fiddle::Importer; end
@@ -0,0 +1,6 @@
1
+ # typed: true
2
+
3
+ class Hash
4
+ sig { returns(String) }
5
+ def to_json; end
6
+ end
@@ -0,0 +1,4 @@
1
+ # typed: true
2
+
3
+ module RDoc; end
4
+ class RDoc::Task; end
@@ -0,0 +1,13 @@
1
+ gem:
2
+ # Add your `gem` command parameters here:
3
+ #
4
+ # exclude:
5
+ # - gem_name
6
+ # doc: true
7
+ # workers: 5
8
+ dsl:
9
+ # Add your `dsl` command parameters here:
10
+ #
11
+ # exclude:
12
+ # - SomeGeneratorName
13
+ # workers: 5
@@ -0,0 +1,7 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ # Add your extra requires here (`bin/tapioca require` can be used to boostrap this list)
5
+
6
+ require "language_server-protocol"
7
+ require "syntax_tree"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-05-27 00:00:00.000000000 Z
11
+ date: 2022-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: language_server-protocol
@@ -25,34 +25,34 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rubocop
28
+ name: sorbet-runtime
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: syntax_tree
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2.3'
47
+ version: '2.4'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '2.3'
55
- description: A simple language server for ruby
54
+ version: '2.4'
55
+ description: An opinionated language server for Ruby
56
56
  email:
57
57
  - ruby@shopify.com
58
58
  executables:
@@ -78,7 +78,9 @@ files:
78
78
  - README.md
79
79
  - Rakefile
80
80
  - VERSION
81
+ - bin/console
81
82
  - bin/rubocop
83
+ - bin/tapioca
82
84
  - bin/test
83
85
  - dev.yml
84
86
  - exe/ruby-lsp
@@ -86,17 +88,20 @@ files:
86
88
  - lib/ruby_lsp/cli.rb
87
89
  - lib/ruby_lsp/document.rb
88
90
  - lib/ruby_lsp/handler.rb
91
+ - lib/ruby_lsp/internal.rb
89
92
  - lib/ruby_lsp/requests.rb
90
93
  - lib/ruby_lsp/requests/base_request.rb
91
94
  - lib/ruby_lsp/requests/code_actions.rb
92
95
  - lib/ruby_lsp/requests/diagnostics.rb
96
+ - lib/ruby_lsp/requests/document_highlight.rb
93
97
  - lib/ruby_lsp/requests/document_symbol.rb
94
98
  - lib/ruby_lsp/requests/folding_ranges.rb
95
99
  - lib/ruby_lsp/requests/formatting.rb
96
- - lib/ruby_lsp/requests/rubocop_request.rb
97
100
  - lib/ruby_lsp/requests/selection_ranges.rb
98
101
  - lib/ruby_lsp/requests/semantic_highlighting.rb
99
102
  - lib/ruby_lsp/requests/support/rubocop_diagnostic.rb
103
+ - lib/ruby_lsp/requests/support/rubocop_diagnostics_runner.rb
104
+ - lib/ruby_lsp/requests/support/rubocop_formatting_runner.rb
100
105
  - lib/ruby_lsp/requests/support/selection_range.rb
101
106
  - lib/ruby_lsp/requests/support/semantic_token_encoder.rb
102
107
  - lib/ruby_lsp/requests/support/syntax_error_diagnostic.rb
@@ -104,7 +109,51 @@ files:
104
109
  - rakelib/check_docs.rake
105
110
  - ruby-lsp.gemspec
106
111
  - service.yml
107
- - shipit.production.yml
112
+ - sorbet/config
113
+ - sorbet/rbi/.rubocop.yml
114
+ - sorbet/rbi/gems/ansi@1.5.0.rbi
115
+ - sorbet/rbi/gems/ast@2.4.2.rbi
116
+ - sorbet/rbi/gems/builder@3.2.4.rbi
117
+ - sorbet/rbi/gems/coderay@1.1.3.rbi
118
+ - sorbet/rbi/gems/debug@1.5.0.rbi
119
+ - sorbet/rbi/gems/diff-lcs@1.5.0.rbi
120
+ - sorbet/rbi/gems/io-console@0.5.11.rbi
121
+ - sorbet/rbi/gems/irb@1.4.1.rbi
122
+ - sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi
123
+ - sorbet/rbi/gems/method_source@1.0.0.rbi
124
+ - sorbet/rbi/gems/minitest-reporters@1.5.0.rbi
125
+ - sorbet/rbi/gems/minitest@5.15.0.rbi
126
+ - sorbet/rbi/gems/parallel@1.22.1.rbi
127
+ - sorbet/rbi/gems/parser@3.1.2.0.rbi
128
+ - sorbet/rbi/gems/prettier_print@0.1.0.rbi
129
+ - sorbet/rbi/gems/pry@0.14.1.rbi
130
+ - sorbet/rbi/gems/rainbow@3.1.1.rbi
131
+ - sorbet/rbi/gems/rake@13.0.6.rbi
132
+ - sorbet/rbi/gems/rbi@0.0.14.rbi
133
+ - sorbet/rbi/gems/regexp_parser@2.5.0.rbi
134
+ - sorbet/rbi/gems/reline@0.3.1.rbi
135
+ - sorbet/rbi/gems/rexml@3.2.5.rbi
136
+ - sorbet/rbi/gems/rubocop-ast@1.18.0.rbi
137
+ - sorbet/rbi/gems/rubocop-minitest@0.20.0.rbi
138
+ - sorbet/rbi/gems/rubocop-rake@0.6.0.rbi
139
+ - sorbet/rbi/gems/rubocop-shopify@2.6.0.rbi
140
+ - sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi
141
+ - sorbet/rbi/gems/rubocop@1.30.0.rbi
142
+ - sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi
143
+ - sorbet/rbi/gems/spoom@1.1.11.rbi
144
+ - sorbet/rbi/gems/syntax_tree@2.7.1.rbi
145
+ - sorbet/rbi/gems/tapioca@0.8.1.rbi
146
+ - sorbet/rbi/gems/thor@1.2.1.rbi
147
+ - sorbet/rbi/gems/unicode-display_width@2.1.0.rbi
148
+ - sorbet/rbi/gems/unparser@0.6.5.rbi
149
+ - sorbet/rbi/gems/webrick@1.7.0.rbi
150
+ - sorbet/rbi/gems/yard-sorbet@0.6.1.rbi
151
+ - sorbet/rbi/gems/yard@0.9.27.rbi
152
+ - sorbet/rbi/shims/fiddle.rbi
153
+ - sorbet/rbi/shims/hash.rbi
154
+ - sorbet/rbi/shims/rdoc.rbi
155
+ - sorbet/tapioca/config.yml
156
+ - sorbet/tapioca/require.rb
108
157
  homepage: https://github.com/Shopify/ruby-lsp
109
158
  licenses:
110
159
  - MIT
@@ -118,15 +167,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
167
  requirements:
119
168
  - - ">="
120
169
  - !ruby/object:Gem::Version
121
- version: '0'
170
+ version: 2.7.3
122
171
  required_rubygems_version: !ruby/object:Gem::Requirement
123
172
  requirements:
124
173
  - - ">="
125
174
  - !ruby/object:Gem::Version
126
175
  version: '0'
127
176
  requirements: []
128
- rubygems_version: 3.2.20
177
+ rubygems_version: 3.3.3
129
178
  signing_key:
130
179
  specification_version: 4
131
- summary: A simple language server for ruby
180
+ summary: An opinionated language server for Ruby
132
181
  test_files: []
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "rubocop"
4
- require "cgi"
5
-
6
- module RubyLsp
7
- module Requests
8
- # :nodoc:
9
- class RuboCopRequest < RuboCop::Runner
10
- COMMON_RUBOCOP_FLAGS = [
11
- "--stderr", # Print any output to stderr so that our stdout does not get polluted
12
- "--format",
13
- "RuboCop::Formatter::BaseFormatter", # Suppress any output by using the base formatter
14
- ].freeze
15
-
16
- attr_reader :file, :text
17
-
18
- def self.run(uri, document)
19
- new(uri, document).run
20
- end
21
-
22
- def initialize(uri, document)
23
- @file = CGI.unescape(URI.parse(uri).path)
24
- @document = document
25
- @text = document.source
26
- @uri = uri
27
-
28
- super(
29
- ::RuboCop::Options.new.parse(rubocop_flags).first,
30
- ::RuboCop::ConfigStore.new
31
- )
32
- end
33
-
34
- def run
35
- # We communicate with Rubocop via stdin
36
- @options[:stdin] = text
37
-
38
- # Invoke the actual run method with just this file in `paths`
39
- super([file])
40
- end
41
-
42
- private
43
-
44
- def rubocop_flags
45
- COMMON_RUBOCOP_FLAGS
46
- end
47
- end
48
- end
49
- end
@@ -1 +0,0 @@
1
- # default config