ruby-lsp 0.26.8 → 0.26.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54c4bc57589939f89d9db6539395d9036679979455346126c6bb1e1421364a20
4
- data.tar.gz: debb4a5808a5d0ef964b919fd613743aa452e7ef686fb28c9fd78c1a2d178b21
3
+ metadata.gz: 7b12b079fa54de3410e0d0ab2db9bf2241c6413c3c61d3ead21d4bbcc9b4e7d6
4
+ data.tar.gz: dede13048ef29f79079271c7d20d505160f8fe24d495863e08be96c95207c6bf
5
5
  SHA512:
6
- metadata.gz: 2de6eb23b63121880662e02ebff976e69023b1fbf57a6c1a34ea620623f68ed9e6628a9e546237e93fd21e2a76050ad3033c08017539b020727e5607304e891c
7
- data.tar.gz: 1d62a8f58593ad5a04667a6bf4c64ce0111a42de7940b8d6408eaa886055f946760203898e35905d07b163764e4f12cb689264848908e97381b68fbfbc7298b8
6
+ metadata.gz: 922edf8dadc38fa037d2c157c8e0b9bbbd3c759931ac6cda3070b615a3039597028672e8632507e80689f6a8f6cc793e7a1006a49bba28d72489f541e75f2fc3
7
+ data.tar.gz: 046d2d369c16a743f71750a9a6dfed945d8e21b43bb58ad357ce1098fd731dc4e7060ffebcc96e1b78a43a3b2571ac9e31d94dc6c25c380478cb54a979c0f461
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.26.8
1
+ 0.26.9
data/exe/ruby-lsp CHANGED
@@ -21,13 +21,6 @@ parser = OptionParser.new do |opts|
21
21
  options[:time_index] = true
22
22
  end
23
23
 
24
- opts.on(
25
- "--branch [BRANCH]",
26
- "Launch the Ruby LSP using the specified branch rather than the release version",
27
- ) do |branch|
28
- options[:branch] = branch
29
- end
30
-
31
24
  opts.on("--doctor", "Run troubleshooting steps") do
32
25
  options[:doctor] = true
33
26
  end
@@ -70,7 +63,6 @@ if ENV["BUNDLE_GEMFILE"].nil?
70
63
  flags = []
71
64
  flags << "--debug" if options[:debug]
72
65
  flags << "--beta" if options[:beta]
73
- flags.push("--branch", options[:branch]) if options[:branch]
74
66
  exit exec(Gem.ruby, File.expand_path("ruby-lsp-launcher", __dir__), *flags)
75
67
  end
76
68
 
@@ -20,10 +20,8 @@ reboot = false
20
20
  workspace_uri = ARGV.first
21
21
  raw_initialize_path = File.join(".ruby-lsp", "raw_initialize")
22
22
 
23
- # Extract CLI options that affect bundle composition (e.g. --branch, --beta) from the arguments passed by the server
23
+ # Extract CLI options that affect bundle composition (e.g. --beta) from the arguments passed by the server
24
24
  cli_options = {}
25
- branch_index = ARGV.index("--branch")
26
- cli_options[:branch] = ARGV[branch_index + 1] if branch_index
27
25
  cli_options[:beta] = true if ARGV.include?("--beta")
28
26
 
29
27
  raw_initialize = if workspace_uri && !workspace_uri.start_with?("--")
@@ -57,7 +55,6 @@ pid = if Gem.win_platform?
57
55
 
58
56
  cli_flags = []
59
57
  cli_flags << "--beta" if cli_options[:beta]
60
- cli_flags.push("--branch", cli_options[:branch]) if cli_options[:branch]
61
58
 
