https://bugs.kde.org/show_bug.cgi?id=518035

--- Comment #4 from JATothrim <[email protected]> ---
I found the missing detail from clang-tools-extra/clangd/SourceCode.cpp, and
completed my analysis of the bug for clang at least:
// Here be dragons. LSP positions use columns measured in *UTF-16 code units*!
// Clangd uses UTF-8 and byte-offsets internally, so conversion is nontrivial.

So clang_getFileLocation(,..., &column, ...) indeed returns bytes. Any
codepoint (UTF-8 or UTF-16) with more than one code units currently breaks the
mapping from CXSourceLocation to KTextEditor::Cursor. CXSourceLocation and
KTextEditor::Cursor mostly align by an accident.

clangtypes.cpp: cursorForCXSrcLoc(CXSourceLocation loc) is the function that
converts between the two.

The problem now is how? The non-trivial conversion requires the source line
contents to compute the column in UTF-16 code units, and I don't see an
obivious way to do this.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to