Not sure if this is the right place to ask this question but I hope it is.
I have been using PyCharm for Python development in the last month and a half and there's an issue that irks me a lot since I've moved from Visual Studio (I had to). I am trying to find stuff in the code and PyCharm for some reason just doesn't give me the same replies I get searching the code on GitHub or Visual Studio.
Now I tried the OS X version of PyCharm and the Red Hat compliant version of it. I tried Ctrl + F, double Tab, and probably everything under the menus and just can't get the results I get elsewhere.
Am I missing something, should I configure additional stuff?
I needed to use Ctrl Shift F instead of double Tab
Please look at the structure in project view. You can get your function and variable names there.
Related
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
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...
I have been running Visual Studio code on the Mac for about 2 years now and I'm running into issues that I haven't seen before. I have not personally run any updates for Code for quite a while. lets say late November.
1) A message at the lower right of my Work space that says
The macOS system install of Python is not recommended,
some functionality in the extension will be limited.
Install another version of Python for the best
experience.
Unfortunately I can't update to Python 3.x and it shouldn't be up to Code to force me to update. Is there a way to turn this message off?
2) Related to above is that some classes or language keywords (JSONUtils, #unittest, requests, def) are no longer being recognized. Some constants that I have created and a variable defined to store a class.
sc = SomeClass()
This will be recognized at definition but later during usage it will not be recognized.
sc.SomeMethod( 1, 2, 3 )
sc won't be recognized. None of this is making sense to me as it is not a pure pattern. Everything is probably the same issue. Need to point Code to python 2.7.
This is a bug in VS Code. A new future version will have an ignore button.
VS Code Issue 4448
I still can't comment, so here it is an an answer instead...
This looks like a duplicate of How can I change python version in Visual Studio Code?
The short version that worked for me:
CTRL+SHIFT+P to open command palette
Choose "Python: Select Interpreter"
Point VS Code to the Python interpreter you wish to use.
I am trying to switch from Pycharm to Visual Studio 2013 (PTVS), however I cannot find how to change settings for auto-completion popups. For example, in Pycharm whenever you start writing something, it automatically gives you a list of possible keywords, like in screenshots below.
If I start to write 'co' pycharm lets me choose 'consecutive' which is an already defined boolean. Is there any way to change these settings in visual studio? I have went through the settings menu like 20 times now, and I am completely stuck.
screenshot of pycharm:
http://i61.tinypic.com/20960wn.png
screenshot of visual studio 2013:
http://i62.tinypic.com/2qtilg1.png
I found the answer by myself - PTVS doesn't support this feature, however there is a plugin, which can be downloaded here, which supposedly fixes this issue:
http://visualstudiogallery.msdn.microsoft.com/644b4359-5eeb-4ba5-9374-78a8507761f0
However, after further inspection, it is broken and doesnt work half as good as pycharm's autocomplete. Most of the time it popups a message saying 'no suggestions' which becomes seriously annoying getting that msg after every single letter.
Bottomline - it is broken.
This is now supported with PTVS. Per the completions section found on the GitHub wiki.
Completions can be shown at any time by pressing Ctrl+J or Ctrl+Space, or may be triggered automatically by certain commands (such as import), operators (such as a period/full stop), or by typing at any place where completions are likely to be helpful.
I use Notepad++ for writing and running Python scripts. It is a great text editor, except for debugging. Is there a way to step through the code, use break points, view variable values etc. in Notepad++ like you can in Visual Studio?
Does such a plug-in exist? Not that I know of. I agree completely with qor72 on that note.
Is it possible to create such a plugin / functionality? Possibly.
After doing some quick digging, I did find a plugin that looks promising, Python Script. In short it allows you to run python scripts that can access the NPP modules (file menus etc...) as well as the Scintilla Methods which appear to give access to things like the markers on the pages.
To accomplish such a feat I could see the task being broken into a few large blocks (I feel a new open-source project coming on...)
Using Python Script, integrate the python debugger(PDB) as mentioned by Shashi.
Using the Scintilla Methods, add trace back calls where a NPP marker is placed
Redirect PDB outputs and process them to show where the file is stopped (again using the Scintilla methods).
While at the newly created breakpoint and using PDB determine all of the variables in the current namespace. Take this info and dump it to a CMD window, or if you want to get fancy some GUI created with Tk / wxPython
Closing Thoughts
While I think it's possible to create such a plug in, it would be quite an undertaking. Along that line, you might be better off trying to find a different editor that has this built into it already and just create macros (or whatever the IDE calls them) to add in the things you like most about NPP.
Please note that I am a daily user of NPP and have been for many years so I definitely understand why you'd like to have the functionally added to NPP. One of my favorite things about NPP is the speed in which it opens and searches files... moving to a bloated IDE, IMO, would not be worth it to me.
My current work flow is to do all of my editing in NPP and just double click to run the modules. If it fails or goes off in the weeds, I launch IDLE to debug it.
I really hope someone tells me I'm wrong (I'd love to have that feature in Notepad++) but, Notepad++ is designed as a programmers editor, not an IDE. While it has a lot of cool functionality, that level of debugging isn't part of the core tool.
Not seeing anything in the npp-plugins either.
I think python debugger
is the best option if editor is not providing facility :)
Quick guide:
from pdb import set_trace as bp
code
code
bp()
code
code
At the (Pdb) prompt, enter s to step, p foo to print foo, and c to continue executing the code until hitting another breakpoint.
Have you thought of using Komodo.
It's open source and has ports for Windows, Linux and MAC (I think).
This may be an alternative, and if you want some advice from notepad++ users, have a look at the following post on this very site:
Komodo Edit and Notepad++ ::: Pros & Cons ::: Python dev
Some npp users here seemed to have made the switch for python editing running etc...
personally don't know much about debugging on Komodo but as it's an IDE so would be surprised if you couldn't do it easily
I don't really see why Shashi's answer hasn't been upvoted. For the link that he has given supplies a way to step through python scripts as the OP has requested.
So for all who don't know about the pdb module, upon importing it the pdb.set_trace() function allows one to step through the area of code after it. And it is very much similar to the visual studios method of debugging. While you're stepping through the code you are able to input a variety of commands.
One of them is p <expression> and that allows the user to print the current state of variables within the local and global scope.
I know it's 11 years on, and I'm a bit late to the game, and I know it's not Notepad++ but please do consider Visual Studio Code.
It's free, easy to install (both the editor itself plus any python interpreters it uses) and it's widely used and nowhere near as bloated as it's Visual Studio counterpart. It also appears to be the IDE of choice for a lot of Cisco-related course material.
Write your code, click to the left of code pane to insert your breakpoints click the Debugger icon (highlighted), and you're away: