prettier seems to not working in VScode (python) - python

I don't actually know how these thins work, apparently prettier explains how to make it the main formatter on their page:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
but i dont even know how to set this things.
anyways, my question is, after i complete my writing, when i type ctrl + s (save) on my vscode, it used to make it, well, prettier. but now it doesnt change anything (and it is not pretty at all).
now, at the bottom right of the screen, i see this:
what i see on my bottom right corner for prettier
and if i click that, ahem, empty set (?) image next to prettier, it becomes a double tick, but it exist my coding area and enter the output section:
after i click on the thing
and if i click back to my coding area, it again becomes an, well, empty set (?) symbol.
all the help is appraciated.
ps: this is my first question, please go easy on my
sincerly

It's probably missing something in your settings. VSCode allows you to edit your settings through GUI or text (using JSON syntax).
Go to your settings using the GUI and type: "Format", then make sure you have enabled the option "Editor: Format On Save".
Depending your formatter settings, when you save a file it should work as you expected.

Related

message that pops up while writing python code on vscode

I am not sure what it is actually called. I am a beginner. I am learning python and using VS Code as my code editor. But when I write codes the message in the red circle highlighted in the screenshot pops up. It's kind of annoying.
Can someone please help me with it? I don't know what it is called and would like to turn it off.
That pop up just shows the structure of the function you are using. It includes parameter hints.
In the image it is showing the structure of print function. It's a useful feature to be honest.
Press esc to cancel out of an individual popup, or set"editor.parameterHints.enabled": false to disable it entirely.
So, that box you have there is the documentation of the method you are calling. In this case, print(). It's actually quite useful. It'll give you a quick description of the parameters that you can pass into the function. For more confusing functions, the auto-documentation is a must have. But, of course, it is up to you.
You can disable it by setting "editor.parameterHints.enabled" to false in your .json
This is a function provided by VS Code to display information such as method parameters. You can turn it off in settings.
Click the gear icon in the lower left corner and select Settings,
then search for parameterhints, and uncheck the options in the picture.
In addition, as mentioned above, you can also add the following configuration to the settings.json file to achieve the same effect.
"editor.parameterHints.enabled": false

Is there a way to turn off suggestion popup when opening string in VS Code Jupyter Notebook

