[PATCH] D67536: [WIP] [clangd] Add support for an inactive regions notification
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Oct 7 08:07:06 PDT 2019
sammccall added a comment.
In D67536#1697533 <https://reviews.llvm.org/D67536#1697533>, @nridge wrote:
> How would one even measure the line length? `SourceManager` doesn't sem to have a method like `getLineLength()` or similar.
If you look at functions like `offsetToPosition` in SourceCode.h, basically you get the buffer as a string (contains utf-8), find the offset you're interested in, and then zoom around looking for `\n`. Once you have a substring, calling `lspLength()` on it will give you the length in UTF-16 or whatever LSP is speaking at the moment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67536/new/
https://reviews.llvm.org/D67536
More information about the cfe-commits
mailing list