Skip to content

Commit f288027

Browse files
committed
Add rust_phantom_style and rust_region_style config settings.
Fixes rust-lang#182.
1 parent 5062a4f commit f288027

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ There are a variety of settings (see [Settings](#settings)) for controlling the
6868
| `rust_syntax_hide_warnings` | `false` | If true, will not display warning messages. |
6969
| `rust_syntax_error_color` | `"#F00"` | Color of error messages. |
7070
| `rust_syntax_warning_color` | `"#FF0"` | Color of warning messages. |
71+
| `rust_phantom_style` | `"normal"` | How to display inline messages. Either `normal` or `none`. |
72+
| `rust_region_style` | `"outline"` | How to highlight messages. Either `outline` or `none`. |
7173

7274
Here is an example:
7375
![testingrust](https://cloud.githubusercontent.com/assets/43198/22944409/7780ab9a-f2a5-11e6-87ea-0e253d6c40f6.png)

RustEnhanced.sublime-settings

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
2222
// running Cargo.
2323
"rust_include_shell_env": true,
2424

25+
// For errors/warnings, how to show the inline message.
26+
// "normal" - Shows the message inline.
27+
// "none" - Do not show the message inline.
28+
"rust_phantom_style": "normal",
29+
30+
// For errors/warnings, how to highlight the region of the error.
31+
// "outline" - Outlines the region.
32+
// "none" - No outlining.
33+
"rust_region_style": "outline",
34+
2535
// If your cargo project has several build targets, it's possible to specify mapping of
2636
// source code filenames to the target names to enable syntax checking.
2737
// "projects": {

rust/messages.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def draw_all_region_highlights(window):
9393

9494

9595
def _draw_region_highlights(view, messages):
96+
if util.get_setting('rust_region_style', 'outline') == 'none':
97+
return
9698
error_regions = []
9799
info_regions = []
98100
error_region_set = set()
@@ -123,6 +125,8 @@ def _draw_region_highlights(view, messages):
123125

124126

125127
def _show_phantom(view, level, span, message):
128+
if util.get_setting('rust_phantom_style', 'normal') == 'none':
129+
return
126130
region = _span_to_region(view, span)
127131
# For some reason, with LAYOUT_BELOW, if you have a multi-line
128132
# region, the phantom is only displayed under the first line. I

0 commit comments

Comments
 (0)