Skip to content

Commit ca7773f

Browse files
authored
Merge pull request #434 from SublimeText/feat/add-keymap-contextvars
Update sublime-keymap context vars completions
2 parents fba17b5 + c0fe39b commit ca7773f

2 files changed

Lines changed: 93 additions & 45 deletions

File tree

‎Package/Sublime Text Keymap/Completions/Context Key Values.sublime-completions‎

Lines changed: 63 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,33 @@
33

44
"completions": [
55
{
6-
"trigger": "num_selections",
7-
"details": "Number of selections",
6+
"trigger": "auto_complete_primed",
7+
"details": "Completion popup visibility",
88
"kind": ["variable", "k", "key"],
99
},
1010
{
1111
"trigger": "auto_complete_visible",
12-
"details": "Completion popup visibility",
12+
"details": "Mini auto-complete or completion popup visible; completion query active",
1313
"kind": ["variable", "k", "key"],
1414
},
1515
{
16-
"trigger": "selection_empty",
17-
"details": "Selection is empty",
16+
"trigger": "eol_selector",
17+
"details": "Match the scope at the end of the line",
1818
"kind": ["variable", "k", "key"],
1919
},
2020
{
21-
"trigger": "preceding_text",
22-
"details": "Text prededing the caret",
21+
"trigger": "following_text",
22+
"details": "Text following the caret",
2323
"kind": ["variable", "k", "key"],
2424
},
2525
{
26-
"trigger": "following_text",
27-
"details": "Text following the caret",
26+
"trigger": "group_has_multiselect",
27+
"details": "Group has multiselected tabs",
28+
"kind": ["variable", "k", "key"],
29+
},
30+
{
31+
"trigger": "group_has_transient_sheet",
32+
"details": "Group has a transient sheet",
2833
"kind": ["variable", "k", "key"],
2934
},
3035
{
@@ -38,23 +43,23 @@
3843
"kind": ["variable", "k", "key"],
3944
},
4045
{
41-
"trigger": "panel_visible",
42-
"details": "Panel visibility",
46+
"trigger": "has_snippet",
47+
"details": "Word before cursor expands to a snippet",
4348
"kind": ["variable", "k", "key"],
4449
},
4550
{
46-
"trigger": "overlay_visible",
47-
"details": "Overlay visibility",
51+
"trigger": "indented_block",
52+
// "details": "TODO",
4853
"kind": ["variable", "k", "key"],
4954
},
5055
{
51-
"trigger": "setting.",
52-
"details": "View setting value",
56+
"trigger": "is_javadoc",
57+
"details": "Caret in <code>/**</code> block comment",
5358
"kind": ["variable", "k", "key"],
5459
},
5560
{
56-
"trigger": "popup_visible",
57-
"details": "Popup visibility",
61+
"trigger": "is_recording_macro",
62+
"details": "A macro is currently being recorded",
5863
"kind": ["variable", "k", "key"],
5964
},
6065
{
@@ -63,13 +68,28 @@
6368
"kind": ["variable", "k", "key"],
6469
},
6570
{
66-
"trigger": "text",
67-
"details": "Selection text",
71+
"trigger": "last_modifying_command",
72+
"details": "Name of the last command run that modified a buffer",
6873
"kind": ["variable", "k", "key"],
6974
},
7075
{
71-
"trigger": "indented_block",
72-
// "details": "TODO",
76+
"trigger": "num_selections",
77+
"details": "Number of selections in current buffer",
78+
"kind": ["variable", "k", "key"],
79+
},
80+
{
81+
"trigger": "overlay_has_focus",
82+
"details": "Overlay has focus",
83+
"kind": ["variable", "k", "key"],
84+
},
85+
{
86+
"trigger": "overlay_name",
87+
"details": "Name of the overlay open",
88+
"kind": ["variable", "k", "key"],
89+
},
90+
{
91+
"trigger": "overlay_visible",
92+
"details": "Overlay visibility",
7393
"kind": ["variable", "k", "key"],
7494
},
7595
{
@@ -83,44 +103,49 @@
83103
"kind": ["variable", "k", "key"],
84104
},
85105
{
86-
"trigger": "selector",
87-
"details": "Match the caret's scope",
106+
"trigger": "panel_type",
107+
"details": "Type of focused panel",
88108
"kind": ["variable", "k", "key"],
89109
},
90110
{
91-
"trigger": "eol_selector",
92-
"details": "Match the scope at the end of the line",
111+
"trigger": "panel_visible",
112+
"details": "Panel visibility",
93113
"kind": ["variable", "k", "key"],
94114
},
95115
{
96-
"trigger": "overlay_has_focus",
97-
"details": "Overlay has focus",
116+
"trigger": "popup_visible",
117+
"details": "Popup visibility",
98118
"kind": ["variable", "k", "key"],
99119
},
100120
{
101-
"trigger": "overlay_name",
102-
"details": "Name of the overlay open",
121+
"trigger": "preceding_text",
122+
"details": "Text prededing the caret",
103123
"kind": ["variable", "k", "key"],
104124
},
105125
{
106-
"trigger": "group_has_multiselect",
107-
"details": "Group has multiselected tabs",
126+
"trigger": "read_only",
127+
"details": "If the buffer is marked read only",
108128
"kind": ["variable", "k", "key"],
109129
},
110130
{
111-
"trigger": "group_has_transient_sheet",
112-
"details": "Group has a transient sheet",
131+
"trigger": "selection_empty",
132+
"details": "Selection is empty",
113133
"kind": ["variable", "k", "key"],
114134
},
115135
{
116-
"trigger": "has_snippet",
117-
"details": "Word before cursor expands to a snippet",
136+
"trigger": "selector",
137+
"details": "Match the caret's scope",
118138
"kind": ["variable", "k", "key"],
119139
},
120140
{
121-
"trigger": "is_javadoc",
122-
// "details": "TODO",
141+
"trigger": "setting.",
142+
"details": "View setting value",
143+
"kind": ["variable", "k", "key"],
144+
},
145+
{
146+
"trigger": "text",
147+
"details": "Selection text",
123148
"kind": ["variable", "k", "key"],
124-
}
149+
},
125150
]
126151
}

