Repository navigation
JSON error when formatting with .editorconfig #12921
Description
Environment
- OS and Version: Windows 11 Pro 23H2
- VS Code Version: 1.95.1
- C/C++ Extension Version: v1.22.10
- If using SSH remote, specify OS of remote machine: No SSH involve
Bug Summary and Steps to Reproduce
Bug Summary:
When .editorconfig file presents in the project, formatting c++ code will result in JSON error: conversion mismatch shown in debug output penal. As a result, the extension uses default vcFormat setting to format.
This is reproducible in version 1.22.0 or above. For version before 1.22.0 the formatting has no issue handling editorconfig file and can format code as desired.
Steps to reproduce:
- Install and enable C/C++ extension version v1.22.10
- In Preference: Open Settings(UI), ensure 'C_Cpp: Clang_format_style' set to 'file' and 'C_Cpp: Formatting' set to 'default'
- Unzip format_test.zip to a test folder
- Open format_test folder with Vscode
- Open test.cpp.
- Right click code, select 'Format Document'
- In 'Output' window's dropdown list, select C/C++
- See error:
Expected behavior:
No JSON error displayed and in C++ code, 'else' should stay in the same line with '}'
Configuration and Logs
Database safe to open.
LSP: (received) cpptools/formatDocument: file:///c%3A/workspace/format_test/test.cpp (id: 12)
LSP: (invoked) cpptools/formatDocument: file:///c%3A/workspace/format_test/test.cpp (id: 12)
JSON error: editorConfigSettings.cpp_indent_braces: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_preserve_within_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_case_labels: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_case_contents: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_case_contents_when_block: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_lambda_braces_when_parameter: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_access_specifiers: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_namespace_contents: conversion mismatch
JSON error: editorConfigSettings.cpp_indent_preserve_comments: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_scope_braces_on_separate_lines: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_close_brace_same_line_empty_type: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_close_brace_same_line_empty_function: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_before_catch: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_before_else: conversion mismatch
JSON error: editorConfigSettings.cpp_new_line_before_while_in_do_while: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_parameter_list_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_parameter_list_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_keywords_in_control_flow_statements: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_control_flow_statement_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_lambda_open_parenthesis: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_cast_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_cast_close_parenthesis: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_expression_parentheses: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_block_open_brace: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_braces: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_initializer_list_open_brace: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_initializer_list_braces: conversion mismatch
JSON error: editorConfigSettings.cpp_space_preserve_in_initializer_list: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_open_square_bracket: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_empty_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_group_square_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_within_lambda_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_between_empty_lambda_brackets: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_comma: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_comma: conversion mismatch
JSON error: editorConfigSettings.cpp_space_remove_around_member_operators: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_inheritance_colon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_before_constructor_colon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_remove_before_semicolon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_after_semicolon: conversion mismatch
JSON error: editorConfigSettings.cpp_space_remove_around_unary_operator: conversion mismatch
Formatting document: file:///c%3A/workspace/format_test/test.cpp
Formatting Engine: vcFormat
Other Extensions
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
sean-mcmanus commentedon Nov 5, 2024
This was a regression from #12579 .
sean-mcmanus commentedon Nov 6, 2024
Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.22.11