When I use browser to open Jupyter notebooks, I can use Shift + Tab shortcut to get a python function doc string; however, in VSCode, that shortcut does not work. Does anyone know which shortcut gives me the docstring there?
I found this but cannot understand the suggested solution (what is Ctrl + K Ctrl + I ?)
shows the keyboard shortcuts that have been set up and help below it will show you how to change what you want to change
When using VSCode in Windows, the default shortcut key for displaying the python function docstring is "ctrl+k ctrl+i". When using it, please place the mouse on the area of the python module or method that needs to be viewed (front or middle or back All works):
In addition, please check whether other shortcut keys of "editor.action.showHover" have been set in "keybindings.json".
Reference: Keybindings in VSCode.
Related
I have a problem with python autocomplete in visual studio code. The only way I can trigger the autocomplete function is with the Tab or Enter key. Brackets and dot does not have any effect (or better it just hides the suggestion box and puts the bracket in place on the unfinished word e.g. -> typing pr in the editor would display the suggestion box with print as the first choice, if i then press bracket i end up with pr() instead of print())
I presume there should be some settings so autocomplete would act "normally" but I can't find it.
This is set by the shortcut key. Open the Default Keyboard Shortcuts (File > Preferences > Keyboard Shortcuts) and search for "acceptSelectedSuggestion". You will see that there are only two settings by default, the Tab and Enter keys.
If you want to add other buttons to trigger typing intellisense, right-click on one of the settings and select Add Keybinding,
then press the button you want to set, and press Enter to save.
I think you don't need to use the python autocomplete extension. You can just use the Python extension.
Tab or enter is required to actually make a selection. Otherwise, you could have custom function printStuff, and typing pr( would not necessarily pick the right one.
From what I can tell, PyCharm works the exact same way, so unclear what "acts normal" means in this context.
In Corey Schafer's Programming Terms: Mutable vs Immutable, at 3:06, he selected multiple lines and commented them out in PyCharm all in one action.
What is this action? Is it a built-in shortcut in PyCharm that I can use or configure myself?
This is a setting you can change and define in "Settings".
The default is with Ctrl+/ for Windows, or Cmd+/ for Mac.
Years later: on AZERTY keyboard, '/' from syntax area (;.:/!ยง,?), AKA "slash" does not work!
You have to use the '/' symbol from numbers area (division symbol).
Is depends on you're text editor , but probably all text editor use (ctrl + /) just highlight all the code you need to comments and use the shortcut , to know what shortcut using in you're favorite text editor search in google : YourTextEditor shortcuts
If you use macbook build-in keyboard, this shortcut does not work. So you can assign new shortcut for this purpose by following steps;
1.Go keymap menu
PyCharm -> Preferences -> Keymap
2.Find "comment with line comment" then click pencil sign "add keyboard shortcut" then assign your custom shortcut (press your favorite keyboard combination)
This heavily depends on where you're writing your python code. If you're writing it in Notepad, there won't be a shortcut for commenting a line.
However, if you use an IDE, you will probably have such capability alongside the ability to change the shortcut.
Just search Google for keyboard shortcuts for your preferred IDE.
One of the disadvantages of Jupyter / iPython over Pycharm or Spyder is that I cannot see the documentation of the present code fragment / class / command by default (i.e.: that the referring docstring / signature is not shown automatically).
Is there any plugin / workaround possible to achieve this in a Jupyter notebook as well?
Execute a method with ? and the bottom pane will show up.
Inside the parenthesis of a method use shift + tab to bring up documentation pop-up.
In R 3 * 2 typed on the editor can be executed in the console as [1] 6 by having the cursor on the line where the code is typed; clicking on Run if using RStudio, or through Ctrl + Enter. Very convenient.
New to Python, I am coming to realize the if I want to see 6, I may need to type print(3 * 2), unless I type the expression directly on the Python console. Or, is there a shortcut?
Incidentally, I am using Pycharm as IDE.
In the Pycharm charm editor go to
Settings > Keymap > Other
And change the kep map for "Execute selection in console". Double click it and select "Add keyboard shortcut"
I think the default is set the Alt+Shift+E. I was also from an R background before Pycharm and was used to the shortcut of Ctrl+R to run selected code. I think Ctrl+R might be something in Pycharm because I decided a long while back to map mine to Alt+R.
Once this is done, you can highlight a section and use your new shortcut to run it in a console. You can also just have a cursor on the line and using the shortcut will run the line and move to the next.
You need IPython. In particular, this ability to select a section of a saved file and re-execute it with a click or keypress is the hallmark of the Jupyter interface (previously known as "IPython Notebook").
hi everyone :)
my problem is, up until now, i have exclusively used tabs to indent python, as i find it easier than spaces, but for no reason i know, python interactive prompt, the basic python.exe one, suddenly refuses to accept the tab button, all it does is flash the cursor. all i can think of is that my computer in suddenly treading the window like any other, using tab to cycle input things, in this case the single one. also, before now, i could use the up button to reach previously typed code, the if i submit that line with no changes, use the down button to access the line that came after it, but now up works, but as if i had changed the line, eg moves me back to the "bottom" of the list of inputs, so down doesn't work.... my question simply is: how do i get my good old tab and down button to work like i want them to again? :(
thanks xxx
If you are using Windows with the standard cmd.exe console (and it would have been helpful for you to have stated this up front) then you can use the TAB and arrow keys exactly as you desire.
I recently observed this behavior too, on Windows, using cmd.exe. It also happens with Console2 - an alternate shell I sometimes use.
Though I do always use spaces in normal code in an editor, I had been accustomed to using the Tab key to indent in short multi-line inputs in the interactive python.exe interpreter. Recently that stopped working - pressing the Tab key flashes the cursor and doesn't indent. Using spaces does work fine here, though it's not as convenient past a couple of indentations.
I suspect (but am not certain) that the cause was installation of pyreadline or rlcompleter - I had been messing with trying to get tab completion in an interpreter in an embedded application on Windows. Of course in your case another installation could have included those packages.