Skip to content

Fix IDE include paths / Intellisense #615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 9, 2022
Merged

Fix IDE include paths / Intellisense #615

merged 2 commits into from
Jun 9, 2022

Conversation

maxgerhardt
Copy link
Contributor

The Arduino IDE / platform.txt builds this core by using a -iprefix <framework path> directive followed by the file in https://github.com/earlephilhower/arduino-pico/blob/master/lib/platform_inc.txt.

This however causes problems in PlatformIO because for the Intellisense of IDEs, since only what is in env["CPPPATH"] is exported as to be searched include path for headers is exported by PlatformIO. It's not smart enough to scan the compiler invocations for iprefix etc lines and reconstruct the paths from that for the IDE.

This restructures the build script to read the contents of the platform_inc.txt file, reconstruct the full path and then add them to env["CPPPATH"]. This fixes IntelliSense issues on Mac and Linux. Most interestingly, this did not affect Windows intellisense.

See platformio/platform-raspberrypi#36 (comment).

The compilation should be equivalent (-I<paths> vs iprefix + -iwithprefixbefore) and still works for me. I also read the same in the documentation.

Note: Mac users also complain that this core doesn't play nice with Arduino IDE 2 intellisense, very likely because of this very reason, it can't figure out the exact include paths. This could be looked into as a separate issue.

Before:

grafik

After:

grafik

@maxgerhardt
Copy link
Contributor Author

Note: If I don't filter non-existant paths, I receive 6 warnings.

grafik

This should likely be fixed in the original file too.

Copy link
Owner

@earlephilhower earlephilhower left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work in getting this into PIO!

@earlephilhower earlephilhower merged commit e3a1deb into earlephilhower:master Jun 9, 2022
earlephilhower added a commit that referenced this pull request Jun 9, 2022
@skybrian
Copy link
Contributor

Hi, I'm wondering what I should do to pick up this change when using PlatformIO? Is it released yet? (How do PlatformIO releases work, anyway?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants