Search code examples
qtvisual-studio-code

How do I use Qt in Visual Studio Code?


I'm using Linux Mint 18, and the Visual Studio Code marketplace doesn't list an extension for Qt.


Solution

  • You should give a chance for this extension: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools

    With this, you can configure include paths for better IntelliSense results.

    Configuring includePath

    One way to configure e.g the QtCore module.

    1. Ctrl + Shift + p to open command palette
    2. Search for: C/Cpp: Edit Configurations
    3. You should have a new tab called: c_cpp_properties.json
    4. In configurations array you should edit the Linux section
    5. Add your paths in the includePath setting e.g: /usr/include/x86_64-linux-gnu/qt5/QtCore

    For more check this: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Getting%20started.md

    IntelliSense engines

    We recommend using the "Default" engine for the best IntelliSense experience. However, it is possible to explicitly choose the IntelliSense engine by editing your user or workspace settings. The setting you should modify is C_Cpp.intelliSenseEngine

    • Default - Visual Studio's IntelliSense engine, which is the default engine that provides semantic-aware IntelliSense features
    • Tag Parser - the "fuzzy" IntelliSense engine that provides quick but "fuzzy" results, is used to provide the fallback experience if the default engine is

    More details about it: https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/LanguageServer/IntelliSense%20engine.md