I am using Visual Studio Code 5 1.31.one. I used an input function but I tin can't write an input in output panel it shows this error

Cannot edit in read-only editor.

Please help me solve this problem.

asked Feb 24, 2019 at 20:47

5

  1. Become to File > Preference > Settings then
  2. blazon: run lawmaking and scroll downwards until you lot encounter code-runner: Run in final , There will be multiple options called "code-runner". In that you can find the option mentioned below.
  3. just check "Whether to run code in integrated terminal" and
  4. restart vscode.

For Mac users, it is Code > Preference > Settings.

answered Feb 26, 2019 at half dozen:19

5

If you can't observe where to discover code runner equally said in Ali NoumSali Traore's answer, hither'due south what you lot got to do:

  1. Go to extensions (Ctrl + Shift + X)
  2. Find lawmaking runner and click on the settings icon on bottom right of the code runner
  3. Click configure extensions settings
  4. Detect code_runner: Run in terminal
  5. Check "Whether to run code in last"

answered Jul 30, 2019 at xiv:eleven

1

You lot are in the "Output" tab instead of the Terminal. The output tab is actually merely for y'all to read from.

enter image description here

Press F5 to brainstorm Debugging and information technology'll bring you into the Terminal tab.

The final is interactive, and so you lot tin can read output AND blazon back. It is indeed a console prompt/ final (hence its proper name).

enter image description here

answered Sep 30, 2019 at ix:55

I received this fault during a code compare with previous version and it wasn't letting me edit the electric current version in the Correct-Window. Unrelated to what I doubtable OP's event but this was the offset thread that came up for my search and the error was the aforementioned. anyway...

My issue was that the particular file was 'Staged' in my source control at the time. This appears to restrict editing by opening an 'index' version for the compare.

Solution: Un-stage the file, and reopen the comparative window.

answered Jun 5, 2019 at xv:01

ii

The easiest way to fix this was to printing (CTRL) and (,) in VS Lawmaking to open Settings.

After that, on the search bar search for lawmaking runner, then coil down and search for Run In Terminal and bank check that box as highlighted in the beneath image:

Dharman

26.1k 20 gold badges 67 argent badges 117 bronze badges

answered Sep 25, 2020 at 10:59

Had the same problem. Here's what I did & it got me the results I wanted.

  1. Go to the Last of Visual studio code.
  2. Cd to the directory of the file that has the code you wrote and ran. Let's call the program " xx.cpp "
  3. Type g++ xx.cpp -o a.out (creates an executable)
  4. To run your programme, type ./a.out

answered Jul 26, 2019 at xiii:53

I received the same error similar @jgritten. But like the comment before me by @jgritten, I 'unstaged' and reopened vscode and the files. Now I 'staged' information technology again. The error "Cannot edit in read-only editor" didnt come.

Hope this reassures anyone who might have similar error afterwards staging the file using git in vscode.

answered Jul xv, 2019 at xi:06

I was experiencing this effect while using the SFTP extension in VSCode. In this case, all you have to do is correct-click somewhere in the file and select 'edit in local'

enter image description here

enter image description here

enter image description here

answered Nov 12, 2020 at 13:48

If your code takes input from a user y'all can't only use output tab. You lot have to use any last equally Hashemite kingdom of jordan Stefanelli have said.

  1. just become to last tab and select powershell or default terminal
  2. type python Nameoffile.py
  3. you will be able to input

colidyre

three,320 eleven golden badges 32 silver badges 46 bronze badges

answered April 20, 2020 at i:02

I had the Cannot edit in read-only editor fault when trying to edit lawmaking after stopping the debug mode (for 2-3 minutes afterward pressing Shift+F5).

Turns out the default Node version (v9.11.1) wasn't exiting gracefully, leaving VScode stuck on read-merely.
Only adding "runtimeVersion": "12.4.0" to my launch.json file stock-still information technology.

alternatively, change your default Node version to the latest stable version (you can run across the current version on the DEBUG Console when starting debug mode).

answered Nov xviii, 2020 at 10:31

Every bit the @Jordan Stefanelli answer: If you encounter the same problem as me that the integrated Terminal cannot read input from user as beneath hanging (env. Windows 10)

enter image description here

my solution was to supplant cygwin's gdb and g ++ with mingw64'south.

then the input output are normal

enter image description here besides you lot can enable "external panel" option to solve it:)

you can modify information technology by enabling "externalConsole":true in the launch.json then you will become a popular upwards console window that you can type in.

answered Nov 27, 2019 at 8:01

Short Answer: Subsequently installing "Code Runner" extension, you only have to right-click the selected part of code you wish to execute and see it in the Output Tab.

answered Nov 23, 2020 at 14:nineteen

Click on the file and hover on Preferences. there you volition find the first choice as Settings and click on that. There search run code. and scroll and find the option code runner: Run in Terminal. now check the option below it

answered Dec xix, 2020 at 6:thirteen

I had the same trouble, even though i enable the lawmaking runner to true, i was not still able to get my vsc terminal run. The quick prepare was that mentioned by @Jordan Stefanelli. I add to my setting.json in the launch section "externalConsole":truthful,

                "launch": {           "externalConsole":true,     "configurations": [],     "compounds": [] }                              

answered Mar 31, 2021 at xi:49

Here's the piece of cake mode: Higher up your mistake "cannot edit in read-simply editor" there volition be a path to your cpp lawmaking file, it might wait something similar this if you are running on Linux:

                cd "/home/jacksparrow/Documents/projects/" && g++ exams.cpp -o exams && "/domicile/jacksparrow/Documents/projects/"exams                              

and then all you have to do is "re-create(ctrl+shift+C) that path address and paste(ctrl+shift+V) it in the concluding window and printing enter" right adjacent to your output and debug console window. This worked for me, hope information technology does for yous also.

answered May 7, 2021 at 17:23

In VS Code, install code runner. When running your file please specify how yous want to run the file, in the output window or concluding. For a better feel brand sure y'all have selected the concluding.

answered May 12, 2021 at 12:10

answered Feb 7 at iii:29

Not the answer you're looking for? Scan other questions tagged visual-studio-code or inquire your own question.