Skip to content

Commit 0b82fc2

Browse files
Merge pull request microsoft#715 from kylebebak/master
Changes default max width of HTML popup view from 1500 to 1024; adds error_color and quick_info_popup_max_width settings
2 parents 6a82ed1 + 515ad5c commit 0b82fc2

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,22 @@ The below features are available via the keyboard shortcuts shown, or via the Co
8585
|Build | (Win)`^B` or `F7`, (OSX) `⌘B` or `F7` |
8686
|Error list | (via Command Palette) |
8787

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

9291
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
9392
[`Default (OSX).sublime-keymap`](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/Default%20(OSX).sublime-keymap),
9493
[`Default (Windows).sublime-keymap`](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/Default%20(Windows).sublime-keymap),
9594
[`Default (Linux).sublime-keymap`](https://github.com/Microsoft/TypeScript-Sublime-Plugin/blob/master/Default%20(Linux).sublime-keymap)
9695
for OS-specific shortcuts.
9796

97+
#### Other settings
98+
99+
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`.
100+
101+
- `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"`
102+
- `quick_info_popup_max_width`: the max width of the quick info popup, default 1024
103+
98104
Project System
99105
------
100106
The plugin supports two kinds of projects:

TypeScript.sublime-settings

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
{
22
"auto_complete_triggers" : [ {"selector": "source.ts", "characters": "."} ],
33
"use_tab_stops": false,
4-
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?"
4+
"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?",
5+
6+
// empty string, or one of "region.redish", "region.orangish", "region.yellowish", "region.greenish", "region.bluish", "region.purplish", "region.pinkish"
7+
"error_color": "",
8+
"quick_info_popup_max_width": 1024
59
}

typescript/commands/quick_info.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ def handle_quick_info(self, quick_info_resp_dict, display_point):
6969
if TOOLTIP_SUPPORT and (info_str != "" or doc_str != "" or error_html != ""):
7070
if self.template is None:
7171
self.template = Template(load_quickinfo_and_error_popup_template())
72-
7372
html = self.get_popup_html(error_html, info_str, doc_str)
74-
self.view.show_popup(html, flags=sublime.HIDE_ON_MOUSE_MOVE_AWAY, location=display_point, max_height=300, max_width=1500)
73+
74+
settings = sublime.load_settings("TypeScript.sublime-settings")
75+
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])
7576

7677
def get_popup_html(self, error, info, doc):
7778
theme_styles = get_theme_styles(self.view)

typescript/listeners/idle.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ def show_errors(self, diagno_event_body, syntactic):
161161
view.add_regions(region_key, error_regions, "invalid", "",
162162
sublime.DRAW_OUTLINED)
163163
else:
164-
view.add_regions(region_key, error_regions, "invalid.illegal", "",
164+
settings = sublime.load_settings("TypeScript.sublime-settings")
165+
view.add_regions(region_key, error_regions, settings.get("error_color") or "invalid.illegal", "",
165166
sublime.DRAW_NO_FILL +
166167
sublime.DRAW_NO_OUTLINE +
167168
sublime.DRAW_SQUIGGLY_UNDERLINE)

0 commit comments

Comments
 (0)