ruby-lsp 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/VERSION +1 -1
  4. data/lib/ruby_lsp/handler.rb +0 -19
  5. data/lib/ruby_lsp/requests/document_link.rb +59 -0
  6. data/lib/ruby_lsp/requests/semantic_highlighting.rb +11 -5
  7. data/lib/ruby_lsp/requests/support/highlight_target.rb +2 -1
  8. data/lib/ruby_lsp/requests/support/rubocop_diagnostic.rb +9 -2
  9. data/lib/ruby_lsp/requests.rb +2 -0
  10. data/lib/ruby_lsp/server.rb +51 -19
  11. metadata +3 -69
  12. data/.github/dependabot.yml +0 -11
  13. data/.github/probots.yml +0 -2
  14. data/.github/pull_request_template.md +0 -15
  15. data/.github/workflows/ci.yml +0 -31
  16. data/.github/workflows/publish_docs.yml +0 -32
  17. data/.gitignore +0 -9
  18. data/.rubocop.yml +0 -40
  19. data/.vscode/extensions.json +0 -5
  20. data/.vscode/settings.json +0 -5
  21. data/.vscode/tasks.json +0 -25
  22. data/CODE_OF_CONDUCT.md +0 -78
  23. data/Gemfile +0 -18
  24. data/Gemfile.lock +0 -126
  25. data/Rakefile +0 -28
  26. data/bin/console +0 -19
  27. data/bin/rubocop +0 -29
  28. data/bin/tapioca +0 -29
  29. data/bin/test +0 -9
  30. data/dev.yml +0 -20
  31. data/rakelib/check_docs.rake +0 -81
  32. data/ruby-lsp.gemspec +0 -27
  33. data/service.yml +0 -2
  34. data/sorbet/config +0 -4
  35. data/sorbet/rbi/.rubocop.yml +0 -8
  36. data/sorbet/rbi/gems/ansi@1.5.0.rbi +0 -338
  37. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -522
  38. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -418
  39. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -8
  40. data/sorbet/rbi/gems/debug@1.5.0.rbi +0 -1273
  41. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -867
  42. data/sorbet/rbi/gems/io-console@0.5.11.rbi +0 -8
  43. data/sorbet/rbi/gems/irb@1.4.1.rbi +0 -376
  44. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +0 -7325
  45. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -8
  46. data/sorbet/rbi/gems/minitest-reporters@1.5.0.rbi +0 -612
  47. data/sorbet/rbi/gems/minitest@5.15.0.rbi +0 -994
  48. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -163
  49. data/sorbet/rbi/gems/parser@3.1.2.0.rbi +0 -3968
  50. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +0 -734
  51. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -8
  52. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -227
  53. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -1853
  54. data/sorbet/rbi/gems/rbi@0.0.14.rbi +0 -2337
  55. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +0 -1854
  56. data/sorbet/rbi/gems/reline@0.3.1.rbi +0 -1274
  57. data/sorbet/rbi/gems/rexml@3.2.5.rbi +0 -3852
  58. data/sorbet/rbi/gems/rubocop-ast@1.18.0.rbi +0 -4180
  59. data/sorbet/rbi/gems/rubocop-minitest@0.20.0.rbi +0 -1369
  60. data/sorbet/rbi/gems/rubocop-rake@0.6.0.rbi +0 -246
  61. data/sorbet/rbi/gems/rubocop-shopify@2.6.0.rbi +0 -8
  62. data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +0 -652
  63. data/sorbet/rbi/gems/rubocop@1.30.0.rbi +0 -36729
  64. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -732
  65. data/sorbet/rbi/gems/spoom@1.1.11.rbi +0 -1600
  66. data/sorbet/rbi/gems/syntax_tree@2.7.1.rbi +0 -6777
  67. data/sorbet/rbi/gems/tapioca@0.8.1.rbi +0 -1972
  68. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -2921
  69. data/sorbet/rbi/gems/unicode-display_width@2.1.0.rbi +0 -27
  70. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -2789
  71. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -1779
  72. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +0 -289
  73. data/sorbet/rbi/gems/yard@0.9.27.rbi +0 -13048
  74. data/sorbet/rbi/shims/fiddle.rbi +0 -4
  75. data/sorbet/rbi/shims/hash.rbi +0 -6
  76. data/sorbet/rbi/shims/rdoc.rbi +0 -4
  77. data/sorbet/tapioca/config.yml +0 -13
  78. data/sorbet/tapioca/require.rb +0 -7
