Vscode Comment Block Mac



Ctrl + K + C Comment Block. Ctrl + K + U Uncomment Block. There also a 'Toggle Block Comment' option but this did not work for me. There are other 'wierd' ways too: right click to see 'Command Palette' or F1. Then choose a cursor option. Now it is just a matter of # or even smarter Ctrl + k + Ctrl + c.

This mode is used for the VS Code configuration files such as settings.json, tasks.json, or launch.json. When in the JSON with Comments mode, you can use single line (//) as well as block comments (/./) as used in JavaScript. The current editor mode is indicated in the editor's Status Bar. Type /. to start a block comment, then hit the Enter key, and the extension will close the block. While inside the comment block, the extension will insert an asterisk at the start of every new line, and align the comment, respecting indentation. QDoc-style (Qt) comment blocks. In C/C files to start a QDoc comment block. When you press a shortcut for block comment, your caret is set in the position where you can start typing: /. caret./ Just hit Enter, and you'll get a new line inside the comment where you can start typing Clemens W. Dmitry Matveev. a year ago Thanks for your reply. When debugging or experimenting with code, it can be useful to comment blocks of code either temporarily or long term. To comment out an entire block of code: Select the code and select Toggle Line Comment(s) from the context menu; OR. Use the cmd + / keybinding on the selected code. These methods can be used to comment and uncomment sections of code.

  • General

  • Tutorials

  • Interfaces & Protocols

  • API Reference

    • ODrive

      • Can

        • Config

        • Error

        • Protocol

      • Endpoint

      • Axis

        • LockinConfig

        • Config

          • CalibrationLockin

        • Error

        • LockinState

        • AxisState

      • ThermistorCurrentLimiter

      • OnboardThermistorCurrentLimiter

        • Config

      • OffboardThermistorCurrentLimiter

        • Config

      • Motor

        • CurrentControl

        • GateDriver

        • TimingLog

        • Config

        • Error

        • ArmedState

        • MotorType

      • Controller

        • Config

          • Anticogging

        • Error

        • ControlMode

        • InputMode

      • Encoder

        • Config

        • Error

        • Mode

      • SensorlessEstimator

        • Config

        • Error

      • TrapezoidalTrajectory

        • Config

      • Endstop

        • Config

      • SystemStats

        • Usb

        • I2C

      • Config

  • For ODrive Developers

  • Component Guides

Download Vscode Mac

Help improve these docs: submit edits using the link in the top right.

If you need help, please search or ask the ODrive Community.

VSCode is the recommended IDE for working with the ODrive codebase. It is a light-weight text editor with Git integration and GDB debugging functionality.

Before doing the VSCode setup, make sure you’ve installed all of your prerequisites

Setup Procedure

  1. Clone the ODrive repository
  2. Open VSCode
  3. Install extensions. This can be done directly from VSCode (Ctrl+Shift+X)
    • Required extensions:
      • C/C++ ext install ms-vscode.cpptools
      • Cortex-Debug ext install marus25.cortex-debug
      • Cortex-Debug: Device Support Pack - STM32F4 ext install marus25.cortex-debug-dp-stm32f4
    • Recommended Extensions:
      • Include Autocomplete
      • Path Autocomplete
      • Auto Comment Blocks
  4. Create an environment variable named ARM_GCC_ROOT whose value is the location of the GNU Arm Embedded Toolchain (.e.g C:Program Files (x86)GNU Tools Arm Embedded7 2018-q2-update) that you installed in the prerequisites section of the developer’s guide. This is not strictly needed for Linux or Mac, and you can alternatively use the Cortex-debug: Arm Toolchain Path setting in VSCode extension settings.
  5. Relaunch VSCode
  6. Open the VSCode Workspace file, which is located in the root of the ODrive repository. It is called ODrive_Workspace.code-workspace. The first time you open it, VSCode will install some dependencies. If it fails, you may need to change your proxy settings.

You should now be ready to compile and test the ODrive project.

Building the Firmware

  • Terminal -> Run Build Task (Ctrl+Shift+B)

A terminal window will open with your native shell. VSCode is configured to run the command make -j4 in this terminal.

Flashing the Firmware

  • Terminal -> Run Task -> flash

A terminal window will open with your native shell. VSCode is configured to run the command make flash in this terminal.

If the flashing worked, you can connect to the board using the odrivetool.

Debugging

An extension called Cortex-Debug has recently been released which is designed specifically for debugging ARM Cortex projects. You can read more on Cortex-Debug here: https://github.com/Marus/cortex-debug

Note: If developing on Windows, you should have arm-none-eabi-gdb and openOCD on your PATH.

  • Make sure you have the Firmware folder as your active folder
  • Set CONFIG_DEBUG=true in the tup.config file
  • Flash the board with the newest code (starting debug session doesn’t do this)
  • In the Run tab (Ctrl+Shift+D), select “Debug ODrive (Firmware)”
  • Press Start Debugging (or press F5)
  • The processor will reset and halt.
  • Set your breakpoints. Note: you can only set breakpoints when the processor is halted, if you set them during run mode, they won’t get applied.
  • Continue (F5)
  • Stepping over/in/out, restarting, and changing breakpoints can be done by first pressing the “pause” (F6) button at the top the screen.
  • When done debugging, simply stop (Shift+F5) the debugger. It will kill your openOCD process too.

Cleaning the Build

This sometimes needs to be done if you change branches.

  • Open a terminal (View -> Integrated Terminal) and enter make clean

JSON is a data format that is common in configuration files like package.json or project.json. We also use it extensively in VS Code for our configuration files. When opening a file that ends with .json, VS Code provides features out of the box to make it simpler to write or modify the file's content.

JSON Comments

Comments in JSON are an extension to JSON specification that is supported by VS Code. You can use single line (//) as well as block comments (//) as used in JavaScript.

IntelliSense & Validation

For properties and values, both for JSON data with and without a schema, we offer up suggestions as you type with IntelliSense. You can also manually see suggestions with the Trigger Suggestions command (kb(editor.action.triggerSuggest)). We also perform structural and value verification based on an associated JSON schema giving you red squigglies.

Package and Project Dependencies

We also offer IntelliSense for specific value sets such as package and project dependencies in package.json, project.json and bower.json.

Quick Navigation

JSON files can get pretty large and we support quick navigation to properties the Go to Symbol command (kb(workbench.action.gotoSymbol)).

Vscode

Vscode Comment Block Machine

Hovers

When you hover over properties and values for JSON data with or without schema, we will provide additional context.

Formatting

You can format your JSON document using kb(editor.action.formatDocument) or Format Document from the context menu.

JSON Schemas & Settings

To understand the structure of JSON files, we use JSON schemas. JSON schemas describe the shape of the JSON file, as well as value sets, default values, and descriptions.

Servers like JSON Schema Store provide schemas for most of the common JSON based configuration files. However, schemas can also be defined in a file in the VS Code workspace, as well as the VS Code settings files.

The association of a JSON file to a schema can be done either in the JSON file itself using the $schema attribute, or in the User or Workspace settings (File > Preferences > Settings) under the property json.schemas.

VS Code extensions can also define schemas and schema mapping. That's why VS Code already knows about the schema of some well known JSON files such as package.json, bower.json and tsconfig.json.

Mapping in the JSON

In the following example, the JSON file specifies that its contents follow the CoffeeLint schema.

Please note that this syntax is VS Code-specific and not part of the JSON Schema specification. Adding the $schema key changes the JSON itself, which systems consuming the JSON might not expect, for example, schema validation might fail. If this is the case, you can use one of the other mapping methods.

Mapping in the User Settings

The following excerpt from User settings shows how .babelrc files are mapped to the babelrc schema located on http://json.schemastore.org/babelrc.

Tip: Additionally to defining a schema for .babelrc, also make sure that .babelrc is associated to the JSON language mode. This is also done in the settings using the files.association array setting.

Mapping to a Schema in the Workspace

To map a schema that is located in the workspace, use a relative path. In this example, a file in the workspace root called myschema.json will be used as the schema for all files ending with .foo.json.

Mapping to a Schema Defined in Settings

To map a schema that is defined in the User or Workspace settings, use the schema property. In this example, a schema is defined that will be used for all files named .myconfig.

Mapping a Schema in an Extension

Schemas and schema associations can also be defined by an extension. Check out the jsonValidation contribution point.

Define Snippets in JSON Schemas

JSON schemas describe the shape of the JSON file, as well as value sets and default values which are used by the JSON language support to provide completion proposals.If you are a schema author and want to provide even more customized completion proposals, you can also specify snippets in the schema. The following example shows a schema for a key binding settings file defining a snippet:

Use the property defaultSnippets to specify any number of snippets for the given JSON object.

Vscode comment shortcut
  • label and description will be shown in the completion selection dialog. If no label is provided, a stringified object representation of the snippet will be shown as label instead.
  • body is the JSON object that is stringified and inserted when the completion is selected by the user. Snippet syntax can be used inside strings literals to define tabstops, placeholders and variables. If a string starts with ^, the string content will be inserted as-is, not stringified. You can use this to specify snippets for numbers and booleans.

Note that defaultSnippets is not part of the JSON schema spec but a VS Code specific schema extension.