platformio / platformio/platformio-core

Invalid escape character in c_cpp_properties.json

Open
#4,440 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted integration
Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

VSCode is suddenly unhappy with c_cpp_properties.json. My platformio.ini file contains the build flag

-DTEMPLATE_PLACEHOLDER="\'\~\'"

which yields to the following in c_cpp_properties.json:

image

with the message "Invalid escape character in string. jsonc(261)"

Everything compiles just fine but I have to manually fix c_cpp_properties.json in order for Intellisense to work properly. I did not have this problem before but I'm not sure what caused it. Any help appreciated!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect how the build flag in platformio.ini is translated into c_cpp_properties.json, starting with the generated value shown in the report. Reproduce the invalid escape in VS Code and confirm that the generated JSON is valid while preserving the flag for IntelliSense.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, vscode
Domain
build-system, embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.