Page MenuHomePhabricator

clang-format-vs : Fix Unicode formatting
ClosedPublic

Authored by empty2fill on Nov 23 2019, 3:35 AM.

Details

Reviewers
hans
klimek
Group Reviewers
Restricted Project
Commits
rGe20a1e486e14: clang-format-vs : Fix Unicode formatting
Summary

Use UTF-8 for communication with clang-format and convert the replacements offset/length to characters position/count.

Internally VisualStudio.Text.Editor.IWpfTextView use sequence of Unicode characters encoded using UTF-16 and use characters position/count for manipulating text.

Resolved "Error while running clang-format: Specified argument was out of the range of valid values. Parameter name: replaceSpan".

Diff Detail

Event Timeline

empty2fill created this revision.Nov 23 2019, 3:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 23 2019, 3:35 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
empty2fill retitled this revision from clang-format-vs : Fix Unicode Replacements to clang-format-vs : Fix Unicode formatting.Nov 23 2019, 3:58 AM

klimek, What do you think?

empty2fill: Do you have an example input that I could use to hit the "Specified argument was out of the range of valid values." error?

generally makes sense

empty2fill added a comment.EditedNov 25 2019, 4:20 AM

klimek, What do you think?

empty2fill: Do you have an example input that I could use to hit the "Specified argument was out of the range of valid values." error?

Encoded UTF-8(with BOM) for the Korean language.

hans accepted this revision.Nov 27 2019, 12:57 AM

empty2fill: Do you have an example input that I could use to hit the "Specified argument was out of the range of valid values." error?

Encoded UTF-8(with BOM) for the Korean language.

I applied your patch locally and it seems to work :-) I'll commit it for you.

This revision is now accepted and ready to land.Nov 27 2019, 12:57 AM
This revision was automatically updated to reflect the committed changes.