‎Package/Sublime Text Keymap/Sublime Text Keymap.sublime-syntax‎

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,36 @@ contexts:
424424
3: punctuation.definition.string.end.json
425425
set: [context-entry-contents-selector, in-mapping-expect-comma]
426426
- match: |-
427-
(?x)(")((?:preceding_|following_)?text|num_selections|selection_empty
428-
|has_(?:next|prev)_field
429-
|(?:panel|auto_complete|popup)_visible|panel|panel_has_focus
430-
|last_command|indented_block|has_snippet|is_javadoc
431-
|overlay_(?:has_focus|visible|name)
432-
|group_has_(?:multiselect|transient_sheet)
433-
)(")
427+
(?x)
428+
(")
429+
( auto_complete_primed
430+
| auto_complete_visible
431+
| following_text
432+
| group_has_multiselect
433+
| group_has_transient_sheet
434+
| has_prev_field
435+
| has_next_field
436+
| has_snippet
437+
| indented_block
438+
| is_javadoc
439+
| is_recording_macro
440+
| last_command
441+
| last_modifying_command
442+
| num_selections
443+
| overlay_has_focus
444+
| overlay_name
445+
| overlay_visible
446+
| panel
447+
| panel_has_focus
448+
| panel_type
449+
| panel_visible
450+
| popup_visible
451+
| preceding_text
452+
| read_only
453+
| selection_empty
454+
| text
455+
)
456+
(")
434457
scope: meta.context.key-value.key.other.sublime-keymap string.quoted.double.json
435458
captures:
436459
1: punctuation.definition.string.begin.json

0 commit comments

Comments
 (0)