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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to