[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clang-tools-extra/trunk/clangd/SourceCode.cpp:38 +// 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here. +// 1xxx is not valid UTF-8 at all. Assert because it's probably our bug. +assert((UTF8Length >

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-30 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tools-extra/trunk/clangd/SourceCode.cpp:38 +// 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here. +// 1xxx is not valid UTF-8 at all. Assert because it's probably our bug. +assert((UTF8Length

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clang-tools-extra/trunk/clangd/SourceCode.cpp:38 +// 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here. +// 1xxx is not valid UTF-8 at all. Assert because it's probably our bug. +assert((UTF8Length >

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-30 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tools-extra/trunk/clangd/SourceCode.cpp:38 +// 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here. +// 1xxx is not valid UTF-8 at all. Assert because it's probably our bug. +assert((UTF8Length

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-30 Thread Sam McCall via Phabricator via cfe-commits
sammccall added inline comments. Comment at: clang-tools-extra/trunk/clangd/SourceCode.cpp:38 +// 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here. +// 1xxx is not valid UTF-8 at all. Assert because it's probably our bug. +assert((UTF8Length >

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-27 Thread Ben Hamilton via Phabricator via cfe-commits
benhamilton added inline comments. Comment at: clang-tools-extra/trunk/clangd/SourceCode.cpp:38 +// 0xxx is ASCII, handled above. 10xxx is a trailing byte, invalid here. +// 1xxx is not valid UTF-8 at all. Assert because it's probably our bug. +assert((UTF8Length

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-27 Thread Sam McCall via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. sammccall marked 2 inline comments as done. Closed by commit rL331029: [clangd] Fix unicode handling, using UTF-16 where LSP requires it. (authored by sammccall, committed by ). Herald added a subscriber: llvm-commits. Chan

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-27 Thread Sam McCall via Phabricator via cfe-commits
sammccall marked 3 inline comments as done. sammccall added a comment. Thanks! Comment at: clangd/SourceCode.cpp:25 +// Returns true if CB returned true, false if we hit the end of string. +template +bool iterateCodepoints(StringRef U8, const Callback &CB) { h

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-25 Thread Haojian Wu via Phabricator via cfe-commits
hokein accepted this revision. hokein added a comment. This revision is now accepted and ready to land. Cool, the code looks good to me (just a few nits), thanks for the descriptive comments! > This seems likely to cause problems with editors that have the same bug, and > treat the protocol as

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-24 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 143838. sammccall added a comment. Remove some debugging junk, tweak a comment. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D46035 Files: clangd/ClangdServer.cpp clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/CodeComplete.cpp

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-24 Thread Sam McCall via Phabricator via cfe-commits
sammccall created this revision. sammccall added a reviewer: hokein. Herald added subscribers: cfe-commits, jkorous, MaskRay, ioeric, ilya-biryukov, klimek. The Language Server Protocol unfortunately mandates that locations in files be represented by line/column pairs, where the "column" is actua

[PATCH] D46035: [clangd] Fix unicode handling, using UTF-16 where LSP requires it.

2018-04-24 Thread Sam McCall via Phabricator via cfe-commits
sammccall updated this revision to Diff 143836. sammccall added a comment. clang-format Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D46035 Files: clangd/ClangdServer.cpp clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/CodeComplete.cpp clangd/Protocol.h clangd/Sou