Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Sort imports by pathNew to Visual Studio Code? Get it now.
Sort imports by path

Sort imports by path

Richard Bidin

|
420 installs
| (0) | Free
Sort imports by absolute paths
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Import sort by absolute path

The sorting algorithm will group each item in the array and sort (alphabetically) its children that starts with the path provided.

Paths that have no match will be treated as npm packages and placed at the top, and also alphabetically sorted

e.g.:

imports before sorting

import database from '@backend/utils';
import errorCodes from '@backend/constants';
import { colors } from '@frontend/styles';
import { pick } from 'lodash';
import { getTheme } from '@frontend/helpers';

imports after sorting: sortImportsByPath.groups: `[['@frontend'], ['@backend']]

import { pick } from 'lodash';
import { getTheme } from '@frontend/helpers';
import { colors } from '@frontend/styles';
import errorCodes from '@backend/constants';
import database from '@backend/utils';
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft