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

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 05:56:09 PST 2017


sammccall created this revision.
sammccall added a reviewer: ioeric.
Herald added subscribers: cfe-commits, ilya-biryukov, mgorny, klimek.

- 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 https://reviews.llvm.org/D41281, but in a pretty easy-to-resolve way.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D41351

Files:
  clangd/CMakeLists.txt
  clangd/ClangdLSPServer.cpp
  clangd/ClangdServer.cpp
  clangd/ClangdServer.h
  clangd/SourceCode.cpp
  clangd/SourceCode.h
  unittests/clangd/CMakeLists.txt
  unittests/clangd/CodeCompleteTests.cpp
  unittests/clangd/SourceCodeTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41351.127345.patch
Type: text/x-patch
Size: 9951 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171218/6aceb157/attachment-0001.bin>


More information about the cfe-commits mailing list