ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Better Type​Script

by lavrton ST3

Typescript syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more for Sublime Text.https://github.com/lavrton/sublime-better-typescript

Details

  • 2015.06.15.03.59.35
  • github.​com
  • github.​com
  • 2 weeks ago
  • 28 minutes ago
  • 2 years ago

Installs

  • Total 8K
  • Win 4K
  • OS X 3K
  • Linux 1K
Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16
Windows 1 12 6 9 15 11 14 10 2 3 1 6 7 12 12 12 5 7 10 20 14 14 14 6 5 5 9 11 12 17 1 6 10 13 7 13 5 4 6 21 9 8 10 10 9 9
OS X 2 4 3 3 6 8 5 8 7 3 11 3 5 3 12 7 3 5 6 6 8 13 12 4 4 8 9 11 8 7 7 8 14 8 14 8 7 5 5 10 8 6 11 15 10 8
Linux 2 6 1 0 2 2 2 5 2 1 4 6 2 2 2 6 1 1 4 3 3 3 2 0 2 4 5 7 4 5 6 10 1 2 6 5 1 5 1 5 2 4 2 3 5 8

Readme

Source
raw.​githubusercontent.​com

Better Typescript

Overview

This plugin is deprecated. Use Official Type​Script plugin instead..

Description

This is fork of Better CoffeeScript but adopted for work with Typescript. Also look at this TypeScript plugin for Sublime Text https://github.com/Railk/T3S. It is really awesome.

Installation

If you have Sublime Package Control, you know what to do. If not, well: it's a package manager for Sublime Text 3; it's awesome and you can read about it here. Installation guide can be found here.

  • Open the Command Pallete (ctrl+shift+P or cmd+shift+P).
  • Type “Install Package” and hit return.
  • Type “Better TypeScript” and hit return.

Build File Example

Current package don't have sublime build file. You can create it by yourself and save it (Preferences - Browse Packages... - User folder) as Typescript.sublime-build. Then use Cmd + B to build your file.

{
    "cmd": ["tsc", "-d", "-m", "amd", "--sourcemap", "$file"],
    "file_regex": "(.*\\.ts?)\\s\\(([0-9]+)\\,([0-9]+)\\)\\:\\s(...*?)$",
    "selector": "source.ts",
    "osx": {
       "path": "/usr/local/bin:/opt/local/bin"
    },
    "windows": {
        "cmd": ["tsc.cmd", "-d", "-m", "amd", "--sourcemap", "$file"]
    }
}

Commands/Shortcuts

You can access the commands either using the command palette (ctrl+shift+P or cmd+shift+P) or via shortcuts.

alt+shift+s - Run a syntax check
alt+shift+c - Compile a file
alt+shift+d - Display compiled JavaScript
alt+shift+w - Toggle watch mode

Context menu has Compile Output that compiles the current TypeScript and outputs the javascript code that is run, in a panel.

Note: Some of the commands use the Status Bar for output, so you'll probably want to enable it (View » Show Status Bar).

Snippets

  • Use TAB to run a snippet after typing the trigger.
  • Use TAB and shift+TAB to cycle forward/backward through fields.
  • Use ESC to exit snippet mode.

Thanks @MattSeen to provide Snippets (https://github.com/MattSeen/Sublime-TypeScript-Snippets)

Settings

Go to Preferences > Package Settings > Better TypeScript > Settings - User to change settings.

See Preferences > Package Settings > Better TypeScript > Settings - Default to see all available settings.

FAQ

Most of the linux terminal commands written here can be run via cygwin - aka Linux Terminal in Windows.

  • Most of the problems are related to configurations. Remember to configure binDir after you install!

  • Do I have tsc installed?

Try finding tsc in your global npm list with npm ls -g | grep tsc which will output something like:

npm ls -g | grep tsc
  • Where can I find out the path to tsc binary?

In Linux which command will tell you where a command originates from. In terminal type:

which tsc
# /usr/bin/tsc

This path will go into the binDir setting.