EOSIO C++ IntelliSense in VSCode

in #eos5 years ago

EOSIO C++ IntelliSense in VSCode

<p dir="auto">If you're a developer nowadays chances are high that you're using VSCode as your IDE of choice.<br /> It's my favourite IDE for web development, but I also use it for C++ EOSIO smart contract development because it's free, unlike the CLion alternative. <p dir="auto">Per default, there is no IntelliSense (code completion, jump to class definitions, etc.) for EOSIO smart contract development which is a big productivity killer.<br /> However, there's an easy way to enable it for your VSCode workspace. <ol> <li>Install and enable the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">C/C++ IntelliSense Extension <li>Edit C++ Configuration: <code>CMD + SHIFT + P => <code>C/C++: Edit Configuration (UI) <ol> <li>In the <strong>Include paths sections add the path to your <code>eosio.cdt include directories and optionally your whole worksapce folder.<br /> ${workspaceFolder}/**<br /> /usr/local/opt/eosio.cdt/opt/eosio.cdt/include/eosiolib/core/**<br /> /usr/local/opt/eosio.cdt/opt/eosio.cdt/include/eosiolib/contracts/** <li>In the <strong>Defines section add definitions for <code>uint128_t. (When I didn't add this I encountered error lines below each <code>uint128_t.)<br /> uint128_t=__uint128_t<br /> int128_t=__int128_t<br /> <img src="https://images.hive.blog/768x0/https://cmichel.io/eosio-c-intelli-sense-in-vs-code/cpp-config.png" alt="CPP Configuration" srcset="https://images.hive.blog/768x0/https://cmichel.io/eosio-c-intelli-sense-in-vs-code/cpp-config.png 1x, https://images.hive.blog/1536x0/https://cmichel.io/eosio-c-intelli-sense-in-vs-code/cpp-config.png 2x" /> <p dir="auto">After reloading VSCode, you should be able to see the definitions when pressing CMD + clicking on expression: <p dir="auto"><img src="https://images.hive.blog/768x0/https://cmichel.io/eosio-c-intelli-sense-in-vs-code/intelli-sense.png" alt="EOSIO Intelli Sense" srcset="https://images.hive.blog/768x0/https://cmichel.io/eosio-c-intelli-sense-in-vs-code/intelli-sense.png 1x, https://images.hive.blog/1536x0/https://cmichel.io/eosio-c-intelli-sense-in-vs-code/intelli-sense.png 2x" /> <p dir="auto"><a href="https://learneos.dev#modal" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link"><img src="https://images.hive.blog/768x0/https://cmichel.io/images/learneos_subscribe.png" alt="Learn EOS Development Signup" srcset="https://images.hive.blog/768x0/https://cmichel.io/images/learneos_subscribe.png 1x, https://images.hive.blog/1536x0/https://cmichel.io/images/learneos_subscribe.png 2x" /> <hr /> <p dir="auto">Originally published at <a href="https://cmichel.io/eosio-c-intelli-sense-in-vs-code/" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://cmichel.io/eosio-c-intelli-sense-in-vs-code/