solargraph 0.43.1 → 0.43.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/solargraph/language_server/host/message_worker.rb +10 -7
- data/lib/solargraph/language_server/host.rb +24 -30
- data/lib/solargraph/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e671eddad2fe717ad573954a63154bd89adbc12c9899c3f8762bf38a93160657
|
4
|
+
data.tar.gz: 2224d1457b9e8f7279bfa89b2777fe3d60a0a2283de4047930bebb79034a1ac4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76ffe1331d8020eed92c39d2c4886ce7d01e4143a8b8264ac1bf4011335fabfd32a48f16a7099f889fed2e7c485e2e9cbf09714f677cd6e9396381032522f67a
|
7
|
+
data.tar.gz: 9c6da25c26ed209af38be4a0bc8d7a6ce826fb3012bce650089e982f829f4c8b14807ed0f7d1ecdeacd9b737bedd9d682440a9701a864313a83e60182771ade0
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
## 0.43.
|
1
|
+
## 0.43.2 - September 23, 2021
|
2
|
+
- Synchronize server requests (#461)
|
3
|
+
|
4
|
+
## 0.43.1 - September 20, 2021
|
2
5
|
- Complete nested namespaces in open gates
|
3
6
|
- SourceMap::Mapper reports filename for encoding errors (#474)
|
4
7
|
- Handle request on a specific thread, and cancel completion when there has newer completion request (#459)
|
@@ -23,16 +23,18 @@ module Solargraph
|
|
23
23
|
def stopped?
|
24
24
|
@stopped
|
25
25
|
end
|
26
|
+
|
26
27
|
def stop
|
27
28
|
@stopped = true
|
28
29
|
end
|
29
30
|
|
30
|
-
# @param message
|
31
|
+
# @param message [Hash] The message should be handle. will pass back to Host#receive
|
32
|
+
# @return [void]
|
31
33
|
def queue(message)
|
32
|
-
@mutex.synchronize
|
34
|
+
@mutex.synchronize do
|
33
35
|
messages.push(message)
|
34
36
|
@resource.signal
|
35
|
-
|
37
|
+
end
|
36
38
|
end
|
37
39
|
|
38
40
|
def start
|
@@ -42,13 +44,14 @@ module Solargraph
|
|
42
44
|
tick until stopped?
|
43
45
|
end
|
44
46
|
end
|
47
|
+
|
45
48
|
def tick
|
46
|
-
message = @mutex.synchronize
|
49
|
+
message = @mutex.synchronize do
|
47
50
|
@resource.wait(@mutex) if messages.empty?
|
48
51
|
messages.shift
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
+
end
|
53
|
+
handler = @host.receive(message)
|
54
|
+
handler && handler.send_response
|
52
55
|
end
|
53
56
|
end
|
54
57
|
end
|
@@ -29,7 +29,7 @@ module Solargraph
|
|
29
29
|
def initialize
|
30
30
|
@cancel_semaphore = Mutex.new
|
31
31
|
@buffer_semaphore = Mutex.new
|
32
|
-
@
|
32
|
+
@request_mutex = Mutex.new
|
33
33
|
@cancel = []
|
34
34
|
@buffer = String.new
|
35
35
|
@stopped = true
|
@@ -92,7 +92,9 @@ module Solargraph
|
|
92
92
|
@cancel_semaphore.synchronize { @cancel.delete id }
|
93
93
|
end
|
94
94
|
|
95
|
-
#
|
95
|
+
# Called by adapter, to handle the request
|
96
|
+
# @param request [Hash]
|
97
|
+
# @return [void]
|
96
98
|
def process request
|
97
99
|
message_worker.queue(request)
|
98
100
|
end
|
@@ -363,19 +365,21 @@ module Solargraph
|
|
363
365
|
# @yieldparam [Hash] The result sent by the client
|
364
366
|
# @return [void]
|
365
367
|
def send_request method, params, &block
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
368
|
+
@request_mutex.synchronize do
|
369
|
+
message = {
|
370
|
+
jsonrpc: "2.0",
|
371
|
+
method: method,
|
372
|
+
params: params,
|
373
|
+
id: @next_request_id
|
374
|
+
}
|
375
|
+
json = message.to_json
|
376
|
+
requests[@next_request_id] = Request.new(@next_request_id, &block)
|
377
|
+
envelope = "Content-Length: #{json.bytesize}\r\n\r\n#{json}"
|
378
|
+
queue envelope
|
379
|
+
@next_request_id += 1
|
380
|
+
logger.info "Server sent #{method}"
|
381
|
+
logger.debug params
|
382
|
+
end
|
379
383
|
end
|
380
384
|
|
381
385
|
# Register the methods as capabilities with the client.
|
@@ -386,20 +390,16 @@ module Solargraph
|
|
386
390
|
# @return [void]
|
387
391
|
def register_capabilities methods
|
388
392
|
logger.debug "Registering capabilities: #{methods}"
|
389
|
-
registrations = methods.select{|m| can_register?(m) and !registered?(m)}.map
|
393
|
+
registrations = methods.select { |m| can_register?(m) and !registered?(m) }.map do |m|
|
390
394
|
@registered_capabilities.add m
|
391
395
|
{
|
392
396
|
id: m,
|
393
397
|
method: m,
|
394
398
|
registerOptions: dynamic_capability_options[m]
|
395
399
|
}
|
396
|
-
}
|
397
|
-
return if registrations.empty?
|
398
|
-
@register_semaphore.synchronize do
|
399
|
-
send_request 'client/registerCapability', {
|
400
|
-
registrations: registrations
|
401
|
-
}
|
402
400
|
end
|
401
|
+
return if registrations.empty?
|
402
|
+
send_request 'client/registerCapability', { registrations: registrations }
|
403
403
|
end
|
404
404
|
|
405
405
|
# Unregister the methods with the client.
|
@@ -418,11 +418,7 @@ module Solargraph
|
|
418
418
|
}
|
419
419
|
}
|
420
420
|
return if unregisterations.empty?
|
421
|
-
|
422
|
-
send_request 'client/unregisterCapability', {
|
423
|
-
unregisterations: unregisterations
|
424
|
-
}
|
425
|
-
end
|
421
|
+
send_request 'client/unregisterCapability', { unregisterations: unregisterations }
|
426
422
|
end
|
427
423
|
|
428
424
|
# Flag a method as available for dynamic registration.
|
@@ -430,9 +426,7 @@ module Solargraph
|
|
430
426
|
# @param method [String] The method name, e.g., 'textDocument/completion'
|
431
427
|
# @return [void]
|
432
428
|
def allow_registration method
|
433
|
-
@
|
434
|
-
@dynamic_capabilities.add method
|
435
|
-
end
|
429
|
+
@dynamic_capabilities.add method
|
436
430
|
end
|
437
431
|
|
438
432
|
# True if the specified LSP method can be dynamically registered.
|
data/lib/solargraph/version.rb
CHANGED
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.43.
|
4
|
+
version: 0.43.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fred Snyder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backport
|