Socket
Book a DemoInstallSign in
Socket

ts-plugin-sort-import-suggestions

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-plugin-sort-import-suggestions

Customize the priority of auto-import suggestions from TypeScript Language Server

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
44K
11.6%
Maintainers
1
Weekly downloads
 
Created
Source

ts-plugin-sort-import-suggestions

A TypeScript plugin enables developers to customize the order of auto-import suggestions provided by the TypeScript Language Server. It should be compatible with any IDE or editor that utilizes the TypeScript Language Server.

BeforeAfter
Auto complete
Code Fix

Setup

  • Install package

    npm install ts-plugin-sort-import-suggestions
    
  • Config tsconfig.json

    {
      "compilerOptions": {
        "plugins": [
          {
            "name": "ts-plugin-sort-import-suggestions",
            // Matches `@/`, `../` and `./`, move them up in the suggestions (This is the default config if you leave it empty)
            "moveUpPatterns": ["@/", "\\.{1,2}/"],
            // Move `dist` down in the suggestions, by deafult it's `[]`
            "moveDownPatterns": ["dist"],
          }
        ]
      },
    }
    
  • Config your Editor or IDE to use the TypeScript from node_modules (i.e. Use Workspace Version in VSCode), otherwise TypeScript won't be able to load the plugin

    • select typescript version
    • use workspace version

Development

Please refer to TypeScript / Writing a TypeScript Plugin

FAQs

Package last updated on 23 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts