Jump to content

CMD + Enter doesn't work correctly after saving a snippet


MoritzLost
 Share

Recommended Posts

Hi @adrian, I'm having a small but annoying issue with the Console panel in the debug bar. I'm using the Console to quickly try out code snippets, so most of the time I enter some code and hit CMD + Enter to run it. I've rarely ever used the option to save snippets on the right side. Now I tried to save a snippet which somehow broke the CMD + Enter shortcut. After saving a snippet, hitting CMD + Enter always wipes out whatever I have entered in the code input and restore that snippet from disk, instead of running the code I entered in the code input. Clicking the "Run" button above the code will execute the code I entered normally, it's only the keyboard command that's not working. So I tried removing the snippet and clearing the "Enter filename" input on the right. Still, after entering some code in the code input and hitting CMD + Enter, it will still try to load the (deleted) saved snippet from disk  – I can see an error in the debug bar: PHP Warning: file_get_contents([...]/site/templates/TracyDebugger/snippets/new.php): failed to open stream: No such file or directory in .../includes/ConsoleSnippets.php:16). Since the snippet file does not exist, it will wipe out the code I entered in the Console window completely.

Am I doing something wrong, or could this be a bug in the JS code handling the keyboard shortcut? I don't need the snippets, I just want to CMD + Enter Shortcut back to execute the code I entered in the Console window ^^' Thanks!

Link to comment
Share on other sites

Hi @MoritzLost - sorry about that - not sure how I messed up the keyboard shortcut. Should be working properly in the latest version.

Note that I typically use the ALT/OPT + Enter to run snippets because it clears and runs in one action. 

Regarding deleting a saved snippet - did you do that from the Console panel, or directly from the file system? You should do it from the console panel so that it also removes the entry from its local storage so it doesn't try to load the snippet from disk.

  • Thanks 1
Link to comment
Share on other sites

@adrian Awesome, thanks for the fix adrian, you're my hero ? Didn't know about the OPT + Enter shortcut, that's handy indeed!

I removed the snippet through the Console panel, that bit worked fine, I guess the problem was just the shortcut trying to load a snippet after it had been deleted. Anyway, thanks again!

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...