Comments (10)
Hi @ivankravets , really appreciate your insight here. This command is really helpful. I will continue to integrate more PlatformIO functions into VS Code. Hope to get more insights from you expert in the future. 😃
from vscode-iot-utility.
Understand!
Those kind of features are more specific for languages.
In short-term, this extension will be more focus on the PlatformIO features like Library Manager, Board Manager and so on.
In long-term, I will take a look at the language feature support (e.g. code snippet, syntax highlight, intellisense and so on) for related languages (.c
, .cpp
, .ino
, platformio.ini
and so on).
So I will keep this issue open here.
Feel free to add comments or create new issues if you have more suggestions or feedback.
from vscode-iot-utility.
Hi @zgoda , this function has been added. Press F1
and then select/type PlatformIO: Add Include Path to Settings
. Wait for some seconds, then the PlatformIO libraries will be automatically added into Include Path of c_cpp_properties.json
. Please install the latest version and have a try. Let me know whether it works as you expected. 😄
from vscode-iot-utility.
Hi @zgoda , thanks for your feedback!
I am familiar with VS Code but a freshman for PlatformIO. 😄 Could you please let me know more about your problem?
- I you run
PlatformIO: Build
, is there any error? - Or, do you want those C Header files to be added automatically? Or anything else you want (e.g. IntelliSense)?
from vscode-iot-utility.
PlatformIO builds the project fine, the problem is in editor.
C++ extension provides couple of services related to code - intellisense, "go to declaration", just to name a few. For this to work, it has to know the location of libs and headers. Now I can add these paths to C++ ext configuration file ${workspaceRoot}/.vscode/c_cpp_properties.json
and it would be nice if PIO ext takes care of this task by managing paths to framework and libs.
from vscode-iot-utility.
@formulahendry PIO Core has special target for pio run
command that allows to export main information from build environment. You can use it to provide code linting and completion. Run
pio run --target idedata
If project contains more than 1 environment, you need to specify the first build environment from platformio.ini
. pio run -e FIRST_ENV -t idedata
.
from vscode-iot-utility.
To make it clear what I'm after - look at my c_cpp_properties.json
file that configures Microsoft official VS Code extension for C/C++:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${HOME}/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/cores/esp8266",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src",
"${workspaceRoot}/.piolibdeps/ESPAsyncTCP_ID305/src",
"${workspaceRoot}/.piolibdeps/ESPAsyncWebServer_ID306/src",
"${workspaceRoot}/.piolibdeps/AsyncMqttClient_ID346/src",
"${workspaceRoot}/lib",
"${workspaceRoot}/src"
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceRoot}/.vscode/browse.vc.db"
}
}
]
}
I had to enter all these include paths manually and the list is still incomplete. Could this be done automatically?
from vscode-iot-utility.
I can generate this file with pio init --ide vscode
as we do for other IDEs. However, let's wait for @formulahendry.
from vscode-iot-utility.
@zgoda, thanks for your detailed sample. It is really helpful! With @ivankravets's suggestion (pio run --target idedata
), it would be possible to support that. I will investigate this feature in next release.
from vscode-iot-utility.
@ivankravets, just see your comment. pio init --ide vscode
would be great!! Just have a try with platformio init --ide visualstudio --board uno
. Seems like pio init --ide vscode
could cover most of lib path like below (except "${workspaceRoot}/.piolibdeps/***/src"
):
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${HOME}/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/cores/esp8266",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi/src",
"${HOME}/.platformio/packages/framework-arduinoespressif8266/libraries/Hash/src",
"${workspaceRoot}/lib",
"${workspaceRoot}/src"
],
"browse": {
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": "${workspaceRoot}/.vscode/browse.vc.db"
}
}
]
}
In my extension, by using pio run --target idedata
, I could provide a command in vscode to cover:
- Add lib path like
"${workspaceRoot}/.piolibdeps/***/src"
- Those users work on existing pio project in vscode, and want to quickly add all paths with a command
Both two options (pio init --ide vscode
and a command in vscode extension) would be useful to user. What's your opinion? 😃
from vscode-iot-utility.
Related Issues (16)
- Add license HOT 1
- Bad cli commands
- c_cpp_properties.json file removes entries automatically when you close and reopen vscode HOT 6
- Requires Chinese language and visual operate interface
- fresh install on VSC, Windows 64bits, 1.18.1 doesn't work HOT 1
- could i change the installation of of platformio ide? HOT 1
- Identifier "snprintf" is not defined intellisense error
- difference between this and core platformio? HOT 1
- How to select project for key command?
- [FR] Option to get baudRate from pio.ini file
- Config to disable duplicated buttons
- Change baud rate for the serial monitor HOT 10
- Good job HOT 12
- c_cpp_properties.json should be recreated
- Add C/C++ extension as an extension dependency HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-iot-utility.