Search code examples
visual-studioeditorindentationproductivity-power-tools

Align includes other than align assignment


Visual Studio Productivity Tools provide the ability to align assignments to the same level.

Example:

From:

import import1 = require('import1');
import someLongerImport = require('someLongerImport');
import import2 = require('./some/folder/import');

To:

import import1          = require('import1');
import someLongerImport = require('someLongerImport');
import import2          = require('./some/folder/import');

What I need now is the ability to align other things than assignments that could be specified by some regex.

Example:

From:

import import1 = require('import1');
import {differentSyntax} from 'someLongerImport';
import * as evenMoreSyntax from './some/folder/import';

To:

import import1              = require('import1');
import {differentSyntax}    from 'someLongerImport';
import * as evenMoreSyntax  from './some/folder/import';

Does Visual Studio Productivity Tools provide such functionality or are there any other plug-ins that could do that?


Solution

  • Turns out there is the Code alignment extension that supports exactly that.

    I have now created a =\ *require\('.*?'\);?|from \'.*?';? regex pattern alignment which works perfectly fine.