123456789_123456789_123456789_123456789_123456789_

Class: TypeProf::LSP::Message::TextDocument::Completion

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Instance Chain:
Inherits: TypeProf::LSP::Message
Defined in: lib/typeprof/lsp/messages.rb

Overview

textDocument/diagnostic request workspace/diagnostic request

workspace/diagnostic/refresh request

Constant Summary

::TypeProf::LSP::Message - Inherited

Classes, Table

Class Method Summary

Instance Method Summary

Constructor Details

This class inherits a constructor from TypeProf::LSP::Message

Instance Method Details

#run

[ GitHub ]

  
# File 'lib/typeprof/lsp/messages.rb', line 306

def run
  @params => {
    textDocument: { uri: },
    position: pos,
  }
  #trigger_kind = @params.key?(:context) ? @params[:context][:triggerKind] : 1 # Invoked
  text = @server.open_texts[uri]
  unless text
    respond(nil)
    return
  end
  items = []
  sort = "aaaa"
  text.modify_for_completion(text, pos) do |string, trigger, pos|
    @server.core.update_file(text.path, string)
    pos = TypeProf::CodePosition.from_lsp(pos)
    @server.core.completion(text.path, trigger, pos) do |mid, hint|
      items << {
        label: mid,
        kind: 2, # Method
        sortText: sort,
        detail: hint,
      }
      sort = sort.succ
    end
  end
  respond(
    isIncomplete: false,
    items: items,
  )
  @server.core.update_file(text.path, text.string)
end