Skip to content

beschler/indentify

Repository files navigation

Indentify

A Visual Studio Code extension to replace space indentation with tabs.

  1. Features
  2. Uneven Indentation
  3. Install
  4. Release

Features

This extension, once installed, creates a new command in the VS Code Command Palette called Indentify: Replace space indentation with tabs.

When this command is executed, it will convert the space indentation in the current file from 2 spaces to tabs.

For example, given the following code below, formatted with 2 space indentation:

<div>
  <ul>
    <li></li>
  </ul>
</div>

This will be replaced with the following tab indentation:

<div>
	<ul>
		<li></li>
	</ul>
</div>

NOTE: This command will not replace multiple spaces within the contents of a line. The regular expression only matches spaces at the beginning of the line.

Uneven Indentation

In the event the file has uneven indentation (for example, 3 spaces of indentation on a line), the command will round up, and convert 3 spaces into 2 tabs, with the assumption that the single space was intended to be a full 2 space indentation (total 4 space indentation, or 2 tabs).

For example, given the following indentation:

<div>
  <ul>
   <li></li>
  </ul>
</div>

This will be replaced with:

<div>
	<ul>
		<li></li>
	</ul>
</div>

This ensures that all leading whitespace indentation is converted to tabs, and no space indentation remains whatsoever (no combination of spaces and tabs).

Install

  1. Clone this repository to your local machine.

  2. Install vsce globally on your local machine:

In Terminal:

npm install -g @vscode/vsce
  1. Package this extension using vsce:

In Terminal, change directory to this repository:

cd path/to/indentify

Package this extension:

vsce package

This will create a .vsix file in the root directory of the repo.

  1. Install the .vsix file:

In VS Code, invoke the Command Palette, and execute command: Extensions: Install from VSIX....

In the file browser, choose the .vsix file that was created in the previous step.

Release

This extension was released on May 11, 2023, and is stable on VS Code version 1.78.0.

About

A Visual Studio Code extension to replace space indentation with tabs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published