Skip to content

Commit 9080f0f

Browse files
committed
Migrate quick panel items to sublime.QuickPanelItem
Switches from plain list[str] captions to QuickPanelItem so kind/annotation fields become available for a future dirty-tab indicator. No visible behavior change.
1 parent 9dd9cb0 commit 9080f0f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎plugin/_compat.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,23 @@ def set(self, key, value):
1717
def erase(self, key):
1818
self.pop(key, None)
1919

20+
class _QuickPanelItem:
21+
__slots__ = ["trigger", "details", "annotation", "kind"]
22+
23+
def __init__(self, trigger, details="", annotation="", kind=(0, "", "")):
24+
self.trigger = trigger
25+
self.details = details
26+
self.annotation = annotation
27+
self.kind = kind
28+
2029
class _SublimeModule(SimpleNamespace):
2130
OP_EQUAL = 0
2231
OP_NOT_EQUAL = 1
2332
KEEP_OPEN_ON_FOCUS_LOST = 0
2433
MONOSPACE_FONT = 0
34+
KIND_ID_COLOR_ORANGISH = 10
35+
KIND_AMBIGUOUS = (0, "", "")
36+
QuickPanelItem = _QuickPanelItem
2537

2638
def set_timeout(self, callback, timeout=0):
2739
callback()

‎plugin/session.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ def show_panel(window, state) -> None:
2626
if not state.session_active or not state.session_entries:
2727
return
2828

29-
items = [entry.caption for entry in state.session_entries]
29+
items = [
30+
sublime.QuickPanelItem(trigger=entry.caption[0], details=entry.caption[1])
31+
for entry in state.session_entries
32+
]
3033

3134
def on_select(index: int) -> None:
3235
if index < 0:

0 commit comments

Comments
 (0)