Skip to content

Commit

Permalink
feat: add sheets status to status bar and improve status hint display
Browse files Browse the repository at this point in the history
  • Loading branch information
yaroslavyaroslav committed Feb 6, 2025
1 parent 5fa2505 commit 9cd925d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion openAI.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"status_hint": [
// "name",
// "output_mode",
// "chat_model"
// "chat_model",
// "sheets"
],

// Proxy setting
Expand Down
13 changes: 8 additions & 5 deletions plugins/active_view_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from sublime_plugin import EventListener

from .load_model import get_model_or_default
from .openai_base import get_marked_sheets
from .status_bar import StatusBarMode

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -44,16 +45,18 @@ def update_status_bar(
return

statuses: List[str] = []
for key in ['name', 'prompt_mode', 'chat_model']:
for key in ['name', 'output_mode', 'chat_model', 'sheets']:
lookup_key = key if key != 'name' else 'name_'
if StatusBarMode[lookup_key].value in status_hint_options:
if key == 'chat_model':
statuses.append(assistant.chat_model.upper())
# FIXME: Prompt_mode is not a string, so it's failing to print.
# if key == 'prompt_mode':
# statuses.append(assistant.output_mode.title())
statuses.append(assistant.chat_model.title())
if key == 'output_mode':
statuses.append(str(assistant.output_mode).title().split('.')[1])
if key == 'name':
statuses.append(assistant.name.title())
if key == 'sheets':
sheets = get_marked_sheets(view.window() or sublime.active_window())
statuses.append(f'{len(sheets)}')

if statuses:
status = f'[{" | ".join(statuses)}]'
Expand Down
1 change: 0 additions & 1 deletion plugins/openai_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def initial_text(self) -> str:

def preview(self, text: str) -> str | sublime.Html:
sheets = get_marked_sheets(self.window)

return f'{len(sheets)} file(s) added: {str([sheet.view().file_name() for sheet in sheets])}'

def list_items(self) -> List[Tuple[str, Value]]:
Expand Down
3 changes: 2 additions & 1 deletion plugins/status_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@

class StatusBarMode(Enum):
name_ = 'name'
prompt_mode = 'prompt_mode'
output_mode = 'output_mode'
chat_model = 'chat_model'
sheets = 'sheets'

0 comments on commit 9cd925d

Please sign in to comment.