Skip to content

Add instant command execution with modifier keys#279

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/add-instant-command-feature
Draft

Add instant command execution with modifier keys#279
Copilot wants to merge 5 commits intomainfrom
copilot/add-instant-command-feature

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

Instant Command Feature Implementation

インスタントコマンド機能の実装が完了しました!✅

Implementation Checklist

  • 1. Type Definitions - Update types/index.ts

    • Add InstantCommandSettings type with enabled, commandId, modifierKey fields
    • Update UserSettings to include instantCommand field
  • 2. Default Settings - Update services/option/defaultSettings.ts

    • Add default instantCommand settings (disabled by default)
  • 3. Schema Validation - Update types/schema.ts

    • Add Zod schema for instantCommand validation
    • Update formSchema in SettingForm.tsx
  • 4. Detection Hook - Create hooks/useDetectInstantCommand.ts

    • Implement hook to detect modifier key + text selection
    • Auto-execute selected command when conditions are met
    • Follow pattern from useDetectLinkCommand.ts
    • Fix TypeScript errors with executeCommand and position
    • Remove unused dependencies from useEffect
    • Use selectionText from useSelectContext (PR feedback)
  • 5. Integration - Update App.tsx

    • Integrate instant command detection hook
    • Ensure it runs before menu popup
  • 6. Options UI - Update components/option/SettingForm.tsx

    • Add "Instant Command" section with Zap icon
    • Add SwitchField to enable/disable feature
    • Add SelectField to choose command from commands list
    • Add SelectField to choose modifier key (Shift, Ctrl, Alt)
    • Use strict equality operator
  • 7. Internationalization - Update locale files

    • Add translations in all 14 locale files (ja, en, de, es, fr, hi, id, it, ko, ms, pt_BR, pt_PT, ru, zh_CN)
  • 8. Build Verification

    • Successfully built extension
  • 9. Testing

    • All 525 existing tests pass
    • Extension builds successfully
  • 10. Code Review

    • Initial code review completed
    • All initial issues addressed
    • PR feedback addressed

Summary

インスタントコマンド機能が正常に実装されました。この機能により、ユーザーはモディファイアキー(Shift、Ctrl、Alt)を押しながらテキストを選択することで、メニューを表示せずに選択したコマンドを即座に実行できます。

Latest Changes (PR Feedback):

  • ✅ Changed to use selectionText from useSelectContext instead of window.getSelection()
  • ✅ More consistent with existing architecture
  • ✅ Avoids redundant DOM queries
  • ✅ Removed unused positionElm parameter
Original prompt

This section details on the original issue you should resolve

<issue_title>即時起動コマンド Instant command</issue_title>
<issue_description>テキスト選択が確定したら、即時起動するコマンド

  • 作成済みのコマンドから、好きなものを選択可能
  • モディファイアキーが押された状態で起動、の選択肢
  • 未選択でも起動は可能
  • デフォルトでは無効
  • 最後に起動したコマンドを起動するコマンド
    • 履歴メニューから選択するコマンド</issue_description>

Comments on the Issue (you are @copilot in this section)

@ujiro99 # 設計書

概要

メニューからのコマンド選択を経ずに、同じコマンドを繰り返し実行する機能を提供する。

想定ユースケース

  • ページ上のテキストを連続してコピーする
  • ページ上のテキストを連続して翻訳する
  • ページ上のテキストのスタイルを連続して見る

機能要件

  • Instant commandとして、既存のコマンドの中から一つを選択する
  • モディファイアキーが押された状態でテキスト選択をすると、自動でInstant commandを発動する
  • デフォルトではInstant commandは無効</comment_new>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 8, 2026 02:18
Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Copilot AI changed the title [WIP] Add instant command functionality for text selection Add instant command execution with modifier keys Feb 8, 2026
Copilot AI requested a review from ujiro99 February 8, 2026 02:34
// Check if modifier key is pressed
if (!checkModifierKey(event)) return

// Check if there's selected text
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectedTextはuseSekectContextに入っているので、それを持ってくること

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 上記のコメントを確認してください。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正しました。window.getSelection() の代わりに useSelectContext から selectionText を使用するようにしました。

コミット: b3dab25

変更内容:

  • selectionText を context から直接使用
  • 不要な positionElm パラメータを削除
  • より一貫したアーキテクチャに

Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.google-analytics.com
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node --conditions node --conditions development /home/REDACTED/work/selection-command/selection-command/node_modules/tinypool/dist/entry/process.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI requested a review from ujiro99 February 24, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

即時起動コマンド Instant command

2 participants