Coder Social home page Coder Social logo

tfrimor / bake-vscode-extension Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esrlabs/bake-vscode-extension

0.0 1.0 0.0 368 KB

vscode extension for the bake buildtool

Home Page: https://marketplace.visualstudio.com/items?itemName=elektronenhirn.bake

License: MIT License

TypeScript 100.00%

bake-vscode-extension's Introduction

This extension adds support for bake based C++ projects to VS Code.

Bake is a build tool for C++ projects supporting:

  • multiple modules (library, executable)
  • multiple targets

Features

  • Import C/C++ Include paths and Defines into VS Code
  • Create new .h and .cpp files based on templates (from explorer's context menu)
  • Search for and execute targets from bake files (from Tasks: Run Task command)
  • Show Hovers
  • Show Code Completion Proposals
  • Document Formatting (bake-format tool is used)
  • Support Bake RText Service

The following features are provided by the Bake Language Server if useRTextServer is enabled:

  • Provide Diagnostics

Requirements

  • bake installation >= 2.42.1 (bake installation instructions)
  • Linux (Windows and Mac OS X might work too)
  • an existing .vscode/c_cpp_properties.json file (how to create)
  • RText Server functionality requries bake-toolkit >= 2.56.0

Usage

Manage C++ Includes and Defines

VS Code's C++ integration requires a list of include paths and defines of your workspace. These need to be confiured at .vscode/c_cpp_properties.json. The bake extension can assist you with keeping the c_cpp_properties.json inline with your bake configuration.

From the command palette Ctrl+Shift+P:

  • Import C++ Includes and Defines from Bake
  • Clean imported C++ Includes and Defines from Bake

Import C++ Includes and Defines from Bake

A bake workspace typically contains multiple bake projects. Each project is defined by a Project.meta file. Typically projects depend on other projects. To import the C++ Includes and Defines, you need to select a project and build-config to build the dependency tree from.

There are two ways on how to select a project/config combination.

  1. Optional: there are pre-defined combinations at your .vscode/settings.json. These combinations are called build variants. They may include an optional --adapt parameter, too. If a build variant is marked as default=true is is automatically imported during opening of the workspace.

  2. Let VS Code search for Project.meta files in your workspace. Then you can select the project and the build-config afterwards.

Task definition

If config property is not set, then the Bake project default configuration will be used. The name property is used only in the VS Code UI to identify your task in the Tasks list.

{
    "name": "MyTask",
    "type": "bake",
    "project": "project_name",
    "config": "config_name",
    "problemMatcher": [
        "$gcc"
    ],
    "group": "build",
    "args": "argument_list"
}

Create new .h/.cpp files

The bake extension can assist you in creating new .h or *.cpp files. The files are then pre-filled with copyright informations, namespace definitions (derived from the folder name) and an empty class definition.

To create a new file: Select a folder at the Explorer panel and open the context menu (right mouse click).

You can customize the templates used to fill the files here:

  • .vscode/template.h
  • .vscode/template.cpp

Extension Settings

This extension contributes the following settings:

  • bake.parallelBuildNum: Number of processes used for parallel bake builds (-j parameter). Global setting that defaults to 8.
  • bake.unitTestsAdapt: Adapt for setting used compiler in unit test builds. Global setting that defaults to gcc.
  • bake.runUnitTestsOnBuild: Boolean whether unit tests shall be run after a successfull unit test build. Global setting that defaults to true.
  • bake.defaultPromblemMatcher: Used problem finder in the output during builds. Default to $gcc. Can be overwritten per task in task configuration.
  • bake.buildVariants: optional setting to define build variants to retrieve includes/defines from. A buildVariant is defined by a project (bake's -m flag) and a build config. Here is an example configuration for embedded development:
    "bake.buildVariants": {
        "All": {
            "importFrom": [
                "host-main",
                "host-tests",
                "target-main",
                "target-tests"
            ],
            "default": "true"
        },
        "host-main": {
            "project": "Main",
            "config": "host",
            "adapt": "clang"
        },
        "host-tests": {
            "project": "Tests",
            "config": "host",
            "adapt": "clang"
        },
        "target-main": {
            "project": "Main",
            "config": "target"
        },
        "target-tests": {
            "project": "Tests",
            "config": "target",
        }
  • bake.useRTextServer : Enable Bake RText service. Requires bake-toolkit version 2.56.0 or greater.

Deprecated (the following settings are now ignored):

  • bake.mainProject: override the path to the main project (bake's -m flag). Default is Main
  • bake.targetConfig: override the name of the target config

Known Issues

None

Debugging

If anything behaves unexpected check the Bake and Bake Language Server tab in the output window.

Authors

  • Florian Bramer
  • Troels Frimor

bake-vscode-extension's People

Contributors

elektronenhirn avatar joe3n avatar mdanilov avatar tfrimor avatar

Watchers

 avatar

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.