Method: TypeProf::LSP::Text#modify_for_completion

Defined in:
lib/typeprof/lsp/text.rb

#modify_for_completion(changes, pos) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/typeprof/lsp/text.rb', line 55

def modify_for_completion(changes, pos)
  pos => { line: row, character: col }
  if col >= 2 && @lines[row][col - 1] == "." && (col == 1 || @lines[row][col - 2] != ".")
    @lines[row][col - 1] = " "
    yield string, ".", { line: row, character: col - 2}
    @lines[row][col - 1] = "."
  elsif col >= 3 && @lines[row][col - 2, 2] == "::"
    @lines[row][col - 2, 2] = "  "
    yield string, "::", { line: row, character: col - 3 }
    @lines[row][col - 2, 2] = "::"
  else
    yield string, nil, { line: row, character: col }
  end
end