Sha256: f396a6d48373a813be17d5d4575edc5566239c0826e6d3770244e5c885c94033
Contents?: true
Size: 1.43 KB
Versions: 3
Compression:
Stored size: 1.43 KB
Contents
module Yoda class Server module Providers class Hover < Base def self.provider_method :'textDocument/hover' end def provide(params) calculate(params[:text_document][:uri], params[:position]) end def timeout 10 end private # @param uri [String] # @param position [{Symbol => Integer}] def calculate(uri, position) source = session.file_store.get(uri) location = Parsing::Location.of_language_server_protocol_position(line: position[:line], character: position[:character]) node_worker = Evaluation::CurrentNodeExplain.new(session.registry, source, location) current_node_signature = node_worker.current_node_signature create_hover(current_node_signature) if current_node_signature end # @param signature [Evaluation::NodeSignature] def create_hover(signature) LanguageServer::Protocol::Interface::Hover.new( contents: signature.descriptions.map { |value| create_hover_text(value) }, range: LanguageServer::Protocol::Interface::Range.new(signature.node_range.to_language_server_protocol_range), ) end # @param description [Evaluation::Descriptions::Base] # @return [String] def create_hover_text(description) description.to_markdown end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
yoda-language-server-0.7.2 | lib/yoda/server/providers/hover.rb |
yoda-language-server-0.7.1 | lib/yoda/server/providers/hover.rb |
yoda-language-server-0.7.0 | lib/yoda/server/providers/hover.rb |