62
59
  Process.spawn(
63
60
  Gem.ruby,
@@ -60,6 +60,7 @@ module RubyLsp
60
60
  @lines_to_comments = comments.to_h do |comment|
61
61
  [comment.location.end_line, comment]
62
62
  end #: Hash[Integer, Prism::Comment]
63
+ @sig_comments = {} #: Hash[Integer, Prism::Comment]
63
64
 
64
65
  dispatcher.register(
65
66
  self,
@@ -68,9 +69,20 @@ module RubyLsp
68
69
  :on_module_node_enter,
69
70
  :on_constant_write_node_enter,
70
71
  :on_constant_path_write_node_enter,
72
+ :on_call_node_enter,
71
73
  )
72
74
  end
73
75
 
76
+ #: (Prism::CallNode node) -> void
77
+ def on_call_node_enter(node)
78
+ return unless node.name == :sig
79
+
80
+ comment = @lines_to_comments[node.location.start_line - 1]
81
+ return unless comment
82
+
83
+ @sig_comments[node.location.end_line] = comment
84
+ end
85
+
74
86
  #: (Prism::DefNode node) -> void
75
87
  def on_def_node_enter(node)
76
88
  extract_document_link(node)
@@ -100,7 +112,7 @@ module RubyLsp
100
112
 
101
113
  #: (Prism::Node node) -> void
102
114
  def extract_document_link(node)
103
- comment = @lines_to_comments[node.location.start_line - 1]
115
+ comment = @lines_to_comments[node.location.start_line - 1] || @sig_comments[node.location.start_line - 1]
104
116
  return unless comment
105
117
 
106
118
  match = comment.location.slice.match(%r{(source://.*#\d+|pkg:gem/.*#.*)$})
@@ -162,7 +162,7 @@ module RubyLsp
162
162
 
163
163
  #: (Prism::SelfNode node) -> void
164
164
  def on_self_node_enter(node)
165
- @response_builder.add_token(node.location, :variable, [:default_library])
165
+ @response_builder.add_token(node.location, :variable, [:defaultLibrary])
166
166
  end
167
167
 
168
168
  #: (Prism::LocalVariableWriteNode node) -> void
@@ -43,7 +43,7 @@ module RubyLsp
43
43
  async: 6,
44
44
  modification: 7,
45
45
  documentation: 8,
46
- default_library: 9,
46
+ defaultLibrary: 9,
47
47
  }.freeze #: Hash[Symbol, Integer]
48
48
 
49
49
  #: ((^(Integer arg0) -> Integer | Prism::CodeUnitsCache) code_units_cache) -> void
@@ -184,8 +184,8 @@ module RubyLsp
184
184
  end
185
185
 
186
186
  # Encode an array of modifiers to positions onto a bit flag
187
- # For example, [:default_library] will be encoded as
188
- # 0b1000000000, as :default_library is the 10th bit according
187
+ # For example, [:defaultLibrary] will be encoded as
188
+ # 0b1000000000, as :defaultLibrary is the 10th bit according
189
189
  # to the token modifiers index map.
190
190
  #: (Array[Integer] modifiers) -> Integer
191
191
  def encode_modifiers(modifiers)
@@ -7,6 +7,4 @@ require_relative "compose_bundle"
7
7
  # invoke the compose method from inside a forked process
8
8
  options = {}
9
9
  options[:beta] = true if ARGV.include?("--beta")
10
- branch_index = ARGV.index("--branch")
11
- options[:branch] = ARGV[branch_index + 1] if branch_index
12
10
  compose(ARGV.first, **options)
@@ -3,6 +3,8 @@
3
3
 
4
4
  module RubyLsp
5
5
  class Server < BaseServer
6
+ NON_REPORTABLE_SETUP_ERRORS = [Bundler::GemNotFound, Bundler::GitError].freeze #: Array[singleton(StandardError)]
7
+
6
8
  # Only for testing
7
9
  #: GlobalState
8
10
  attr_reader :global_state
@@ -315,7 +317,7 @@ module RubyLsp
315
317
 
316
318
  global_state_notifications.each { |notification| send_message(notification) }
317
319
 
318
- if @setup_error
320
+ if @setup_error && NON_REPORTABLE_SETUP_ERRORS.none? { |error_class| @setup_error.is_a?(error_class) }
319
321
  send_message(Notification.telemetry(
320
322
  type: "error",
321
323
  errorMessage: @setup_error.message,
@@ -1211,7 +1213,7 @@ module RubyLsp
1211
1213
  }
1212
1214
  end
1213
1215
  end
1214
- rescue Bundler::GemNotFound, Bundler::GemfileNotFound
1216
+ rescue Bundler::GemNotFound, Bundler::GemfileNotFound, Errno::ENOENT
1215
1217
  []
1216
1218
  end
1217
1219
 
@@ -39,7 +39,6 @@ module RubyLsp
39
39
  #: (String project_path, **untyped options) -> void
40
40
  def initialize(project_path, **options)
41
41
  @project_path = project_path
42
- @branch = options[:branch] #: String?
43
42
  @launcher = options[:launcher] #: bool?
44
43
  @beta = options[:beta] #: bool?
45
44
  force_output_to_stderr! if @launcher
@@ -178,9 +177,7 @@ module RubyLsp
178
177
 
179
178
  unless @dependencies["ruby-lsp"]
180
179
  version = @beta ? "0.a" : RUBY_LSP_MIN_VERSION
181
- ruby_lsp_entry = +"gem \"ruby-lsp\", \">= #{version}\", require: false, group: :development"
182
- ruby_lsp_entry << ", github: \"Shopify/ruby-lsp\", branch: \"#{@branch}\"" if @branch
183
- parts << ruby_lsp_entry
180
+ parts << "gem \"ruby-lsp\", \">= #{version}\", require: false, group: :development"
184
181
  end
185
182
 
186
183
  unless @dependencies["debug"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-lsp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.8
4
+ version: 0.26.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify