Skip to content

tidalhq/ts-plugin-sort-import-suggestions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Before After
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 from TypeScript and JavaScript Language Features Extension), 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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published