Skip to content

"format document" tool insert space at wrong pos when using latin characters #8432

@smarq8

Description

@smarq8

Issue Type: Bug

Steps to Reproduce:
Using latin character somehow affect where to put space, its omited during character count or something else happen for buildin formating tool. After some investigation I found 2 options at .editorconfig cause this problem "cpp_indent_braces" and "cpp_space_within_parameter_list_parentheses" ( there might be similar issue with other but I do not test all of them).

In my example as in string is "błąd" then it ("format document" shift+alt+f) put space in the middle of strLen and right after \n
More in example below, at the left before formating and after at the right, in comment used parameters.

somefile.cpp
LOGF("błąd drukowania: %i\n",strLen); -> LOGF("błąd drukowania: %i\n ",strLen); // cpp_indent_braces=false only
LOGF("błąd drukowania: %i\n",strLen); -> LOGF( "błąd drukowania: %i\n ",strL en); // cpp_space_within_parameter_list_parentheses=true only and both
LOGF("bład drukowania: %i\n",strLen); -> LOGF( "bład drukowania: %i\n" ,strLe n); // both
LOGF("blad drukowania: %i\n",strLen); -> LOGF( "blad drukowania: %i\n", strLen ); // both
.editorconfig
cpp_indent_braces=false
cpp_space_within_parameter_list_parentheses=true

during extension bisect there was 2 behaviors, "there is no formater for "cpp" file installed" popup or corrupted formating as above

Extension version: 1.7.1
VS Code version: Code 1.62.3 (ccbaa2d27e38e5afa3e5c21c1c7bef4657064247, 2021-11-17T08:11:14.551Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i5-4460 CPU @ 3.20GHz (4 x 3193)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 11.85GB (6.28GB free)
Process Argv --crash-reporter-id 49cb8ad2-84d3-4aed-8376-e46174a6dfb1
Screen Reader no
VM 0%
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythontb:30283811
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263:30335439
vscorecescf:30384386
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
dockerwalkthru:30377721
bridge0723:30353136
pythonrunftest32:30373476
pythonf5test824:30373475
javagetstartedt:30391933
pythonvspyt187:30373474
vsqsis200:30402083
vsaa593:30376534
vssld246cf:30401891

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature: Code FormattingLanguage ServicebugfixedCheck the Milestone for the release in which the fix is or will be available.verifiedBug has been reproducedworld readyAn issue relating string character encodings, localization translations, etc.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions