Code Monkey home page Code Monkey logo

Comments (10)

formulahendry avatar formulahendry commented on June 12, 2024 2

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.

formulahendry avatar formulahendry commented on June 12, 2024 1

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.

formulahendry avatar formulahendry commented on June 12, 2024 1

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.

formulahendry avatar formulahendry commented on June 12, 2024

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.

zgoda avatar zgoda commented on June 12, 2024

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.

ivankravets avatar ivankravets commented on June 12, 2024

@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.

zgoda avatar zgoda commented on June 12, 2024

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.

ivankravets avatar ivankravets commented on June 12, 2024

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.

formulahendry avatar formulahendry commented on June 12, 2024

@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.

formulahendry avatar formulahendry commented on June 12, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.