solargraph 0.23.2 → 0.23.3

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: d187a64660b1ee9c012163ae7d46c76c4d693f7a5559024cfbfb7a2e935ff946
4
- data.tar.gz: 0a399c708b6123c8a5ea4592b13ad9e93facb710a057328f7e909b2f5e36de1d
3
+ metadata.gz: 37ebc106375480d4721557e69fb312eb21c7ab0d554448e7c71c975cdebc36af
4
+ data.tar.gz: d9bd5e65e05323ade331a4d864029688bb46f1eac4456a3394e128988651c987
5
5
  SHA512:
6
- metadata.gz: 9f39a57b1a4c0e3606972305cfab712eab503c742743c0cf88b701db0c9aabd0f2c3cafa79ca29dad5f8661184698ab6818be48be9ee514a7d17fb48cba5e4af
7
- data.tar.gz: 00db80b46d3183fc2e6390b37d3b2b1bf9c0673489d837e71295b87faab8b3075409cf43261420b94cad710cd35fa01e8498418c8e3d183d4c0fea917b146f0c
6
+ metadata.gz: 98be9bd79773d42e69e81cafefa214c9c6f9ea4b0fccb59386433d81dfd4718d69c97a1670c3f006f7fd445f6282a9575cb7a8f74a35b009f5f8b513496ed905
7
+ data.tar.gz: 99fb8faa39d51725271b6bb92dde96e0b61933bd2350403784cee3aee65ca5179c879d05fe32e745608a14b9f96042d4a29e9245bd77f30b59449827a4db5205
@@ -22,7 +22,7 @@ module Solargraph
22
22
  @stopped = false
23
23
  @next_request_id = 0
24
24
  @dynamic_capabilities = Set.new
25
- @registered_capabilities = []
25
+ @registered_capabilities = Set.new
26
26
  start_change_thread
27
27
  start_diagnostics_thread
28
28
  end
@@ -252,8 +252,8 @@ module Solargraph
252
252
  def register_capabilities methods
253
253
  @register_semaphore.synchronize do
254
254
  send_request 'client/registerCapability', {
255
- registrations: methods.select{|m| @dynamic_capabilities.include?(m) and !@registered_capabilities.include?(m)}.map { |m|
256
- @registered_capabilities.push m
255
+ registrations: methods.select{|m| can_register?(m) and !registered?(m)}.map { |m|
256
+ @registered_capabilities.add m
257
257
  {
258
258
  id: m,
259
259
  method: m,
@@ -272,7 +272,7 @@ module Solargraph
272
272
  def unregister_capabilities methods
273
273
  @register_semaphore.synchronize do
274
274
  send_request 'client/unregisterCapability', {
275
- unregisterations: methods.select{|m| @registered_capabilities.include?(m)}.map{ |m|
275
+ unregisterations: methods.select{|m| registered?(m)}.map{ |m|
276
276
  @registered_capabilities.delete m
277
277
  {
278
278
  id: m,
@@ -292,16 +292,18 @@ module Solargraph
292
292
  end
293
293
  end
294
294
 
295
+ # @param method [String]
296
+ # @return [Boolean]
297
+ def can_register? method
298
+ @dynamic_capabilities.include?(method)
299
+ end
300
+
295
301
  # True if the specified method has been registered.
296
302
  #
297
303
  # @param method [String] The method name, e.g., 'textDocument/completion'
298
304
  # @return [Boolean]
299
305
  def registered? method
300
- result = nil
301
- @register_semaphore.synchronize do
302
- result = @registered_capabilities.include?(method)
303
- end
304
- result
306
+ @registered_capabilities.include?(method)
305
307
  end
306
308
 
307
309
  # True if the specified file is in the process of changing.
@@ -607,7 +609,7 @@ module Solargraph
607
609
  'textDocument/documentSymbol' => {
608
610
  documentSymbolProvider: true
609
611
  },
610
- 'workspace/workspaceSymbol' => {
612
+ 'workspace/symbol' => {
611
613
  workspaceSymbolProvider: true
612
614
  }
613
615
  }
@@ -105,9 +105,7 @@ module Solargraph
105
105
  params['capabilities'][section] and
106
106
  params['capabilities'][section][capability] and
107
107
  params['capabilities'][section][capability]['dynamicRegistration'])
108
- # HACK: Capability for workspace/workspaceSymbol is workspace/symbol
109
- adjcap = (section == 'workspace' and capability == 'symbol') ? 'workspaceSymbol' : capability
110
- host.allow_registration("#{section}/#{adjcap}") if result
108
+ host.allow_registration("#{section}/#{capability}") if result
111
109
  result
112
110
  end
113
111
  end
@@ -12,7 +12,7 @@ module Solargraph
12
12
  textDocument/definition
13
13
  textDocument/references
14
14
  textDocument/rename
15
- workspace/workspaceSymbol
15
+ workspace/symbol
16
16
  ]
17
17
  end
18
18
  end
@@ -17,7 +17,7 @@ module Solargraph::LanguageServer::Message::Workspace
17
17
  (host.options['hover'] ? y : n).push('textDocument/hover', 'textDocument/signatureHelp')
18
18
  (host.options['autoformat'] ? y : n).push('textDocument/onTypeFormatting')
19
19
  (host.options['formatting'] ? y : n).push('textDocument/formatting')
20
- (host.options['symbols'] ? y : n).push('textDocument/documentSymbol', 'workspace/workspaceSymbol')
20
+ (host.options['symbols'] ? y : n).push('textDocument/documentSymbol', 'workspace/symbol')
21
21
  (host.options['definitions'] ? y : n).push('textDocument/definition')
22
22
  (host.options['references'] ? y : n).push('textDocument/references')
23
23
  host.register_capabilities y
@@ -96,8 +96,11 @@ module Solargraph
96
96
  def overwrite filename, version
97
97
  source = source_hash[filename]
98
98
  return if source.nil?
99
- STDERR.puts "Save out of sync for #{filename}" if source.version > version
100
- open filename, File.read(filename), version
99
+ if source.version > version
100
+ STDERR.puts "Save out of sync for #{filename} (current #{source.version}, overwrite #{version})" if source.version > version
101
+ else
102
+ open filename, File.read(filename), version
103
+ end
101
104
  end
102
105
 
103
106
  # Get completion suggestions at the specified file and location.
@@ -1,3 +1,3 @@
1
1
  module Solargraph
2
- VERSION = '0.23.2'
2
+ VERSION = '0.23.3'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solargraph
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.2
4
+ version: 0.23.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2018-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser