Class: Browsable::LSP::Handlers::DidChange
- Inherits:
-
Object
- Object
- Browsable::LSP::Handlers::DidChange
- Defined in:
- lib/browsable/lsp/handlers/did_change.rb
Overview
Handles textDocument/didChange — re-audits a document as it is edited.
Instance Method Summary collapse
- #call(params) ⇒ Object
-
#initialize(server) ⇒ DidChange
constructor
A new instance of DidChange.
Constructor Details
#initialize(server) ⇒ DidChange
Returns a new instance of DidChange.
8 9 10 |
# File 'lib/browsable/lsp/handlers/did_change.rb', line 8 def initialize(server) @server = server end |
Instance Method Details
#call(params) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/browsable/lsp/handlers/did_change.rb', line 12 def call(params) uri = params.dig("textDocument", "uri") return unless uri # Full-sync mode: the final content change carries the whole document. text = Array(params["contentChanges"]).last&.fetch("text", nil) return if text.nil? @server.store(uri, text) @server.publish_diagnostics(uri, text) end |