Can I update pycharm intellisense for python? - python

I want to know if it's possible to update Pycharm intellisense for python which doesn't care about capital or normal letters?
It's a pain in the neck to try both each time.
Currently I'm using pycharm 3.0 and python 2.7.4
An example of what I want:
For example I have a model named: 'MyModel'
I use to type first two letters and then ctrl+space to choose from the list. so if I type 'my' instead of 'My', the pycharm says: 'No suggestion'

You want to set the Case sensitive completion to None.
In PyCharm 2016.3 this is in Settings > Editor > General > Code Completion.

Related

Exclude or prioritize suggestions in PyCharm code completion?

How do i exclude or decrease priority for certain suggestions? i use
self most inside a method. But i always have to type self fully because PyCharm keeps suggesting select from ..\DLLs\select.pyd. I've never used or imported select in my project.
Similarly, I want return to be top priority instead of re from regular expressions module. (re module is not used in my project). My question may be linked to these question:
Pycharm code completion suggest not imported modules
PyCharm: Why does audioop get prefered?
An acceptable solution might be an option in PyCharm like this or this or this
PyCharm 2021.2.2 on Windows 10 64 bit
You can vote for https://youtrack.jetbrains.com/issue/PY-47962. The fix is in progress.

VSCode Intellisense stopped working properly for python

I noticed any variables I make in python will no longer have proper IntelliSense suggestions. It seems that my VSCode is treating every variable I make as the same type?
Here is how it is right now
Here is how it looks when I'm typing in the variable
Here is how it looks on my Mac
According to the Intellisense page on VSCodes websites the blue box symbol that appears when I'm calling the variable means its a field while the other symbol on my mac means its a Values and Enumerations. How can I make my desktop the same as my mac.
Also when I am typing an existing variable out and I add a "." to use a function on the variable and hit enter it will just copy the variable name again.I only get suggestions for intellisense if I have 2 ".". So stringG..
I guess you changed some setting accidently, the fastest solution here is uninstall/install again!

Autocompletion in PyCharm based on type

I'm using PyCharm for python coding. The autocompletion in PyCharm is not as good as in IntelliJ (Java). Consider the below code
a = [1,2,3,4]
a.
In this case, after I press the dot, PyCharm gives the full set of autocompletion options. Consider the below case
def func_a(a):
a.
Here, to the function func_a I'm passing a list as an argument. But when I press dot after a, PyCharm doesn't give any autocompletion options. I know this is because Python is dynamically typed language and PyCharm has no idea to determine what type a is.
But is there any way to tell PyCharm the type of a, may be in documentation comment or something like that? So, that PyCharm can give valid autocompletion options?
Yes, Python 3.5 introduces type hinting and Pycharm utilizes that.
Use
def func_name(param: type) -> return_type:
Like
def func_a(a: list):
Note that all type hints are completely optional and ignored by the interpreter. However, Pycharm can potentially help you detect type errors if you use it as a habit.
This might not answer your question but this will be helpful for those who just started using pycharm for Django application.
PyCharm does not give (It underlines some built in functions with red) auto-completion option for Django if you have started project with Pure Python. Pure Python option comes when you click on new project option from file menu or when you run pycharm to start new project. Pure Python is the default selected option on new project page. You should choose Django (the 2nd option) to get auto-completion option in PyCharm.
Hope this would be helpful for others.
Can do : (examples using list):
def func_a(a:list):
do_this()
Or manually check:
def func_a(a):
if isinstance(a,list):
do_this
else:
raise TypeError("expected type of 'list' but got type of '%s'"%type(a).__name__)

Python Syntax Highlighting in Xcode

Is there any way to achieve better syntax highlighting in Xcode for Python? Xcode only identifies and colorizes keywords, strings, numbers and comments. It doesn't seem to be able to identify the self variable name that represents instance objects. I've experimented with other color themes but it doesn't change the fact that Xcode cannot identify names for instance objects in Python. Is there any way to achieve better syntax highlighting?
I'm using xcode12;after you have setup python properly in xcode.(refer to this if you are not sure of your setup: https://youtu.be/h8_68OONY-w)
Now to get back 'syntax highlighting' for python code.Click on the 'Editor' tab on the menu bar, click on 'syntax colouring' and choose 'python' from the list and you must be fine.

How to avoid the spell check on string in Pycharm

Where is the option to disable the spell check on the strings for the PyCharm IDE?
I hate the jagged line under my comments and strings.
Go to File -> Settings -> Editor -> Inspections. Expand the list under Spelling in the middle window and uncheck the option Typo.
However, practically most of the jagged line is caused by violations of the PEP 8 coding style. If you would like to disable this option too, in the same window, expand the list under Python and uncheck the option PEP 8 coding style violation.
In the latest version of PyCharm it appears as ProofReading:
You can disable spellchecking for specific code section by commenting # noinspection SpellCheckingInspection above it.
See https://www.jetbrains.com/help/pycharm/spellchecking.html
PyCharm does not check the syntax inside strings and comments. It checks spelling.
You can find the settings of the spell-checker under the Settings... page. There is a Spelling page inside Project Settings. Inside this page, at the bottom of the Dictionaries tab you can enable/disable dictionaries. If you don't want spell checking simply disable all of them.
Note that it is possible to add custom words in the spell checker, or, if you already have a dictionary on your computer, you can add it. This can turn out useful if you want to spell check different languages (for example Italian).
In particular if you are using a Linux system and you have installed the Italian language pack, you probably have the Italian dictionary under: /usr/share/dict/italian.
You can add the /usr/share/dict directory to the directories searched for dictionaries and enable the italian dictionary.
It seems like PyCharm only checks files with the .dic extension. If you want to use /usr/share/dict/italian you should probably either copy it into an other directory renaming it italian.dic or you could create a symbolic link.
In my opinion the best option is to disable typo checks only for code. This way green lines under variable/method/class names and strings disappear, but PyCharm still controls comments to avoid misspellings, so You have both nice compact code and fully understandable docs.
I don't exactly know since which PyCharm version this option is accessible, but for sure in revision 2020.2 if You highlight a Typo in Settings > Editor > Inspections > Proofreading there are three additional options in the right panel - just uncheck Process code.
In the newer version of PyCharm, go to Preferences -> Editor -> Inspections -> Spelling.
You can also add particular typo word to PyCharm dictionary by pressing Alt + Enter this word and select Save [typo word] to dictionary. Sometimes this is best choice for me.
For single line you can use the # noqa at the end of the line and it will suppress spelling inspections (the squiggly green line).
GOOFY_API_USERNAME_THING = "LAksdfallae##lkdaslekserlse#lsese" # noqa
I'm using PyCharm 2021.3.2
I found how to disable typos only in string literals in official documentation by disabling process literals, but it doesn't work for me (maybe it's a bug, that will be fixed in the future).
Settings->Proofreading->Typo

Categories