diff --git a/README.md b/README.md index 26c57c0a..6f172ebd 100644 --- a/README.md +++ b/README.md @@ -85,9 +85,8 @@ 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), @@ -95,6 +94,13 @@ For further information about the keyboard shortcuts, please refer to the [`Defa [`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: diff --git a/TypeScript.sublime-settings b/TypeScript.sublime-settings index 6a916275..7666555c 100644 --- a/TypeScript.sublime-settings +++ b/TypeScript.sublime-settings @@ -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 } diff --git a/typescript/commands/quick_info.py b/typescript/commands/quick_info.py index 48f1251a..3c999559 100644 --- a/typescript/commands/quick_info.py +++ b/typescript/commands/quick_info.py @@ -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) diff --git a/typescript/listeners/idle.py b/typescript/listeners/idle.py index 80850608..5903dc76 100644 --- a/typescript/listeners/idle.py +++ b/typescript/listeners/idle.py @@ -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)