Sha256: a7876275974ca9ba37946e365f6223658d0de0c814a40c74f699052aef620aa3
Contents?: true
Size: 1.87 KB
Versions: 2
Compression:
Stored size: 1.87 KB
Contents
# typed: strict # frozen_string_literal: true require "ruby_lsp/listeners/semantic_highlighting" module RubyLsp module Requests #  # # The [semantic # highlighting](https://microsoft.github.io/language-server-protocol/specification#textDocument_semanticTokens) # request informs the editor of the correct token types to provide consistent and accurate highlighting for themes. # # # Example # # ```ruby # def foo # var = 1 # --> semantic highlighting: local variable # some_invocation # --> semantic highlighting: method invocation # var # --> semantic highlighting: local variable # end # ``` class SemanticHighlighting < Request extend T::Sig extend T::Generic ResponseType = type_member { { fixed: T::Array[Listeners::SemanticHighlighting::SemanticToken] } } class << self extend T::Sig sig { returns(Interface::SemanticTokensRegistrationOptions) } def provider Interface::SemanticTokensRegistrationOptions.new( document_selector: { scheme: "file", language: "ruby" }, legend: Interface::SemanticTokensLegend.new( token_types: Listeners::SemanticHighlighting::TOKEN_TYPES.keys, token_modifiers: Listeners::SemanticHighlighting::TOKEN_MODIFIERS.keys, ), range: true, full: { delta: false }, ) end end sig { params(dispatcher: Prism::Dispatcher, range: T.nilable(T::Range[Integer])).void } def initialize(dispatcher, range: nil) super() @listener = T.let(Listeners::SemanticHighlighting.new(dispatcher, range: range), Listener[ResponseType]) end sig { override.returns(ResponseType) } def perform @listener.response end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby-lsp-0.13.4 | lib/ruby_lsp/requests/semantic_highlighting.rb |
ruby-lsp-0.13.3 | lib/ruby_lsp/requests/semantic_highlighting.rb |