data/CODE_OF_CONDUCT.md DELETED
@@ -1,78 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to make participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, sex characteristics, gender identity and expression,
9
- level of experience, education, socio-economic status, nationality, personal
10
- appearance, race, religion, or sexual identity and orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies within all project spaces, and it also applies when
49
- an individual is representing the project or its community in public spaces.
50
- Examples of representing a project or community include using an official
51
- project e-mail address, posting via an official social media account, or acting
52
- as an appointed representative at an online or offline event. Representation of
53
- a project may be further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at opensource@shopify.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
-
73
- [homepage]: https://www.contributor-covenant.org
74
-
75
- For answers to common questions about this code of conduct, see
76
- https://www.contributor-covenant.org/faq
77
-
78
-
data/Gemfile DELETED
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gemspec
6
-
7
- gem "debug", "~> 1.5", require: false
8
- gem "minitest", "~> 5.16"
9
- gem "minitest-reporters", "~> 1.5"
10
- gem "rake", "~> 13.0"
11
- gem "rubocop", ">= 1.0.0"
12
- gem "rubocop-shopify", "~> 2.8", require: false
13
- gem "rubocop-minitest", "~> 0.20.1", require: false
14
- gem "rubocop-rake", "~> 0.6.0", require: false
15
- gem "rubocop-sorbet", "~> 0.6", require: false
16
- gem "sorbet-static-and-runtime"
17
- gem "tapioca", "~> 0.8", require: false
18
- gem "yard", "~> 0.9", require: false
data/Gemfile.lock DELETED
@@ -1,126 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- ruby-lsp (0.2.1)
5
- language_server-protocol
6
- sorbet-runtime
7
- syntax_tree (>= 2.4)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- ansi (1.5.0)
13
- ast (2.4.2)
14
- builder (3.2.4)
15
- coderay (1.1.3)
16
- debug (1.5.0)
17
- irb (>= 1.3.6)
18
- reline (>= 0.2.7)
19
- diff-lcs (1.5.0)
20
- io-console (0.5.11)
21
- irb (1.4.1)
22
- reline (>= 0.3.0)
23
- json (2.6.2)
24
- language_server-protocol (3.16.0.3)
25
- method_source (1.0.0)
26
- minitest (5.16.2)
27
- minitest-reporters (1.5.0)
28
- ansi
29
- builder
30
- minitest (>= 5.0)
31
- ruby-progressbar
32
- parallel (1.22.1)
33
- parser (3.1.2.0)
34
- ast (~> 2.4.1)
35
- prettier_print (0.1.0)
36
- pry (0.14.1)
37
- coderay (~> 1.1)
38
- method_source (~> 1.0)
39
- rainbow (3.1.1)
40
- rake (13.0.6)
41
- rbi (0.0.15)
42
- ast
43
- parser (>= 2.6.4.0)
44
- sorbet-runtime (>= 0.5.9204)
45
- unparser
46
- regexp_parser (2.5.0)
47
- reline (0.3.1)
48
- io-console (~> 0.5)
49
- rexml (3.2.5)
50
- rubocop (1.31.1)
51
- json (~> 2.3)
52
- parallel (~> 1.10)
53
- parser (>= 3.1.0.0)
54
- rainbow (>= 2.2.2, < 4.0)
55
- regexp_parser (>= 1.8, < 3.0)
56
- rexml (>= 3.2.5, < 4.0)
57
- rubocop-ast (>= 1.18.0, < 2.0)
58
- ruby-progressbar (~> 1.7)
59
- unicode-display_width (>= 1.4.0, < 3.0)
60
- rubocop-ast (1.18.0)
61
- parser (>= 3.1.1.0)
62
- rubocop-minitest (0.20.1)
63
- rubocop (>= 0.90, < 2.0)
64
- rubocop-rake (0.6.0)
65
- rubocop (~> 1.0)
66
- rubocop-shopify (2.8.0)
67
- rubocop (~> 1.31)
68
- rubocop-sorbet (0.6.11)
69
- rubocop (>= 0.90.0)
70
- ruby-progressbar (1.11.0)
71
- sorbet (0.5.10139)
72
- sorbet-static (= 0.5.10139)
73
- sorbet-runtime (0.5.10139)
74
- sorbet-static (0.5.10139-universal-darwin-21)
75
- sorbet-static (0.5.10139-x86_64-linux)
76
- sorbet-static-and-runtime (0.5.10139)
77
- sorbet (= 0.5.10139)
78
- sorbet-runtime (= 0.5.10139)
79
- spoom (1.1.11)
80
- sorbet (>= 0.5.9204)
81
- sorbet-runtime (>= 0.5.9204)
82
- thor (>= 0.19.2)
83
- syntax_tree (2.8.0)
84
- prettier_print
85
- tapioca (0.8.3)
86
- bundler (>= 1.17.3)
87
- parallel (>= 1.21.0)
88
- pry (>= 0.12.2)
89
- rbi (~> 0.0.0, >= 0.0.14)
90
- sorbet-static-and-runtime (>= 0.5.9204)
91
- spoom (~> 1.1.0, >= 1.1.11)
92
- thor (>= 1.2.0)
93
- yard-sorbet
94
- thor (1.2.1)
95
- unicode-display_width (2.2.0)
96
- unparser (0.6.5)
97
- diff-lcs (~> 1.3)
98
- parser (>= 3.1.0)
99
- webrick (1.7.0)
100
- yard (0.9.28)
101
- webrick (~> 1.7.0)
102
- yard-sorbet (0.6.1)
103
- sorbet-runtime (>= 0.5)
104
- yard (>= 0.9)
105
-
106
- PLATFORMS
107
- arm64-darwin-21
108
- x86_64-linux
109
-
110
- DEPENDENCIES
111
- debug (~> 1.5)
112
- minitest (~> 5.16)
113
- minitest-reporters (~> 1.5)
114
- rake (~> 13.0)
115
- rubocop (>= 1.0.0)
116
- rubocop-minitest (~> 0.20.1)
117
- rubocop-rake (~> 0.6.0)
118
- rubocop-shopify (~> 2.8)
119
- rubocop-sorbet (~> 0.6)
120
- ruby-lsp!
121
- sorbet-static-and-runtime
122
- tapioca (~> 0.8)
123
- yard (~> 0.9)
124
-
125
- BUNDLED WITH
126
- 2.3.7
data/Rakefile DELETED
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rake/testtask"
5
- require "yard"
6
-
7
- Rake::TestTask.new(:test) do |t|
8
- t.libs << "test"
9
- t.libs << "lib"
10
- t.test_files = FileList["test/**/*_test.rb"]
11
- end
12
-
13
- YARD::Rake::YardocTask.new do |t|
14
- t.options = [
15
- "--markup",
16
- "markdown",
17
- "--output-dir",
18
- "docs",
19
- "--asset",
20
- "misc",
21
- ]
22
- end
23
-
24
- require "rubocop/rake_task"
25
-
26
- RuboCop::RakeTask.new
27
-
28
- task default: [:test]
data/bin/console DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # typed: strict
3
- # frozen_string_literal: true
4
-
5
- require "bundler/setup"
6
- require_relative "../lib/ruby_lsp/internal"
7
- require "irb"
8
-
9
- extend T::Sig
10
-
11
- sig { params(source: String).returns(RubyLsp::Document) }
12
- def new_doc(source)
13
- RubyLsp::Document.new(source)
14
- end
15
-
16
- @source = T.let(File.read(File.expand_path("../lib/ruby_lsp/handler.rb", __dir__)), String)
17
- @document = T.let(new_doc(@source), RubyLsp::Document)
18
-
19
- IRB.start(__FILE__)
data/bin/rubocop DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'rubocop' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("rubocop", "rubocop")
data/bin/tapioca DELETED
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- #
5
- # This file was generated by Bundler.
6
- #
7
- # The application 'tapioca' is installed as part of a gem, and
8
- # this file is here to facilitate running it.
9
- #
10
-
11
- require "pathname"
12
- ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
- Pathname.new(__FILE__).realpath)
14
-
15
- bundle_binstub = File.expand_path("../bundle", __FILE__)
16
-
17
- if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
- load(bundle_binstub)
20
- else
21
- abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
- Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
- end
24
- end
25
-
26
- require "rubygems"
27
- require "bundler/setup"
28
-
29
- load Gem.bin_path("tapioca", "tapioca")
data/bin/test DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- if [[ 2 -eq $# ]]; then
4
- bundle exec rake TEST="$1" TESTOPTS="-n='/$2/'"
5
- elif [[ 1 -eq $# ]]; then
6
- bundle exec rake TEST="$1"
7
- else
8
- bundle exec rake "$@"
9
- fi
data/dev.yml DELETED
@@ -1,20 +0,0 @@
1
- name: ruby-lsp
2
-
3
- type: ruby
4
-
5
- up:
6
- - ruby: 3.1.1
7
- - bundler:
8
- gemfile: Gemfile
9
-
10
- commands:
11
- server: exe/ruby-lsp
12
- style: bin/rubocop
13
- typecheck:
14
- aliases: ["tc"]
15
- run: "bundle exec srb tc"
16
- test:
17
- syntax:
18
- argument: file
19
- optional: args...
20
- run: bin/test
@@ -1,81 +0,0 @@
1
- # typed: false
2
- # frozen_string_literal: true
3
-
4
- desc "Check if all LSP requests are documented"
5
- task :check_docs do
6
- require "sorbet-runtime"
7
- require "language_server-protocol"
8
- require "syntax_tree"
9
- require "logger"
10
- require "ruby_lsp/requests/base_request"
11
- require "ruby_lsp/requests/support/rubocop_diagnostics_runner"
12
- require "ruby_lsp/requests/support/rubocop_formatting_runner"
13
-
14
- request_doc_files = Dir["#{Dir.pwd}/lib/ruby_lsp/requests/*.rb"]
15
- request_doc_files << "#{Dir.pwd}/lib/ruby_lsp/requests.rb"
16
-
17
- request_doc_files.each do |file|
18
- require(file)
19
- YARD.parse(file, [], Logger::Severity::FATAL)
20
- end
21
-
22
- spec_matcher = %r{\(https://microsoft.github.io/language-server-protocol/specification#.*\)}
23
- error_messages = RubyLsp::Requests
24
- .constants # rubocop:disable Sorbet/ConstantsFromStrings
25
- .each_with_object(Hash.new { |h, k| h[k] = [] }) do |request, errors|
26
- next if request == :Support
27
-
28
- full_name = "RubyLsp::Requests::#{request}"
29
- docs = YARD::Registry.at(full_name).docstring
30
- next if /:nodoc:/.match?(docs)
31
-
32
- if docs.empty?
33
- errors[full_name] << "Missing documentation for request handler class"
34
- elsif !spec_matcher.match?(docs)
35
- errors[full_name] << <<~MESSAGE
36
- Documentation for request handler classes must link to the official LSP specification.
37
-
38
- For example, if your request handles text document hover, you should add a link to
39
- https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_hover.
40
- MESSAGE
41
- elsif !%r{!\[.* demo\]\(\.\./\.\./misc/.*\.gif\)}.match?(docs)
42
- errors[full_name] << <<~MESSAGE
43
- Documentation for request handler class must contain a demonstration GIF, in the following format:
44
-
45
- ![Request name demo](../../misc/request_name.gif)
46
-
47
- See the misc/ folder for examples.
48
- MESSAGE
49
- elsif !/# Example/.match?(docs)
50
- errors[full_name] << <<~MESSAGE
51
- Documentation for request handler class must contain an example.
52
-
53
- # # Example
54
- #
55
- # ```ruby
56
- # def my_method # <-- something happens here
57
- # end
58
- # ```
59
- MESSAGE
60
- end
61
-
62
- supported_features = YARD::Registry.at("RubyLsp::Requests").docstring
63
- next if /- {#{full_name}}/.match?(supported_features)
64
-
65
- errors[full_name] << <<~MESSAGE
66
- Documentation for request handler class must be listed in the RubyLsp::Requests module documentation.
67
- MESSAGE
68
- end
69
-
70
- formatted_errors = error_messages.map { |name, errors| "#{name}: #{errors.join(", ")}" }
71
-
72
- if error_messages.any?
73
- puts <<~MESSAGE
74
- The following requests have invalid documentation:
75
-
76
- #{formatted_errors.join("\n")}
77
- MESSAGE
78
-
79
- exit!
80
- end
81
- end
data/ruby-lsp.gemspec DELETED
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Gem::Specification.new do |s|
4
- s.name = "ruby-lsp"
5
- s.version = File.read("VERSION").strip
6
- s.authors = ["Shopify"]
7
- s.email = ["ruby@shopify.com"]
8
- s.metadata["allowed_push_host"] = "https://rubygems.org"
9
-
10
- s.summary = "An opinionated language server for Ruby"
11
- s.description = "An opinionated language server for Ruby"
12
- s.homepage = "https://github.com/Shopify/ruby-lsp"
13
- s.license = "MIT"
14
-
15
- s.files = Dir.chdir(File.expand_path(__dir__)) do
16
- %x(git ls-files -z).split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features|misc)/}) }
17
- end
18
- s.bindir = "exe"
19
- s.executables = s.files.grep(/\Aexe/) { |f| File.basename(f) }
20
- s.require_paths = ["lib"]
21
-
22
- s.add_dependency("language_server-protocol")
23
- s.add_dependency("sorbet-runtime")
24
- s.add_dependency("syntax_tree", ">= 2.4")
25
-
26
- s.required_ruby_version = ">= 2.7.3"
27
- end
data/service.yml DELETED
@@ -1,2 +0,0 @@
1
- classification: library
2
-
data/sorbet/config DELETED
@@ -1,4 +0,0 @@
1
- --dir
2
- .
3
- --ignore=vendor/
4
- --ignore=test/fixtures/
@@ -1,8 +0,0 @@
1
- inherit_gem:
2
- rubocop-sorbet: config/rbi.yml
3
-
4
- Lint/EmptyFile:
5
- Enabled: false
6
-
7
- Sorbet/TypeAliasName:
8
- Enabled: false