Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,22 @@ The below features are available via the keyboard shortcuts shown, or via the Co
|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.
The "format on key" feature is disabled by default, which formats the current line after typing `;`, `}` or `enter`.
To enable it, go to `Preferences` -> `Package Settings` -> `TypeScript` -> `Plugin Settings - User`, and add `"typescript_auto_format": true` to the json file.

For further information about the keyboard shortcuts, please refer to the [`Default.sublime-keymap`](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/Default.sublime-keymap) file for common shortcuts and
[`Default (OSX).sublime-keymap`](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/Default%20(OSX).sublime-keymap),
[`Default (Windows).sublime-keymap`](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/Default%20(Windows).sublime-keymap),
[`Default (Linux).sublime-keymap`](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/Default%20(Linux).sublime-keymap)
for OS-specific shortcuts.

#### Other settings

These settings can be overridden in `Packages/User/TypeScript.sublime-settings`, which you can open by going to `Preferences` -> `Package Settings` -> `TypeScript` -> `TypeScript Settings - User`.

- `error_color`: the color of the squiggly lines drawn underneath type errors; either an empty string for the default color, or one of `"region.redish"`, `"region.orangish"`, `"region.yellowish"`, `"region.greenish"`, `"region.bluish"`, `"region.purplish"`, `"region.pinkish"`
- `quick_info_popup_max_width`: the max width of the quick info popup, default 1024

Project System
------
The plugin supports two kinds of projects:
Expand Down
6 changes: 5 additions & 1 deletion TypeScript.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"auto_complete_triggers" : [ {"selector": "source.ts", "characters": "."} ],
"use_tab_stops": false,
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?"
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?",

// empty string, or one of "region.redish", "region.orangish", "region.yellowish", "region.greenish", "region.bluish", "region.purplish", "region.pinkish"
"error_color": "",
"quick_info_popup_max_width": 1024
}
5 changes: 3 additions & 2 deletions typescript/commands/quick_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ def handle_quick_info(self, quick_info_resp_dict, display_point):
if TOOLTIP_SUPPORT and (info_str != "" or doc_str != "" or error_html != ""):
if self.template is None:
self.template = Template(load_quickinfo_and_error_popup_template())

html = self.get_popup_html(error_html, info_str, doc_str)
self.view.show_popup(html, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=display_point, max_height=300, max_width=1500)

settings = sublime.load_settings("TypeScript.sublime-settings")
self.view.show_popup(html, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=display_point, max_height=300, max_width=settings.get("quick_info_popup_max_width") or self.view.viewport_extent()[0])

def get_popup_html(self, error, info, doc):
theme_styles = get_theme_styles(self.view)
Expand Down
3 changes: 2 additions & 1 deletion typescript/listeners/idle.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def show_errors(self, diagno_event_body, syntactic):
view.add_regions(region_key, error_regions, "invalid", "",
sublime.DRAW_OUTLINED)
else:
view.add_regions(region_key, error_regions, "invalid.illegal", "",
settings = sublime.load_settings("TypeScript.sublime-settings")
view.add_regions(region_key, error_regions, settings.get("error_color") or "invalid.illegal", "",
sublime.DRAW_NO_FILL +
sublime.DRAW_NO_OUTLINE +
sublime.DRAW_SQUIGGLY_UNDERLINE)
Expand Down