solargraph 0.32.5 → 0.33.0
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 +4 -4
- data/.gitignore +1 -0
- data/README.md +2 -11
- data/lib/solargraph.rb +1 -2
- data/lib/solargraph/api_map.rb +93 -63
- data/lib/solargraph/api_map/cache.rb +16 -1
- data/lib/solargraph/api_map/source_to_yard.rb +16 -7
- data/lib/solargraph/api_map/store.rb +55 -12
- data/lib/solargraph/complex_type.rb +58 -14
- data/lib/solargraph/complex_type/type_methods.rb +2 -2
- data/lib/solargraph/complex_type/unique_type.rb +33 -4
- data/lib/solargraph/core_fills.rb +40 -12
- data/lib/solargraph/diagnostics.rb +4 -3
- data/lib/solargraph/diagnostics/base.rb +6 -0
- data/lib/solargraph/diagnostics/require_not_found.rb +17 -10
- data/lib/solargraph/diagnostics/rubocop_helpers.rb +2 -0
- data/lib/solargraph/diagnostics/type_check.rb +51 -0
- data/lib/solargraph/diagnostics/update_errors.rb +1 -0
- data/lib/solargraph/language_server/host.rb +55 -25
- data/lib/solargraph/language_server/host/diagnoser.rb +1 -2
- data/lib/solargraph/language_server/host/dispatch.rb +4 -8
- data/lib/solargraph/language_server/host/sources.rb +1 -1
- data/lib/solargraph/language_server/message.rb +1 -0
- data/lib/solargraph/language_server/message/completion_item/resolve.rb +4 -2
- data/lib/solargraph/language_server/message/initialize.rb +9 -0
- data/lib/solargraph/language_server/message/initialized.rb +1 -0
- data/lib/solargraph/language_server/message/text_document.rb +1 -0
- data/lib/solargraph/language_server/message/text_document/code_action.rb +15 -0
- data/lib/solargraph/language_server/message/text_document/completion.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/definition.rb +25 -5
- data/lib/solargraph/language_server/message/text_document/hover.rb +1 -1
- data/lib/solargraph/language_server/message/text_document/signature_help.rb +4 -0
- data/lib/solargraph/language_server/message/workspace/did_change_watched_files.rb +8 -4
- data/lib/solargraph/language_server/transport/adapter.rb +12 -15
- data/lib/solargraph/library.rb +23 -6
- data/lib/solargraph/location.rb +4 -0
- data/lib/solargraph/pin.rb +7 -3
- data/lib/solargraph/pin/attribute.rb +14 -13
- data/lib/solargraph/pin/base.rb +56 -43
- data/lib/solargraph/pin/base_method.rb +41 -18
- data/lib/solargraph/pin/base_variable.rb +17 -15
- data/lib/solargraph/pin/block.rb +22 -4
- data/lib/solargraph/pin/closure.rb +28 -0
- data/lib/solargraph/pin/common.rb +59 -0
- data/lib/solargraph/pin/constant.rb +4 -4
- data/lib/solargraph/pin/conversions.rb +8 -8
- data/lib/solargraph/pin/duck_method.rb +3 -3
- data/lib/solargraph/pin/instance_variable.rb +30 -0
- data/lib/solargraph/pin/keyword.rb +1 -1
- data/lib/solargraph/pin/local_variable.rb +3 -3
- data/lib/solargraph/pin/localized.rb +9 -5
- data/lib/solargraph/pin/method.rb +26 -40
- data/lib/solargraph/pin/method_alias.rb +9 -6
- data/lib/solargraph/pin/namespace.rb +33 -10
- data/lib/solargraph/pin/parameter.rb +150 -0
- data/lib/solargraph/pin/proxy_type.rb +8 -8
- data/lib/solargraph/pin/reference.rb +1 -12
- data/lib/solargraph/pin/reference/override.rb +18 -0
- data/lib/solargraph/pin/reference/require.rb +2 -1
- data/lib/solargraph/pin/singleton.rb +9 -0
- data/lib/solargraph/pin/symbol.rb +9 -4
- data/lib/solargraph/pin/yard_pin/constant.rb +12 -3
- data/lib/solargraph/pin/yard_pin/method.rb +18 -6
- data/lib/solargraph/pin/yard_pin/namespace.rb +13 -1
- data/lib/solargraph/position.rb +1 -1
- data/lib/solargraph/range.rb +4 -0
- data/lib/solargraph/shell.rb +83 -4
- data/lib/solargraph/source.rb +32 -12
- data/lib/solargraph/source/chain.rb +48 -28
- data/lib/solargraph/source/chain/call.rb +37 -38
- data/lib/solargraph/source/chain/constant.rb +1 -1
- data/lib/solargraph/source/chain/head.rb +2 -8
- data/lib/solargraph/source/chain/instance_variable.rb +1 -1
- data/lib/solargraph/source/chain/link.rb +2 -0
- data/lib/solargraph/source/cursor.rb +59 -24
- data/lib/solargraph/source/node_chainer.rb +0 -2
- data/lib/solargraph/source/node_methods.rb +12 -6
- data/lib/solargraph/source/source_chainer.rb +38 -44
- data/lib/solargraph/source_map.rb +11 -18
- data/lib/solargraph/source_map/clip.rb +13 -15
- data/lib/solargraph/source_map/mapper.rb +37 -26
- data/lib/solargraph/source_map/node_processor.rb +13 -8
- data/lib/solargraph/source_map/node_processor/alias_node.rb +8 -8
- data/lib/solargraph/source_map/node_processor/args_node.rb +10 -16
- data/lib/solargraph/source_map/node_processor/base.rb +47 -4
- data/lib/solargraph/source_map/node_processor/block_node.rb +9 -4
- data/lib/solargraph/source_map/node_processor/casgn_node.rb +7 -2
- data/lib/solargraph/source_map/node_processor/cvasgn_node.rb +8 -3
- data/lib/solargraph/source_map/node_processor/def_node.rb +45 -38
- data/lib/solargraph/source_map/node_processor/defs_node.rb +16 -6
- data/lib/solargraph/source_map/node_processor/gvasgn_node.rb +8 -1
- data/lib/solargraph/source_map/node_processor/ivasgn_node.rb +20 -6
- data/lib/solargraph/source_map/node_processor/lvasgn_node.rb +10 -4
- data/lib/solargraph/source_map/node_processor/namespace_node.rb +18 -12
- data/lib/solargraph/source_map/node_processor/orasgn_node.rb +1 -1
- data/lib/solargraph/source_map/node_processor/resbody_node.rb +30 -0
- data/lib/solargraph/source_map/node_processor/sclass_node.rb +7 -1
- data/lib/solargraph/source_map/node_processor/send_node.rb +102 -52
- data/lib/solargraph/source_map/node_processor/sym_node.rb +4 -1
- data/lib/solargraph/source_map/region.rb +9 -8
- data/lib/solargraph/type_checker.rb +282 -0
- data/lib/solargraph/type_checker/param_def.rb +47 -0
- data/lib/solargraph/type_checker/problem.rb +25 -0
- data/lib/solargraph/version.rb +1 -1
- data/lib/solargraph/views/environment.erb +1 -1
- data/lib/solargraph/workspace.rb +2 -2
- data/lib/solargraph/workspace/config.rb +0 -8
- data/lib/solargraph/yard_map.rb +25 -69
- data/lib/solargraph/yard_map/core_docs.rb +8 -3
- data/lib/solargraph/yard_map/core_gen.rb +1 -3
- data/lib/solargraph/yard_map/mapper.rb +85 -0
- data/lib/yard-solargraph.rb +2 -0
- metadata +14 -14
- data/lib/solargraph/diagnostics/type_not_defined.rb +0 -108
- data/lib/solargraph/live_map.rb +0 -126
- data/lib/solargraph/live_map/cache.rb +0 -38
- data/lib/solargraph/pin/block_parameter.rb +0 -103
- data/lib/solargraph/pin/method_parameter.rb +0 -40
- data/lib/solargraph/pin/plugin/method.rb +0 -25
- data/lib/solargraph/plugin.rb +0 -8
- data/lib/solargraph/plugin/base.rb +0 -41
- data/lib/solargraph/plugin/canceler.rb +0 -11
- data/lib/solargraph/plugin/process.rb +0 -172
- data/lib/solargraph/plugin/runtime.rb +0 -134
- data/lib/yard-coregen.rb +0 -16
@@ -9,20 +9,27 @@ module Solargraph
|
|
9
9
|
result = []
|
10
10
|
refs = {}
|
11
11
|
map = api_map.source_map(source.filename)
|
12
|
-
map.requires.each
|
13
|
-
refs[ref.name] = ref
|
14
|
-
end
|
12
|
+
map.requires.each { |ref| refs[ref.name] = ref }
|
15
13
|
api_map.unresolved_requires.each do |r|
|
16
|
-
next unless refs.
|
17
|
-
result.push(
|
18
|
-
range: refs[r].location.range.to_hash,
|
19
|
-
severity: Diagnostics::Severities::WARNING,
|
20
|
-
source: 'Solargraph',
|
21
|
-
message: "Required path #{r} could not be resolved."
|
22
|
-
)
|
14
|
+
next unless refs.key?(r)
|
15
|
+
result.push require_error(r, refs[r].location)
|
23
16
|
end
|
24
17
|
result
|
25
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
# @param path [String]
|
23
|
+
# @param location [Location]
|
24
|
+
# @return [Hash]
|
25
|
+
def require_error path, location
|
26
|
+
{
|
27
|
+
range: location.range.to_hash,
|
28
|
+
severity: Diagnostics::Severities::WARNING,
|
29
|
+
source: 'RequireNotFound',
|
30
|
+
message: "Required path #{path} could not be resolved."
|
31
|
+
}
|
32
|
+
end
|
26
33
|
end
|
27
34
|
end
|
28
35
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Solargraph
|
2
|
+
module Diagnostics
|
3
|
+
# TypeCheck reports methods with undefined return types, untagged
|
4
|
+
# parameters, and invalid param tags.
|
5
|
+
#
|
6
|
+
class TypeCheck < Base
|
7
|
+
def diagnose source, api_map
|
8
|
+
severity = (args.include?('strict') ? Diagnostics::Severities::ERROR : Diagnostics::Severities::WARNING)
|
9
|
+
checker = Solargraph::TypeChecker.new(source.filename, api_map: api_map)
|
10
|
+
result = checker.return_type_problems + checker.param_type_problems
|
11
|
+
result.concat checker.strict_type_problems if args.include?('strict')
|
12
|
+
result.sort! { |a, b| a.location.range.start.line <=> b.location.range.start.line }
|
13
|
+
result.map do |problem|
|
14
|
+
{
|
15
|
+
range: extract_first_line(problem.location, source),
|
16
|
+
severity: severity,
|
17
|
+
source: 'Typecheck',
|
18
|
+
message: problem.message
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# @param location [Location]
|
26
|
+
# @param source [Source]
|
27
|
+
# @return [Hash]
|
28
|
+
def extract_first_line location, source
|
29
|
+
return location.range.to_hash if location.range.start.line == location.range.ending.line
|
30
|
+
{
|
31
|
+
start: {
|
32
|
+
line: location.range.start.line,
|
33
|
+
character: location.range.start.character
|
34
|
+
},
|
35
|
+
end: {
|
36
|
+
line: location.range.start.line,
|
37
|
+
character: last_character(location.range.start, source)
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# @param position [Solargraph::Position]
|
43
|
+
# @param source [Solargraph::Source]
|
44
|
+
# @return [Integer]
|
45
|
+
def last_character position, source
|
46
|
+
cursor = Position.to_offset(source.code, position)
|
47
|
+
source.code.index(/[\r\n]/, cursor) || source.code.length
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'observer'
|
2
2
|
require 'set'
|
3
3
|
|
4
4
|
module Solargraph
|
@@ -16,6 +16,7 @@ module Solargraph
|
|
16
16
|
include UriHelpers
|
17
17
|
include Logging
|
18
18
|
include Dispatch
|
19
|
+
include Observable
|
19
20
|
|
20
21
|
def initialize
|
21
22
|
@cancel_semaphore = Mutex.new
|
@@ -43,6 +44,7 @@ module Solargraph
|
|
43
44
|
# Update the configuration options with the provided hash.
|
44
45
|
#
|
45
46
|
# @param update [Hash]
|
47
|
+
# @return [void]
|
46
48
|
def configure update
|
47
49
|
return if update.nil?
|
48
50
|
options.merge! update
|
@@ -57,6 +59,7 @@ module Solargraph
|
|
57
59
|
# Cancel the method with the specified ID.
|
58
60
|
#
|
59
61
|
# @param id [Integer]
|
62
|
+
# @return [void]
|
60
63
|
def cancel id
|
61
64
|
@cancel_semaphore.synchronize { @cancel.push id }
|
62
65
|
end
|
@@ -94,7 +97,7 @@ module Solargraph
|
|
94
97
|
message.process
|
95
98
|
rescue Exception => e
|
96
99
|
logger.warn "Error processing request: [#{e.class}] #{e.message}"
|
97
|
-
logger.warn e.backtrace
|
100
|
+
logger.warn e.backtrace.join("\n")
|
98
101
|
message.set_error Solargraph::LanguageServer::ErrorCodes::INTERNAL_ERROR, "[#{e.class}] #{e.message}"
|
99
102
|
end
|
100
103
|
message
|
@@ -129,7 +132,6 @@ module Solargraph
|
|
129
132
|
# @param uri [String] The file uri.
|
130
133
|
# @return [void]
|
131
134
|
def delete uri
|
132
|
-
# sources.close uri # @todo It's possible for a deleted file to be open in an editor
|
133
135
|
filename = uri_to_file(uri)
|
134
136
|
libraries.each do |lib|
|
135
137
|
lib.delete(filename)
|
@@ -154,6 +156,8 @@ module Solargraph
|
|
154
156
|
diagnoser.schedule uri
|
155
157
|
end
|
156
158
|
|
159
|
+
# @param uri [String]
|
160
|
+
# @return [void]
|
157
161
|
def open_from_disk uri
|
158
162
|
library = library_for(uri)
|
159
163
|
library.open_from_disk uri_to_file(uri)
|
@@ -182,22 +186,26 @@ module Solargraph
|
|
182
186
|
# @return [void]
|
183
187
|
def diagnose uri
|
184
188
|
if sources.include?(uri)
|
185
|
-
logger.info "Diagnosing #{uri}"
|
186
189
|
library = library_for(uri)
|
187
|
-
library.
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
190
|
+
if library.synchronized?
|
191
|
+
logger.info "Diagnosing #{uri}"
|
192
|
+
begin
|
193
|
+
results = library.diagnose uri_to_file(uri)
|
194
|
+
send_notification "textDocument/publishDiagnostics", {
|
195
|
+
uri: uri,
|
196
|
+
diagnostics: results
|
197
|
+
}
|
198
|
+
rescue DiagnosticsError => e
|
199
|
+
logger.warn "Error in diagnostics: #{e.message}"
|
200
|
+
options['diagnostics'] = false
|
201
|
+
send_notification 'window/showMessage', {
|
202
|
+
type: LanguageServer::MessageTypes::ERROR,
|
203
|
+
message: "Error in diagnostics: #{e.message}"
|
204
|
+
}
|
205
|
+
end
|
206
|
+
else
|
207
|
+
logger.info "Deferring diagnosis of #{uri}"
|
208
|
+
diagnoser.schedule uri
|
201
209
|
end
|
202
210
|
else
|
203
211
|
send_notification 'textDocument/publishDiagnostics', {
|
@@ -215,15 +223,17 @@ module Solargraph
|
|
215
223
|
def change params
|
216
224
|
updater = generate_updater(params)
|
217
225
|
sources.async_update params['textDocument']['uri'], updater
|
226
|
+
diagnoser.schedule params['textDocument']['uri']
|
218
227
|
end
|
219
228
|
|
220
229
|
# Queue a message to be sent to the client.
|
221
230
|
#
|
222
231
|
# @param message [String] The message to send.
|
232
|
+
# @return [void]
|
223
233
|
def queue message
|
224
|
-
@buffer_semaphore.synchronize
|
225
|
-
|
226
|
-
|
234
|
+
@buffer_semaphore.synchronize { @buffer += message }
|
235
|
+
changed
|
236
|
+
notify_observers
|
227
237
|
end
|
228
238
|
|
229
239
|
# Clear the message buffer and return the most recent data.
|
@@ -285,12 +295,15 @@ module Solargraph
|
|
285
295
|
end
|
286
296
|
end
|
287
297
|
|
298
|
+
# @param array [Array<Hash>]
|
299
|
+
# @return [void]
|
288
300
|
def remove_folders array
|
289
301
|
array.each do |folder|
|
290
302
|
remove uri_to_file(folder['uri'])
|
291
303
|
end
|
292
304
|
end
|
293
305
|
|
306
|
+
# @return [Array<String>]
|
294
307
|
def folders
|
295
308
|
libraries.map { |lib| lib.workspace.directory }
|
296
309
|
end
|
@@ -299,6 +312,7 @@ module Solargraph
|
|
299
312
|
#
|
300
313
|
# @param method [String] The message method
|
301
314
|
# @param params [Hash] The method parameters
|
315
|
+
# @return [void]
|
302
316
|
def send_notification method, params
|
303
317
|
response = {
|
304
318
|
jsonrpc: "2.0",
|
@@ -318,8 +332,9 @@ module Solargraph
|
|
318
332
|
#
|
319
333
|
# @param method [String] The message method
|
320
334
|
# @param params [Hash] The method parameters
|
321
|
-
# @param
|
335
|
+
# @param block [Proc] The block that processes the response
|
322
336
|
# @yieldparam [Hash] The result sent by the client
|
337
|
+
# @return [void]
|
323
338
|
def send_request method, params, &block
|
324
339
|
message = {
|
325
340
|
jsonrpc: "2.0",
|
@@ -416,6 +431,8 @@ module Solargraph
|
|
416
431
|
cataloger.stop
|
417
432
|
diagnoser.stop
|
418
433
|
sources.stop
|
434
|
+
changed
|
435
|
+
notify_observers
|
419
436
|
end
|
420
437
|
|
421
438
|
def stopped?
|
@@ -461,7 +478,7 @@ module Solargraph
|
|
461
478
|
# @param uri [String]
|
462
479
|
# @param line [Integer]
|
463
480
|
# @param column [Integer]
|
464
|
-
# @return [Solargraph::
|
481
|
+
# @return [Solargraph::SourceMap::Completion]
|
465
482
|
def completions_at uri, line, column
|
466
483
|
library = library_for(uri)
|
467
484
|
library.completions_at uri_to_file(uri), line, column
|
@@ -546,7 +563,7 @@ module Solargraph
|
|
546
563
|
# @param text [String]
|
547
564
|
# @param type [Integer] A MessageType constant
|
548
565
|
# @param actions [Array<String>] Response options for the client
|
549
|
-
# @param
|
566
|
+
# @param block The block that processes the response
|
550
567
|
# @yieldparam [String] The action received from the client
|
551
568
|
# @return [void]
|
552
569
|
def show_message_request text, type, actions, &block
|
@@ -588,6 +605,7 @@ module Solargraph
|
|
588
605
|
sources.find(uri).folding_ranges
|
589
606
|
end
|
590
607
|
|
608
|
+
# @return [void]
|
591
609
|
def catalog
|
592
610
|
libraries.each(&:catalog)
|
593
611
|
end
|
@@ -604,15 +622,23 @@ module Solargraph
|
|
604
622
|
@cataloger ||= Cataloger.new(self)
|
605
623
|
end
|
606
624
|
|
625
|
+
# A hash of client requests by ID. The host uses this to keep track of
|
626
|
+
# pending responses.
|
627
|
+
#
|
628
|
+
# @return [Hash{Integer => Hash}]
|
607
629
|
def requests
|
608
630
|
@requests ||= {}
|
609
631
|
end
|
610
632
|
|
633
|
+
# @param path [String]
|
634
|
+
# @return [String]
|
611
635
|
def normalize_separators path
|
612
636
|
return path if File::ALT_SEPARATOR.nil?
|
613
637
|
path.gsub(File::ALT_SEPARATOR, File::SEPARATOR)
|
614
638
|
end
|
615
639
|
|
640
|
+
# @param params [Hash]
|
641
|
+
# @return [Source::Updater]
|
616
642
|
def generate_updater params
|
617
643
|
changes = []
|
618
644
|
params['contentChanges'].each do |chng|
|
@@ -631,6 +657,7 @@ module Solargraph
|
|
631
657
|
)
|
632
658
|
end
|
633
659
|
|
660
|
+
# @return [Hash]
|
634
661
|
def dynamic_capability_options
|
635
662
|
@dynamic_capability_options ||= {
|
636
663
|
# textDocumentSync: 2, # @todo What should this be?
|
@@ -641,7 +668,7 @@ module Solargraph
|
|
641
668
|
# hoverProvider: true,
|
642
669
|
# definitionProvider: true,
|
643
670
|
'textDocument/signatureHelp' => {
|
644
|
-
triggerCharacters: ['(', ',']
|
671
|
+
triggerCharacters: ['(', ',', ' ']
|
645
672
|
},
|
646
673
|
# documentFormattingProvider: true,
|
647
674
|
'textDocument/onTypeFormatting' => {
|
@@ -676,6 +703,9 @@ module Solargraph
|
|
676
703
|
},
|
677
704
|
'textDocument/foldingRange' => {
|
678
705
|
foldingRangeProvider: true
|
706
|
+
},
|
707
|
+
'textDocument/codeAction' => {
|
708
|
+
codeActionProvider: true
|
679
709
|
}
|
680
710
|
}
|
681
711
|
end
|
@@ -25,13 +25,10 @@ module Solargraph
|
|
25
25
|
# @return [void]
|
26
26
|
def update_libraries uri
|
27
27
|
src = sources.find(uri)
|
28
|
-
# @todo This module should not call cataloger and diagnoser
|
29
28
|
libraries.each do |lib|
|
30
|
-
|
31
|
-
lib.merge src
|
32
|
-
end
|
29
|
+
lib.merge src if lib.contain?(src.filename)
|
33
30
|
end
|
34
|
-
diagnoser.schedule uri
|
31
|
+
diagnoser.schedule uri
|
35
32
|
end
|
36
33
|
|
37
34
|
# Find the best libary match for the given URI.
|
@@ -79,11 +76,9 @@ module Solargraph
|
|
79
76
|
def implicit_library_for uri
|
80
77
|
filename = UriHelpers.uri_to_file(uri)
|
81
78
|
libraries.each do |lib|
|
82
|
-
# @todo We probably shouldn't depend on attachments to select
|
83
|
-
# a library.
|
84
|
-
# return lib if lib.open?(filename)
|
85
79
|
if filename.start_with?(lib.workspace.directory)
|
86
80
|
lib.attach sources.find(uri)
|
81
|
+
lib.catalog
|
87
82
|
return lib
|
88
83
|
end
|
89
84
|
end
|
@@ -99,6 +94,7 @@ module Solargraph
|
|
99
94
|
# @return [Library]
|
100
95
|
def generic_library_for uri
|
101
96
|
generic_library.attach sources.find(uri)
|
97
|
+
generic_library.catalog
|
102
98
|
generic_library
|
103
99
|
end
|
104
100
|
|
@@ -72,6 +72,7 @@ module Solargraph
|
|
72
72
|
register 'textDocument/rename', TextDocument::Rename
|
73
73
|
register 'textDocument/prepareRename', TextDocument::PrepareRename
|
74
74
|
register 'textDocument/foldingRange', TextDocument::FoldingRange
|
75
|
+
register 'textDocument/codeAction', TextDocument::CodeAction
|
75
76
|
register 'workspace/didChangeWatchedFiles', Workspace::DidChangeWatchedFiles
|
76
77
|
register 'workspace/didChangeConfiguration', Workspace::DidChangeConfiguration
|
77
78
|
register 'workspace/didChangeWorkspaceFolders', Workspace::DidChangeWorkspaceFolders
|
@@ -17,11 +17,13 @@ module Solargraph
|
|
17
17
|
def merge pins
|
18
18
|
return params if pins.empty?
|
19
19
|
docs = pins
|
20
|
-
.reject { |pin| pin.documentation.empty? }
|
20
|
+
.reject { |pin| pin.documentation.empty? && pin.return_type.undefined? }
|
21
21
|
.map { |pin| pin.resolve_completion_item[:documentation] }
|
22
|
-
params
|
22
|
+
result = params
|
23
23
|
.merge(pins.first.resolve_completion_item)
|
24
24
|
.merge(documentation: markup_content(docs.join("\n\n")))
|
25
|
+
result[:detail] = pins.first.detail
|
26
|
+
result
|
25
27
|
end
|
26
28
|
|
27
29
|
# @param text [String]
|
@@ -36,6 +36,8 @@ module Solargraph
|
|
36
36
|
result[:capabilities].merge! static_references unless dynamic_registration_for?('textDocument', 'references')
|
37
37
|
result[:capabilities].merge! static_workspace_symbols unless dynamic_registration_for?('workspace', 'symbol')
|
38
38
|
result[:capabilities].merge! static_folding_range unless dynamic_registration_for?('textDocument', 'foldingRange')
|
39
|
+
# @todo Temporarily disabled
|
40
|
+
# result[:capabilities].merge! static_code_action unless dynamic_registration_for?('textDocument', 'codeAction')
|
39
41
|
set_result result
|
40
42
|
}
|
41
43
|
Solargraph.logger.unknown "Solargraph initialized (#{bm.real} seconds)"
|
@@ -59,6 +61,13 @@ module Solargraph
|
|
59
61
|
}
|
60
62
|
end
|
61
63
|
|
64
|
+
def static_code_action
|
65
|
+
{
|
66
|
+
codeActionProvider: true,
|
67
|
+
codeActionKinds: ["quickfix"]
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
62
71
|
def static_signature_help
|
63
72
|
{
|
64
73
|
signatureHelpProvider: {
|