-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat: codex tool tips #7440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: codex tool tips #7440
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
74f070c
feat: codex tool tips
jif-oai d57d4e0
Default to true
jif-oai 2785531
Show tooltip only after first call
jif-oai 88a2bf8
More tooltips
jif-oai 1a33c25
More tooltips 2
jif-oai c775755
CLippy and tests
jif-oai 939b01b
CLippy and tests
jif-oai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| use lazy_static::lazy_static; | ||
| use rand::Rng; | ||
|
|
||
| const RAW_TOOLTIPS: &str = include_str!("../tooltips.txt"); | ||
|
|
||
| lazy_static! { | ||
| static ref TOOLTIPS: Vec<&'static str> = RAW_TOOLTIPS | ||
| .lines() | ||
| .map(str::trim) | ||
| .filter(|line| !line.is_empty() && !line.starts_with('#')) | ||
| .collect(); | ||
| } | ||
|
|
||
| pub(crate) fn random_tooltip() -> Option<&'static str> { | ||
| let mut rng = rand::rng(); | ||
| pick_tooltip(&mut rng) | ||
| } | ||
|
|
||
| fn pick_tooltip<R: Rng + ?Sized>(rng: &mut R) -> Option<&'static str> { | ||
| if TOOLTIPS.is_empty() { | ||
| None | ||
| } else { | ||
| TOOLTIPS.get(rng.random_range(0..TOOLTIPS.len())).copied() | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
| use rand::SeedableRng; | ||
| use rand::rngs::StdRng; | ||
|
|
||
| #[test] | ||
| fn random_tooltip_returns_some_tip_when_available() { | ||
| let mut rng = StdRng::seed_from_u64(42); | ||
| assert!(pick_tooltip(&mut rng).is_some()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn random_tooltip_is_reproducible_with_seed() { | ||
| let expected = { | ||
| let mut rng = StdRng::seed_from_u64(7); | ||
| pick_tooltip(&mut rng) | ||
| }; | ||
|
|
||
| let mut rng = StdRng::seed_from_u64(7); | ||
| assert_eq!(expected, pick_tooltip(&mut rng)); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Use /compact when the conversation gets long to summarize history and free up context. | ||
| Use /mention path/to/file to pull a specific file into the conversation. | ||
| Start a fresh idea with /new; the previous session stays available in history. | ||
| If a turn went sideways, /undo asks Codex to revert the last changes. | ||
| Use /feedback to send logs to the maintainers when something looks off. | ||
| Switch models or reasoning effort quickly with /model. | ||
| You can run any shell commands from codex using `!` (e.g. `!ls`) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.