class TypeProf::LSP::Message::TextDocument::Completion - typeprof: Ruby Standard Library Documentation

# class TypeProf::LSP::Message::TextDocument::Completion

textDocument/diagnostic request workspace/diagnostic request

    workspace/diagnostic/refresh request

### Constants

METHOD

### Public Instance Methods

run() click to toggle source

    # File typeprof-0.30.1/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