pmneo / ts-importer

MIT License
73 stars 8 forks source link

TS Importer

Automatically searches for TypeScript definitions in workspace files and provides all known symbols as completion item to allow code completion.

If a TypeScripts ^1.9.0 paths.* mapping is set in the tsconfig.json, the imports are tried to be resolved absolutly. Otherwise the imports are resolved relative to the current file.

The current supported symbols are:

  export class [name] { ... }
  export abstract class [name] { ... }
  export interface [name] { ... }
  export type [name] =  { ... },
  export const [name] = ...
  export var [name] = ...
  export let [name] = ...
  export function [name] = ...
  export function* [name] = ...
  export enum [name] = ...
  export default ...


Configuration

This can be configured in .vscode/settings.json.

Settings will only be applied on startup or executing the reindex command.

tsimporter.filesToScan - Glob for which files in your workspace to scan, defaults to ['**/*.ts','**/*.tsx']

tsimporter.filesToExclude - Glob for files to exclude from watch and scan, e.g ./out/**. Defaults to nothing

tsimporter.showNotifications - Show status notifications, default is false

tsimporter.doubleQuotes - Use double quotes rather than single

tsimporter.spaceBetweenBraces - Insert spaces between the import braces. ( import {test} from 'test' vs. import { test } from 'test' )

tsimporter.disabled - Disables the extension

tsimporter.removeFileExtensions - File Extensions to remove. default is '.d.ts,.ts,.tsx'

tsimporter.lowImportance - If true, the code completion items will be sorted back to the build in completion items. default is false

tsimporter.emitSemicolon - If false, no semicolon will be written. default is true

tsimporter.tsconfigName - An alternative tsconfig.json filename. default is 'tsconfig.json'

tsimporter.noStatusBar - True to hide the status bar

tsimporter.preferRelative - When true shorter relative imports will be be prefered instead of absolute imports


Changelog

2.0.0

1.2.14

1.2.13

1.2.12

1.2.11

1.2.10

1.2.9

1.2.8

1.2.7

1.2.6

1.2.5

1.2.4

1.2.3

1.2.2

1.2.1

1.2.0

1.1.0

1.0.1

1.0.0

ToDo