Commit 9e42ff8
feat(chat): Add /ed command to compose prompts in text editor (#1035)
* feat(chat): Add /ed command to compose prompts in text editor
Implement the /ed command that opens the user's preferred editor to
compose a prompt. The content is automatically submitted when the
editor closes, improving the user experience for longer prompts.
Fixes #1029
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(chat): Remove /ed command from masthead text
Keep the /ed command in the help text but remove it from the masthead
to avoid overloading users with too many commands when they are getting
started.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(chat): Improve editor command naming and help text
Rename command from /ed to /editor and improve the help text to clarify
that vi is used as the default editor when nvim is not set. Keep the
function name as open_editor for better code readability.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(chat): Change /ed command to /editor for clarity
This change renames the /ed command to /editor in the command list to make
its purpose more clear to users. The longer name is more descriptive and
easier to understand for new users.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* refactor(q_cli): Convert open_editor to associated function
Remove unused self parameter from open_editor method and update call site
to use Self::open_editor() instead of self.open_editor().
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* feat(chat): Enhance editor command to accept initial text
Allow users to provide initial text with the /editor command that will
be pre-populated in the editor. Also remove the default template text
to provide a cleaner editing experience.
This commit also fixes compilation errors by adding the missing
pending_tool_index field to ChatState initializers in the editor
command handling code.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
* style: Fix code formatting for editor command
Update the formatting of the PromptEditor struct initialization to match
Rust style guidelines. This fixes the cargo +nightly fmt check.
🤖 Assisted by [Amazon Q Developer](https://aws.amazon.com/q/developer)
---------
Co-authored-by: Enrico Carlesso <[email protected]>1 parent 437f83d commit 9e42ff8
File tree
4 files changed
+138
-1
lines changed- crates/q_cli/src/cli/chat
4 files changed
+138
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
232 | 233 | | |
233 | 234 | | |
234 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
235 | 245 | | |
236 | 246 | | |
237 | 247 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
56 | 65 | | |
57 | 66 | | |
58 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
22 | 29 | | |
23 | 30 | | |
24 | 31 | | |
| |||
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
| 95 | + | |
88 | 96 | | |
89 | 97 | | |
90 | 98 | | |
| |||
122 | 130 | | |
123 | 131 | | |
124 | 132 | | |
| 133 | + | |
125 | 134 | | |
126 | 135 | | |
127 | 136 | | |
| |||
418 | 427 | | |
419 | 428 | | |
420 | 429 | | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
421 | 465 | | |
422 | 466 | | |
423 | 467 | | |
| |||
780 | 824 | | |
781 | 825 | | |
782 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
783 | 885 | | |
784 | 886 | | |
785 | 887 | | |
| |||
1886 | 1988 | | |
1887 | 1989 | | |
1888 | 1990 | | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
1889 | 2006 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
0 commit comments