GithubHelp home page GithubHelp logo

zhengbli / typescript-sublime-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoft/typescript-sublime-plugin

0.0 0.0 0.0 38.15 MB

IO wrapper around TypeScript language services, allowing for easy consumption by editor plugins

License: Apache License 2.0

JavaScript 96.41% Python 3.58% HTML 0.01%

typescript-sublime-plugin's Introduction

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.

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 (Win)Alt+,
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.

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.

typescript-sublime-plugin's People

Contributors

aceslick911 avatar aminroosta avatar artemsnisarenko avatar billti avatar chbrown avatar danielrosenwasser avatar danquirk avatar fionafung avatar gitter-badger avatar hinzo avatar hoanhtien avatar jgoz avatar joneshf avatar kungfusheep avatar mhegazy avatar mozgiii avatar mprobst avatar selvasingh avatar steveluc avatar ukyo avatar zhengbli avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.