Create new file without having to save

Very often I need to copy some blob text from somewhere and edit it, since I'm coding inside PHPStorm, its natural that i bring this blob in so I can begin editing it.

For example, I just copied a bunch of text that I want to make some edits to …In VSCode, it was as simple as pressing Cmd + N and then pasting what I needed to and then close the tab and go about my tasks…it even allowed me to create the new temp file in the same language of the previously opened one, example, if i was editing a PHP file, then the new tab would be considered a PHP tab, same for JS etc.

I haven't found how to do this in PHPStorm…is it possible? My googling lead me to Scratch files but those still seem like something you need to *create* not just a temporary tab that you can later save as a file…

Here's an example of this VSCode (uploaded using upload service): Upload id: 2024_02_12_X9Eo3gKHkQB8L2U4L3sMjc (file: Screen Recording 2024-02-12 at 1.23.02 PM.mov)

 I guess its because VSCode is built on Electron, is there no way to do this in PHPStorm? I'm currently making the switch, so slowly coming across these different things

I can see people asking this from as far back is 2010: https://intellij-support.jetbrains.com/hc/en-us/community/posts/207073265-Possible-to-create-a-new-file-without-saving?input_string=Create%20new%20file%20without

 

0
3 comments

Hi Shairu,

You found the correct information. PhpStorm allows you to create so-called Scratch files to draft up some code outside the project context. They are easy to use and may satisfy your needs. Scratch files are not stored in your project directory but can be opened when you're working on any other project:

 Also, it is possible to create them right from the code using intention:

Here is the link for the reference: https://www.jetbrains.com/help/phpstorm/scratches.html.

0

@Anastasiia Zyrianova 

That still requires several clicks…its quicker to open VSCode and paste the text versus trying to create a scratch file in PHPStorm…

0

Hi Shairu,

There are several ways to create Scratch files in PhpStorm. For example, select the code block you need to save and use a shortcut ⌘Сmd+⇧Shift+N (for Mac) or Ctrl+Alt+Shift+Insert (for Windows). You will not need to perform any additional actions or open other applications.
Creating them via intention may be a "longer" process, but you will still need to have only the IDE itself open.
It is up to you to decide on how to proceed, however, I would recommend giving scratch files a try :) 

0

Please sign in to leave a comment.