Page MenuHomePhabricator

[clangd] Expose offset <-> LSP position functions, and fix bugs

Authored by sammccall on Dec 18 2017, 5:56 AM.


  • Moved these functions to SourceCode.h
  • added unit tests
  • fix off by one in positionToOffset: Offset - 1 in final calculation was wrong
  • fixed formatOnType which had an equal and opposite off-by-one
  • positionToOffset and offsetToPosition both consistently clamp to beginning/end of file when input is out of range
  • gave variables more descriptive names
  • removed windows line ending fixmes where there is nothing to fix
  • elaborated on UTF-8 fixmes

This will conflict with Eric's D41281, but in a pretty easy-to-resolve way.

Diff Detail

Event Timeline

sammccall created this revision.Dec 18 2017, 5:56 AM
ioeric accepted this revision.Dec 19 2017, 3:26 AM


This revision is now accepted and ready to land.Dec 19 2017, 3:26 AM
This revision was automatically updated to reflect the committed changes.