I am trying to disable a VS Code pop-up whenever I hit a quotes key (either ' or ", either open or closing). A screenshot is attached of the pop-up. I've been googling my heart out for this but can't seem to find what is driving this behaviour.
Things I've tried:
Set "editor.parameterHints.enabled":false to prevent annoying popups when I enter a function.
Set "editor.quickSuggestions": {"other": false, "comments": false, "strings": false}
Set "editor.snippetSuggestions": "none" just in case that was doing anything
The same behaviour is not replicated in a new workbook before running any cells, nor in a blank .py file. Files in the same directory are listed, which makes me think that at least part of the popup is coming from the file list. But the others really don't seem meaningful to me.
It ends up costing me a fairly large amount of keystrokes hitting esc every time, or going back to correct errors when I hit tab or enter before escaping. And is also just generally annoying. Any help would be appreciated.
Example image of pop-up:
EDIT:
The list of extensions I am currently working with excluding themes.
I have turned of all except those necessary for Jupyter Notebooks and still get the same behaviour:
adam-watters.vscode-color-pick
AndersEAndersen.html-class-suggestions
christian-kohler.path-intellisense
formulahendry.auto-close-tag
formulahendry.auto-rename-tag
hediet.vscode-drawio kiteco.kite
ms-python.python
ms-python.vscode-pylance
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-vscode-remote.remote-wsl
njpwerner.autodocstring
ritwickdey.LiveServer
Shan.code-settings-sync
streetsidesoftware.code-spell-checker
WakaTime.vscode-wakatime
wmaurer.change-case
I had the same issue. This solved it for me: In VSCode settings, go to 'Extensions > Jupyter > Python Completion Trigger Characters'
Defaults were: .%'"
So I deleted the single and double quotes, restarted, and voila, no more annoying popups.

Scroll python function help in Vim

I am learning to use vim as an IDE for Python and followed this tutorial to setup my .vimrc file. My setup is working fine.
Here, vim shows me the help for np.random.randint, but I could not figure out how to scroll through the displayed help and read about the other parameters. This feature is introduced by YouCompleMe (as far as I understand), so possible solution might be to change some configuration for it.
Since, I am new to this, I am not even sure what this feature is called (auto complete does not seem to be the right name for displaying help) and therefore was not able to find help on web-searching.
Any help will be appreciated, thanks.
YouCompleteMe uses the Jedi library for Python. If you want to install Jedi alongside YCM, this answer has some advice on how to do so.
In any case, the extra docstring information is opened in a preview window, so you should be able to switch to it in normal mode (ctrl-w w) and scroll like a regular Vim window.
If the buffer disappears when you exit insert mode, here's some sample solutions:
If you're okay with enabling mouse controls, add set mouse=a to your VIMRC, and then you can click between the buffers while typing and even scroll using your mouse wheel or trackpad.
Remove let g:ycm_autoclose_preview_window_after_completion=1 from your VIMRC, since that will remove the preview window when you enter normal mode. Then, switch to the window normally.
Change the default preview height. Just be aware that this might be annoying if you have limited screen space.

PyCharm Code Folding Collapse

In PyCharm, I have it selected in my settings so that when I collapse the code within a method or I collapse my import statements, I get the box on the left hand size by the line numbers with the "+" inside it to expand when I want to investigate.
Is there any way to adjust the color settings in PyCharm regarding that expansion box with the "+" so that is stands out better? On my Mac it stands out just fine and I can always find them, but on my Windows machine (using a very similar if not the same Darcula color settings .jar) the boxes blend in too perfectly with the background of the script and I have trouble finding them. I am not sure if it is that the box is not outlined properly, or if the colors prevent me from seeing the outline at all.
Thanks!
I personally prefer to use the keyboard shortcuts for (un-)folding. They are very helpful and maybe you can have a look. I also sometimes click "in the code" to fold or unfold code.
If that does not solve your problem, intelliJ comes with 3 different default UI themes (Darcula, GTK+, IntelliJ on linux) that you can change in Settings > Appearance > Theme. Maybe you can switch to another theme.
If they're not what you need, you can also download custom theme plugins such as: https://plugins.jetbrains.com/plugin/8006?pr= . Perhaps "material black" which is close to "darkula" can render your buttons a bit more clearly.
Or, you can also define custom themes to change only the plus button (as it's an "appearance" setting, not syntax highlighting, you can't easily change the color or the shape of that specific button). It's more hard than the two previous solutions (as it involves creating a custom plugin), but you can pick one from github and just change the icon you need. https://github.com/ChrisRM/material-theme-jetbrains/tree/master/resources/icons could be a good starting point

Python IDLE. Auto-complete/Show completions not working

IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session.
I've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..
Is there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7.
Is there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!
REQUESTED CLARIFICATION:
OK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting "edit with IDLE". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated.
What my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.
The only thing i found so far is that if an editing session of IDLE is connected with python shell (called "interactive mode" in the question, i.e. after an attempt to run the edited script) then "non-interactive" IDLE can autocomplete based on values in interactive window. For example, if I type
a = [];
a.appen
and then hit < Tab > it will do nothing, but if I previously type
a = []
in corresponding python shell, IDLE will autocomplete correctly.
So my only suggestion is import same modules with same names in python shell window in order to make them "visible" for non-interactive IDLE editor.
I had the same problem with IDLE, because I want to learn Qt and therefore autocompletion is very useful.
As it says in the settings of IDLE, you can trigger the autocomplete with "Control + Space", e.g. after a "QtGui.". Then a menu opens where you can arrow-scroll through the entries.
using the 'IDLE Editor window', you need to save and execute your code first.
The application running, turn back to the Editor window to use the auto-completion.
In my case, I had to open Options menu -> Extensions tab on the editor and look to make sure AutoComplete and other relevant options were enabled. They actually were, but by just clicking on 'Apply' even though I dint have to change anything did the trick for me.
Sometimes it has to do with the time you have to wait to get a suggestions.
When you go to options > extensions > general at completions popup wait you can change it to about 500ms.
In my case it was 2000ms by default.

Categories

Resources