IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins
JavaScript Other
Latest commit 918289c Dec 22, 2016 @zhengbli zhengbli committed on GitHub Merge pull request #569 from Microsoft/updateLibAndGrammar
Update lib and grammar for TypeScript 2.1
Permalink
Failed to load latest commit information.
icons Moving the sublime TypeScript folder contents to the root Feb 20, 2015
messages Minor change Jun 23, 2015
screenshots Add screenshots Jul 22, 2015
snippets Remove extra newline in log snippet Feb 17, 2016
tsserver update to latest Dec 22, 2016
typescript Merge pull request #565 from w1ndy/master Dec 22, 2016
.gitignore Stop event listenrs from running if LS is disabled Nov 26, 2015
.no-sublime-package Fix issues due to sublime packaging Apr 10, 2015
Comments.tmPreferences Enable all snippets and custom commands to work with tsx source files. Sep 15, 2015
Default (Linux).sublime-keymap Enable all snippets and custom commands to work with tsx source files. Sep 15, 2015
Default (OSX).sublime-keymap Enable all snippets and custom commands to work with tsx source files. Sep 15, 2015
Default (Windows).sublime-keymap Stop event listenrs from running if LS is disabled Nov 26, 2015
Default.sublime-keymap Enable all snippets and custom commands to work with tsx source files. Sep 15, 2015
Default.sublime-mousemap Fix word multi select while holding "ctrl" Dec 1, 2016
ErrorList.YAML-tmLanguage Polish the errorlist panel and update the tsserver to 1.5 release Jun 18, 2015
ErrorList.hidden-tmLanguage Polish the errorlist panel and update the tsserver to 1.5 release Jun 18, 2015
FindRefs.YAML-tmLanguage Added configuration request. The host can send this request to inform Mar 16, 2015
FindRefs.hidden-tmLanguage Added configuration request. The host can send this request to inform Mar 16, 2015
FindRefs.hidden-tmTheme Hooking the mouse (double-click) in the reference view to go to the r… Feb 24, 2015
FindRefs.sublime-settings Moving the sublime TypeScript folder contents to the root Feb 20, 2015
LICENSE Initial commit Dec 15, 2014
Main.sublime-menu Make the menu items work with cloned plugin Nov 18, 2015
Preferences.sublime-settings make error tips optional Nov 2, 2016
README.md Put the instruction on changing tsdk up-front Sep 28, 2016
TypeScript Indent.YAML-tmPreferences Enable all snippets and custom commands to work with tsx source files. Sep 15, 2015
TypeScript Indent.tmPreferences Enable all snippets and custom commands to work with tsx source files. Sep 15, 2015
TypeScript.sublime-build Enable all snippets and custom commands to work with tsx source files. Sep 15, 2015
TypeScript.sublime-commands Use "Go To Definition" instead of "GoToDefinition". Aug 26, 2015
TypeScript.sublime-settings Removes `$` from word_separators Fixes #457 Apr 17, 2016
TypeScript.tmLanguage Update grammar Dec 9, 2016
TypeScriptReact.sublime-settings Add TypeScriptReact.sublime-settings to enable autocomplete in tsx fi… Sep 15, 2015
TypeScriptReact.tmLanguage Update grammar Dec 9, 2016
main.py Merge pull request #406 from zhengbli/addSwitchOffLS Feb 24, 2016
messages.json Add message for 0.1.5 Jun 23, 2015
quickinfo_and_error_popup.html Combine error tooltip with quick info Nov 18, 2016
signature_popup.html Combine error tooltip with quick info Nov 18, 2016

README.md

TypeScript Plugin for Sublime Text

Join the chat at https://gitter.im/Microsoft/TypeScript-Sublime-Plugin

The plugin uses an IO wrapper around the TypeScript language services to provide an enhanced Sublime Text experience when working with TypeScript code.

Requirements

The plug-in uses Node.js to run the TypeScript server. The plug-in looks for node in the PATH environment variable (which is inherited from Sublime). If the 'node_path' setting is present, this will override the PATH environment variable and the plug-in will use the value of the 'node_path' setting as the node executable to run. See more information in the tips.

Note: Using different versions of TypeScript

This plugin can be configured to load an alternate version of TypeScript. This is typically useful for trying out nightly builds, or prototyping with custom builds. To do that, update the Settings - User file with the following:

"typescript_tsdk": "<path to your folder>/node_modules/typescript/lib"

Installation

If using Package Control for Sublime Text, simply install the TypeScript package.

Alternatively, you can clone the repo directly into your Sublime plugin folder. For example, for Sublime Text 3 on a Mac this would look something like:

cd ~/"Library/Application Support/Sublime Text 3/Packages"
git clone --depth 1 https://github.com/Microsoft/TypeScript-Sublime-Plugin.git TypeScript

And on Windows:

cd "%APPDATA%\Sublime Text 3\Packages"
git clone --depth 1 https://github.com/Microsoft/TypeScript-Sublime-Plugin.git TypeScript

(--depth 1 downloads only the current version to reduce the clone size.) Note if you are using the portable version of Sublime Text, the location will be different. (See http://docs.sublimetext.info/en/latest/basic_concepts.html#the-data-directory for more info).

IMPORTANT If you already have a package called TypeScript installed, either remove this first, or clone this repo to a different folder, else module name resolution can break the plugin.

Platform support

OS:

The plugin has identical behavior across Windows, Mac, and Linux;

Sublime Text version:

The plugin supports both ST2 and ST3. However, some features are only available in ST3:

  • Tool tips
  • Error list

On Windows with ST2, you may see a "plugin delay" message upon startup. This happens because ST2 does not call "plugin_loaded()", so the TypeScript server process is started from within an event handler.

Where possible, the use of a Sublime Text 3 build >= 3070 is recommended, as this provides a popup API used for tool tips.

Features

The below features are available via the keyboard shortcuts shown, or via the Command Palette (^ means the ctrl key):

Feature Shortcut
Rename ^T ^M
Find references ^T ^R
Next reference ^T ^N
Prev reference ^T ^P
Format document ^T ^F
Format selection ^T ^F
Format line ^;
Format braces ^ Shift ]
Navigate to symbol ^ Alt R
Go to definition ^T^D or F12
Trigger completion ^Space
Trigger signature help Alt+,
See previous signature in the tooltip Alt + up
See next signature in the tooltip Alt + down
Paste and format ^V or ⌘V
Quick info ^T ^Q
Build (Win)^B or F7, (OSX) ⌘B or F7
Error list (via Command Palette)

The "format on key" feature is on by default, which formats the current line after typing ;, } or enter. To disable it, go to Preferences -> Package Settings -> TypeScript -> Plugin Settings - User, and add "typescript_auto_format": false to the json file.

For further information about the keyboard shortcuts, please refer to the Default.sublime-keymap file for common shortcuts and Default (OSX).sublime-keymap, Default (Windows).sublime-keymap, Default (Linux).sublime-keymap for OS-specific shortcuts.

Project System

The plugin supports two kinds of projects:

Inferred project

For loose TS files opened in Sublime, the plugin will create an inferred project and include every files that the current file refers to.

Configured project

The plugin also supports representing a TypeScript project via a tsconfig.json file. If a file of this name is detected in a parent directory, then its settings will be used by the plugin.

Screenshots

  • Project error list

  • Navigate to symbol

  • Format

  • Rename

  • Find all references

  • Quick info

  • Build configured project

  • Build loose file

Reporting Issues

Issues are being tracked via the GitHub Issues page for the project, and tagged with the appropriate issue type. Please do log issues for any bugs you find or enhancements you would like to see (after searching to see if such as issue already exists). We are excited to get your feedback and work with the community to make this plugin as awesome as possible.

Note about .tmLanguage related issues

As the TypeScript and TypeScriptReact .tmLanguage definition files are shared across multiple editors including Sublime Text, Atom-TypeScript, and Visual Studio Code, we decided to create a dedicated repo for these files to combine the efforts for improvement. The new repo is at https://github.com/Microsoft/TypeScript-TmLanguage, and all future tmLanguage-related issues will be tracked there and ported back to this repo.

Tips and Known Issues

See tips and known issues in the wiki page.