Sha256: 8d3aeb8deb1aa1c4cf8f36508f96267c8f51b6ba8d107bed046d3f2df3ea7140
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
# typed: strict # frozen_string_literal: true require "ruby_lsp/listeners/folding_ranges" module RubyLsp module Requests # ![Folding ranges demo](../../folding_ranges.gif) # # The [folding ranges](https://microsoft.github.io/language-server-protocol/specification#textDocument_foldingRange) # request informs the editor of the ranges where and how code can be folded. # # # Example # # ```ruby # def say_hello # <-- folding range start # puts "Hello" # end # <-- folding range end # ``` class FoldingRanges < Request extend T::Sig extend T::Generic class << self extend T::Sig sig { returns(Interface::FoldingRangeClientCapabilities) } def provider Interface::FoldingRangeClientCapabilities.new(line_folding_only: true) end end ResponseType = type_member { { fixed: T::Array[Interface::FoldingRange] } } sig { params(comments: T::Array[Prism::Comment], dispatcher: Prism::Dispatcher).void } def initialize(comments, dispatcher) super() @listener = T.let(Listeners::FoldingRanges.new(comments, dispatcher), 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/folding_ranges.rb |
ruby-lsp-0.13.3 | lib/ruby_lsp/requests/folding_ranges.rb |