Skip to content

HiDeoo/trailing

Repository files navigation

Trailing icon

Trailing

Toggle trailing symbols: commas, semicolons and colons.

Integration Status License

Demo of the Trailing Extension

Features

As none of the existing trailing symbols toggling extension were fitting my needs, I decided to write my own with the following features:

  • Toggle multiple trailing symbols: commas, semicolons and colons.
  • Alternate keyboard shortcuts to toggle trailing symbols and automatically add a new line after them.
  • Option to control whether the cursor(s) should jump to the trailing symbol(s) (or added new line) when toggled.
  • Support for code comments.
  • Support for multiple cursors.
  • Support for multiple selections.

Usage

Set your cursor(s) on one or multiple line(s) and press one of the keyboard shortcuts provided by the extension.

You can also use the Visual Studio Code Command Palette and choose one of the Toggle trailing … or Toggle trailing … and add new line commands.

Shortcuts

This extension provides various configurable keyboard shortcuts to toggle trailing symbols.

Shortcut Description
Ctrl + , Toggle trailing comma.
Ctrl + Alt + , Toggle trailing comma and add new line.
Ctrl + ; Toggle trailing semicolon.
Ctrl + Alt + ; Toggle trailing semicolon and add new line.
Ctrl + Shift + ; Toggle trailing colon.
Ctrl + Shift + Alt + ; Toggle trailing colon and add new line.

Configuration

This extension contributes a language overridable setting to Visual Studio Code to control whether the cursor should automatically jump to the trailing symbol (or added new line) when toggled. This setting defaults to true and can be modified in the settings:

{
  "trailing.jumpToSymbol": false
}

Additionally, you can override this setting for specific languages:

{
  "[javascript]": {
    "trailing.jumpToSymbol": true
  }
}

License

Licensed under the MIT License, Copyright © HiDeoo.

See LICENSE for more information.