Class: RubyLsp::Requests::InlayHints
- Extended by:
- T::Sig
- Defined in:
- lib/ruby_lsp/requests/inlay_hints.rb
Overview

Inlay hints are labels added directly in the code that explicitly show the user something that might otherwise just be implied.
Configuration
To enable rescue hints, set rubyLsp.featuresConfiguration.inlayHint.implicitRescue to true.
To enable hash value hints, set rubyLsp.featuresConfiguration.inlayHint.implicitHashValue to true.
To enable all hints, set rubyLsp.featuresConfiguration.inlayHint.enableAll to true.
Example
begin
puts "do something that might raise"
rescue # Label "StandardError" goes here as a bare rescue implies rescuing StandardError
puts "handle some rescue"
end
Example
var = "foo"
{
var: var, # Label "var" goes here in cases where the value is omitted
a: "hello",
}
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document, range, hints_configuration, dispatcher) ⇒ InlayHints
constructor
A new instance of InlayHints.
- #perform ⇒ Object
Constructor Details
#initialize(document, range, hints_configuration, dispatcher) ⇒ InlayHints
Returns a new instance of InlayHints.
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/ruby_lsp/requests/inlay_hints.rb', line 61 def initialize(document, range, hints_configuration, dispatcher) super() start_line = range.dig(:start, :line) end_line = range.dig(:end, :line) @response_builder = T.let( ResponseBuilders::CollectionResponseBuilder[Interface::InlayHint].new, ResponseBuilders::CollectionResponseBuilder[Interface::InlayHint], ) Listeners::InlayHints.new(@response_builder, start_line..end_line, hints_configuration, dispatcher) end |
Class Method Details
.provider ⇒ Object
48 49 50 |
# File 'lib/ruby_lsp/requests/inlay_hints.rb', line 48 def provider Interface::InlayHintOptions.new(resolve_provider: false) end |
Instance Method Details
#perform ⇒ Object
74 75 76 |
# File 'lib/ruby_lsp/requests/inlay_hints.rb', line 74 def perform @response_builder.response end |