The terminal here refers to the terminal that starts up with shift + control + @ in vscode. Also, cwd in that terminal is the directory directly above the file being edited in the editor area.
Note): This article is just for improving debugging efficiency. Since this is my first time writing an article, I would like you to comment on points that should be improved in terms of writing and opinions that I should have created such a shortcut.
I will write only about 2. Just add the code below.
keybindings.json
{
"key": "cmd+r",
"command": "python.execInTerminal",
"when": "editorTextFocus"
},
Please change the "key" to your liking! It is recommended to set the when expression as well. (Because another command was set by default and I was likely to negotiate with it.)
With this, the purpose of this time has been achieved. (Smiley) You saved yourself the trouble of moving to the terminal and typing commands! If you want to debug partially, there is also a command like "Select a part and execute", so that is also good. (In my case, I just wanted to create a short test file and execute it, so I will omit it this time.) However, it is not enough that it can be used only for Python ... If possible, even with c or cpp
gcc -o file file.cpp
$: ./file
```I want a shortcut that will do???
# I want to generalize
You can open the shortcut list with a shortcut by pressing cmd + K cmd + S. (Complicated)
If you type run file etc., the following screen will be displayed. Of course, the display result will change depending on the extension you have installed.
<img width="1060" alt="スクリーンショット 2019-12-19 13.28.32.png " src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/517924/4f86c5c4-b4e9-6d6a-00f3-eaf3790481b0.png ">
There
#### **`workbench.action.terminal.There is a clearly generalized command called runActiveFile...`**
So when I run it with this, the following error occurs.
bash: cwd/file.py: Permission denied
#### **`I want to solve this...Maybe it's a problem that the pass doesn't pass or something like that...`**
I couldn't read English and gave up. (Miscellaneous fish) I would like experts to comment on how to set it so that it can be applied to other languages ...
Recommended Posts