News

VS Code C++ Tool Customizes IntelliSense for Target Platforms

Visual Studio Code developers using Microsoft's C/C++ extension have gained the ability to customize the way IntelliSense works when coding for different platforms.

The C/C++ extension in the Visual Studio Code Marketplace adds language support for C++ to the cross-platform editor, including features such as debugging and IntelliSense, the latter providing individual language "smarts" like code completion.

Microsoft this week announced an update that addressed GitHub issue #1083 posted September 2017 titled "Support cross-compilation configurations for IntelliSense," that reads "I am sometimes working on my project using a cross-compilation toolchain (for example, working on a Mac laptop; the project targets Linux). I tried to configure IntelliSense to only search the project and the cross-compilation sysroot" only to get an error.

And, in announcing an update to the tool this week, Microsoft used that very same sample scenario:

"Let's say you're developing on macOS and your project targets Linux. Assuming you have a compiler compatible with your project's target platform and architecture, the C++ extension will query that compiler using the Compiler path, Compiler arguments, and IntelliSense mode settings in your IntelliSense configuration."

IntelliSense Mode
[Click on image for larger view.] IntelliSense Mode (source: Microsoft).

In other words, instead of using hard-coding system defines based on a host OS, the tool now uses the system defines returned by the compiler, Microsoft explained, providing the example that the intelliSenseMode value "linux-gcc-x64" could be used on a Mac host machine. "Now when you open your project in VS Code, you'll get IntelliSense for your target platform instead of macOS. No more squiggles from hardcoded system defines!"

Developers using a custom configuration provider such as CMake Tools or compile_commands.json don't need to update the C++ extension's IntelliSense configuration to get the provided functionality, however.

The update also squashes some 60-plus bugs and introduces some relatively minor new features, of which Microsoft highlighted the following:

  • clang-format has been updated to version 11. #6326
  • We now ship a native ARM64 clang-format binary with the extension for ARM64 Windows devices (#6494).
  • We added a command to generate EditorConfig contents from your code formatting settings (vcFormat) #6018
  • We support a new “console” launch config property for cppvsdbg (replacing the legacy “externalConsole” property). PR #6794

Much more detail about all of the above and many other changes is available in the release notes for the update, officially version 1.2.0.

About the Author

David Ramel is an editor and writer at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube