Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- The command palette (`ctrl+p`) now lists Harlequin's own commands, each with its key, and matches Harlequin's look ([#223](https://github.com/tconbeer/harlequin/issues/223)).
- New bindable actions: `change_theme`, `code_editor.close_all_buffers`, `toggle_transaction_mode`, `commit_transaction`, and `rollback_transaction` ([#223](https://github.com/tconbeer/harlequin/issues/223)).
- The command palette's **Show Files** and **Show S3** commands (bindable as `show_files` and `show_s3`) add the Data Catalog's Files or S3 tab, or point it at a different directory or bucket, without restarting Harlequin ([#223](https://github.com/tconbeer/harlequin/issues/223)).
- The footer shows the command palette's key, `^p Commands`, and the palette can be bound to any key as `command_palette` ([#223](https://github.com/tconbeer/harlequin/issues/223)).

### Bug Fixes

Expand Down
7 changes: 7 additions & 0 deletions src/harlequin/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class Action:
description="Help",
show=True,
),
"command_palette": Action(
target=None,
action="command_palette",
description="Commands",
show=True,
priority=True,
),
"toggle_keys_panel": Action(
target=None,
action="toggle_keys_panel",
Expand Down
28 changes: 20 additions & 8 deletions src/harlequin/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ class Harlequin(AppBase):
"""

CSS_PATH = ["global.tcss", "app.tcss"]
# the palette's key comes from the keymaps, like every other action's
ENABLE_COMMAND_PALETTE = False

full_screen: reactive[bool] = reactive(False)
sidebar_hidden: reactive[bool] = reactive(False)
Expand Down Expand Up @@ -333,6 +335,8 @@ def __init__(
css_path=css_path,
watch_css=watch_css,
)
# ENABLE_COMMAND_PALETTE only stops Textual binding a key to the palette
self.use_command_palette = True
self.adapter = adapter
self.adapter_name = adapter_name
self.profile_name = profile_name
Expand Down Expand Up @@ -1407,15 +1411,23 @@ async def action_quit(self) -> None:
await super().action_quit()

def action_show_help_screen(self) -> None:
keys_panel_key = next(
(
self.get_key_display(binding)
for _, binding in self._bindings
if binding.action == "toggle_keys_panel"
),
None,
def key_for(action: str) -> str | None:
return next(
(
self.get_key_display(binding)
for _, binding in self._bindings
if binding.action == action
),
None,
)

self.push_screen(
HelpScreen(
keys_panel_key=key_for("toggle_keys_panel"),
command_palette_key=key_for("command_palette"),
id="help_screen",
)
)
self.push_screen(HelpScreen(keys_panel_key=keys_panel_key, id="help_screen"))

def action_show_help_panel(self) -> None:
if self.screen.query(KeysPanel):
Expand Down
9 changes: 8 additions & 1 deletion src/harlequin/components/help_screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ class HelpScreen(HarlequinModal[None]):
def __init__(
self,
keys_panel_key: str | None = None,
command_palette_key: str | None = None,
name: str | None = None,
id: str | None = None, # noqa: A002
classes: str | None = None,
) -> None:
super().__init__(name=name, id=id, classes=classes)
self.keys_panel_key = keys_panel_key
self.command_palette_key = command_palette_key

def compose(self) -> ComposeResult:
markdown_path = Path(__file__).parent / "help_screen.md"
Expand All @@ -44,9 +46,14 @@ def compose(self) -> ComposeResult:

def _keys_panel_tip(self) -> str:
if self.keys_panel_key is None:
palette = (
f"the command palette ([b $secondary]{self.command_palette_key}[/])"
if self.command_palette_key is not None
else "the command palette"
)
return (
"To see the keys for the focused widget, open the Keys panel from "
"the command palette ([b $secondary]ctrl+p[/])."
f"{palette}."
)
return (
f"Press [b $secondary]{self.keys_panel_key}[/] to show or hide the "
Expand Down
1 change: 1 addition & 0 deletions src/harlequin_vscode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
VSCODE_APP_BINDINGS = [
HarlequinKeyBinding("ctrl+q", "quit"),
HarlequinKeyBinding("f1", "help"),
HarlequinKeyBinding("ctrl+p", "command_palette"),
HarlequinKeyBinding("f2", "focus_query_editor"),
HarlequinKeyBinding("f5", "focus_results_viewer"),
HarlequinKeyBinding("f6", "focus_data_catalog"),
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading
Loading