Class: Solargraph::LanguageServer::Message::TextDocument::Hover
- Defined in:
- lib/solargraph/language_server/message/text_document/hover.rb
Instance Attribute Summary
Attributes inherited from Base
Attributes inherited from Base
#error, #host, #id, #method, #params, #request, #result
Instance Method Summary collapse
Methods inherited from Base
Methods included from UriHelpers
Methods inherited from Base
#initialize, #post_initialize, #send_response, #set_error, #set_result
Constructor Details
This class inherits a constructor from Solargraph::LanguageServer::Message::Base
Instance Method Details
#process ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/solargraph/language_server/message/text_document/hover.rb', line 6 def process filename = uri_to_file(params['textDocument']['uri']) line = params['position']['line'] col = params['position']['character'] contents = [] suggestions = host.definitions_at(filename, line, col) last_link = nil suggestions.each do |pin| parts = [] this_link = pin.link_documentation if !this_link.nil? and this_link != last_link parts.push this_link end parts.push HTMLEntities.new.encode(pin.detail) unless pin.kind == Solargraph::Pin::NAMESPACE or pin.detail.nil? parts.push pin.documentation unless pin.documentation.nil? or pin.documentation.empty? contents.push parts.join("\n\n") unless parts.empty? last_link = this_link unless this_link.nil? end set_result( contents: { kind: 'markdown', value: contents.join("\n\n") } ) end |