Open italocjs opened 2 months ago
Note, i did try pio init --ide=vscode, it did generate a file, but had no intelissensse for anything outside my own project:
//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
"configurations": [
{
"name": "PlatformIO",
"includePath": [
"/workspace/app/include",
"/workspace/app/src",
"/workspace/app/lib/Geofence/src",
"/workspace/app/lib/SmartoneC",
"/workspace/app/lib/api",
"/workspace/app/lib/cmd_processor",
"/workspace/app/lib/nimble_nus",
"/workspace/app/lib/nimble_source/src",
"/workspace/app/lib/port",
"/workspace/app/lib/sample_interface",
"/workspace/app/lib/sdcard",
""
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"path": [
"/workspace/app/include",
"/workspace/app/src",
"/workspace/app/lib/Geofence/src",
"/workspace/app/lib/SmartoneC",
"/workspace/app/lib/api",
"/workspace/app/lib/cmd_processor",
"/workspace/app/lib/nimble_nus",
"/workspace/app/lib/nimble_source/src",
"/workspace/app/lib/port",
"/workspace/app/lib/sample_interface",
"/workspace/app/lib/sdcard",
""
]
},
"defines": [
"PLATFORMIO=60114",
"MY_PROJECT_VERSION=10",
""
],
"compilerPath": "/usr/bin/gcc",
"compilerArgs": [
""
]
}
],
"version": 4
}
i did try to manually include some stuff, without success (not sure if i'm even including the right directories)
//
// !!! WARNING !!! AUTO-GENERATED FILE!
// PLEASE DO NOT MODIFY IT AND USE "platformio.ini":
// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags
//
{
"configurations": [
{
"name": "PlatformIO",
"includePath": [
"/workspace/app/include",
"/workspace/app/src",
"/workspace/app/lib/Geofence/src",
"/workspace/app/lib/SmartoneC",
"/workspace/app/lib/api",
"/workspace/app/lib/cmd_processor",
"/workspace/app/lib/nimble_nus",
"/workspace/app/lib/nimble_source/src",
"/workspace/app/lib/port",
"/workspace/app/lib/sample_interface",
"/workspace/app/lib/sdcard",
"/root/.platformio/packages/framework-espidf/components/**",
"/root/.platformio/packages/framework-espidf/tools/**",
"/root/.platformio/packages/framework-arduinoespressif32/cores/esp32/**",
"/root/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/**",
""
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"path": [
"/workspace/app/include",
"/workspace/app/src",
"/workspace/app/lib/Geofence/src",
"/workspace/app/lib/SmartoneC",
"/workspace/app/lib/api",
"/workspace/app/lib/cmd_processor",
"/workspace/app/lib/nimble_nus",
"/workspace/app/lib/nimble_source/src",
"/workspace/app/lib/port",
"/workspace/app/lib/sample_interface",
"/workspace/app/lib/sdcard",
"/root/.platformio/packages/framework-espidf/components/**",
"/root/.platformio/packages/framework-espidf/tools/**",
"/root/.platformio/packages/framework-arduinoespressif32/cores/esp32/**",
"/root/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/**",
""
]
},
"defines": [
"PLATFORMIO=60114",
"MY_PROJECT_VERSION=10",
""
],
"compilerPath": "/usr/bin/gcc",
"compilerArgs": [
""
]
}
],
"version": 4
}
compiling works fine.
yay, manage to fix my intelissense by using pio init --environment esp32dev --ide vscode
then using a custom script to copy it to the parent folder, hope it helps anyone with intelisense issues
#!/bin/bash
# Check if an environment name is provided
if [ -z "$1" ]; then
echo "Usage: $0 <environment_name>"
echo "Default environments are: native | esp32dev"
exit 1
fi
ENVIRONMENT_NAME=$1
# Change directory to the specified path
cd /workspace/app/ || exit
# Store the command used to initialize the environment
INIT_COMMAND="pio init --environment $ENVIRONMENT_NAME --ide vscode"
# Execute the command
$INIT_COMMAND
if [ $? -eq 0 ]; then
echo "Successfully initialized environment '$ENVIRONMENT_NAME' for VSCode."
else
echo "Failed to initialize environment '$ENVIRONMENT_NAME' for VSCode."
exit 1
fi
# Prepare a header message for the c_cpp_properties.json file using a here-document
cat > temp_header.json <<EOF
/*
This file was generated by the prepare_intelissense.sh script using the command:
$INIT_COMMAND
It is intended for setting up IntelliSense configurations for the environment: $ENVIRONMENT_NAME.
*/
EOF
# Append the original c_cpp_properties.json content to the temporary file
cat .vscode/c_cpp_properties.json >> temp_header.json
# Copy and replace the c_cpp_properties.json file with the one that includes the header
cp -f temp_header.json /workspace/.vscode/c_cpp_properties.json
if [ $? -eq 0 ]; then
echo "Successfully copied IntelliSense settings for environment '$ENVIRONMENT_NAME'."
else
echo "Failed to copy IntelliSense settings for environment '$ENVIRONMENT_NAME'."
exit 1
fi
# Clean up the temporary file
rm temp_header.json
Would love to find a way to use the extension tho.
My current folder structure places all the app (including the platformio.ini) in the "app" folder, i need to start vscode at the parent folder so i can access the .github, .vscode and documentation.
How can i make the extension locate the platformio.ini there?. I am using docker. I do not need the extension to be fair, would only use to generate that file, i'm happy using cli, but having a really bad time configuring the c_cpp_properties (esp-idf functions shows a not defined in intelissense, but code compiles fine).
My current platformio.ini