vscode docstrings not appearing properly - python

I have no idea why I am experiencing this issue. In past projects (On a different computer with a different OS) I have had no issues displaying docstrings. When I write a docstring, it should show something like this.
Instead, my docstrings are not being formatted properly, and I am getting the following.
Any idea why this is happening and how to fix it? I am using VScode, and don't think anything needs to be installed to solve this. Thanks!

If you changed your language server that will shift how the docstrings get rendered (e.g. went from Jedi to MPLS or vice-versa). You can 👍 the issue tracking improving docstring support to help prioritize that work to try and handle this sort of thing.

Related

My VSCode word wrapper width is too small. Word wrapping too soon

For some reason my word wrapping has gotten messed up in VSCode. The word wrap occurs after saving. I do like this feature but I need it to stop wrapping so soon. There is plenty of space left on the right side still. I have prettier installed and it is set to the default 80 line width. I have changed this and restarted VSCode and the problem remains the same. I have even disabled prettier and it is still doing this. I have also gone into the word wrapper for VSCode and ensured it was off. Can anyone tell me what is causing this and how to resolve it?
This...
should look more like this..
And in VSCode I have changed these things with no luck...
Also, I think this problem only exists in this current project. Maybe I installed a python extension causing this??
Maybe these...
This is a function of formatting. You can turn it off in settings.
Tips:
Pylance is the integration of Python and Jupyter Notebook extensions, both of which are official extensions of Microsoft. There is no problem keeping them. :)
The image below is located in the settings. This resolves my issue.
Also found here...
VS Code Python Formatting: Change max line-length with autopep8 / yapf / black

Python note book autocomplete not working in VSCode with environment being CVE

I have done some research, but none of the solutions work for me and it seems that my situation is much worse than everybody else. Currently, my VSCode editor is just acting like a plain text editor for any ipynb files. For example, this is how my import block looks like:
Nothing has been highlighted, and I'm working with this for quite a long time and now I can't bear with this anymore. If this is not bad enough, then take a look at the following:
Literally, nothing happens. I think now the only help I get from VSCode is plain text auto-completion, but that is far from what anyone should have.
The configuration is pretty simple. I have the following kernels I can choose from:
And I'm mainly using anaconda3 for my kernel. Further, I only have
in my setting.json for python configuration.
As for extension, I have the standard python extension with python extension pack installed, which are the only two extensions I installed for python.
I'm really tired of working with plain text python code, if any information is needed, I can provide as much as I can.
-- Edit
It seems that the default language is not python, but CVE. Futhermore, I can't find the proper language to choose. All the language options are listed below.
The error happened because of the extension Dependency Analytics. Please uninstall it and reload window.
Reference: jupyter conflict with Dependency Analytics.
Click here and select Python.
CVE seems to be the default language for notebooks for some reason. Please check the settings.

How to prevent the repetition of object name for Python using autocompletion in VSCode?

I am using VSCode for writing Python code in a Jupyter Notebook. The relevant extensions installed are Python, Pylance and Jupyter. The problem occurs when I try to use tab to autocomplete method names for any object. For example, if the suggestion box looks like this:
and I press Tab to accept the suggestion, the object name database is repeated i.e the code looks like dataset.dataset.as_numpy_iterator instead of dataset.as_numpy_iterator. How can I remove this object name duplication? Thanks!
After wasting a lot of time searching for a fix, I tried using the latest Insider's build (instead of the stable build) of VSCode and surprise surprise - it did not have this issue. Moreover, even in the stable build, it occurs only in Jupyter Notebooks and not in standalone .py files. I am posting this as an answer so that other people don't have to waste more time on this!
It looks like provided by some extension you have installed. Such as Tabnine AI, Kite and so on. But I can't reproduce it on both of them.
I can't get to know which extension provides it in your picture, it looks like was cut off in your picture. But it does not provide by the Python extension.
I bumped into the same issue. Simply disabling and re-enabling the Jupyter Keymap extension solved my problem.
Judging from the lack of related search results, this issue seems to occur only under some rare circumstance...

What should I do to Pycharm code suggestion?

enter image description here
I'm a newbie in Python. I use Pychram to code. When I type 'pri' in Win 10, Pycharm suggests 'print'. But in Ubuntu 20, Pycharm doesn't do like that. I already set in Code Completion but it does not work.What can I do?
My English is bad, sorry for that.
#Gareth_Latty says the following in another similar post.
"
As Python is a dynamically typed language, you need to ensure it can work out what type things are, and inspect on the libraries on your system correctly. Try to make sure it's obvious what type the object is in your code.
One good way as of PyCharm 2.7 (back when versions were numbers) is to enable runtime type detection - PyCharm hooks into your program while it runs (while debugging), and checks the types of variables as they are used.
You can enable this by going to settings, going to the "Build, Execution, Deployment" section and then the "Python Debugger" subsection and enabling "Collect run-time types information for code insight"."
Please make sure to research and look at other posts. Thank You!
Make sure you check out this website and This one

Python and vim on windows?

I started learning vim a couple of days ago and surprisingly it felt quite natural to me, I also want to get back to learning python. I thought, why not combine the two?
So now I'm looking how to set up a proper python development environment, all my searches turned up either guides for other OSes (which I just couldn't "translate" to windows without feeling like I missed something) and some feel like they are made for previous versions of vim (they assume it has no python support at all...)
So how do you set up vim for python development? I see it already has syntax highlighting, how do I set up compiling? how do I set up debugging (if it's even needed, I read somewhere that it's not really that needed in python)? how do I setup error highlighting? or anything else I might need? I saw some guides setting up a "go to source" link, is that needed in the new version?
Good choice on VIM!
Have a look here though:
http://dancingpenguinsoflight.com/2009/02/python-and-vim-make-your-own-ide/

Categories