I have a working version of JEDI with Emacs 24.3 on osx. The autocomplete feature is wonderful, except for when I want to comment things out! I frequently comment/uncomment portions of my code and was hoping there was a way to prevent JEDI's auto completion from coming up when I type #. Any advice or thoughts would be greatly appreciated!
edit: When I go to comment multiple lines I enter in # typically followed by DownArrow and LeftArrow, but what usually happens with JEDI enabled is this dialog pops up preventing me from moving to the following line until I make a selection:
You can try to use company-jedi for your python completion. This package doesn't have this problem.
One way to get around this issue would be to select the lines (region) you would like to comment out and hit M-;. This runs the command comment-dwim which comments out the selected region (or uncomments it, if it is currently commented out).
When used in conjunction with e.g. mark-lines which allows you to select the current line with a single key stroke, this makes for a really fast way of (un)commenting portions of your code, even if they span just one or two lines.
emacs-jedi dev here. If emacs-jedi works as you describe, then that's a bug.
But I cannot say what is wrong from the limited information I have. So, just general directions:
First, always try to reproduce the misbehavior in a clean Emacs setting, described here http://tkf.github.io/emacs-jedi/latest/#quick-try
This helps you to find out if your setting is wrong or if it is actually a bug in emacs-jedi.
Give the output of M-x jedi:show-version-info. http://tkf.github.io/emacs-jedi/latest/#jedi:show-version-info
This helps people diagnosing the problem.
This is a guess from your screenshot but it seems that you have old version of popup.el. So maybe auto-complete.el could be old one if you install them at the same time. If you don't see the problem in the clean Emacs (step 1. I mentioned above) which installs newest libraries, then updating them could solve the problem.
Update
So, I found a way to reproduce the behavior which is close to what you mentioned: https://github.com/tkf/emacs-jedi/issues/147
But as I wrote in the issue, I think it is a rare case. If you find a case which could happen very frequently, then let me know.
Related
I've been searching everywhere for an answer to this but to no avail. I want to be able to run my code and have the variables stored in memory so that I can perhaps set a "checkpoint" which I can run from in the future. The reason is that I have a fairly expensive function that takes some time to compute (as well as user input) and it would be nice if I didn't have to wait for it to finish every time I run after I change something downstream.
I'm sure a feature like this exists in PyCharm but I have no idea what it's called and the documentation isn't very clear to me at my level of experience. It would save me a lot of time if someone could point me in the right direction.
Turns out this is (more or less) possible by using the PyCharm console. I guess I should have realized this earlier because it seems so simple now (though I've never used a console in my life so I guess I should learn).
Anyway, the console lets you run blocks of your code presuming the required variables, functions, libraries, etc... have been specified beforehand. You can actually highlight a block of your code in the PyCharm editor, right click and select "Run in console" to execute it.
This feature is not implement in Pycharm (see pycharm forum) but seems implemented in Spyder.
I can't find a way to change the next command at runtime when debugging in PyCharm (see: http://pymotw.com/2/pdb/#jump-back),
This has been around in VS/PyTools for ages ("Set next statement"). Some people on JetBrains' forum said it was not possible but I'm not sure if they can be trusted... (https://youtrack.jetbrains.com/issue/PY-9537)
Do anyone has more information on the topic?
You currently can't. Here is the feature request, please upvote it - https://youtrack.jetbrains.com/issue/PY-14306
As far as "undoing" by going back lines to match a previous state, yes that is much harder. Just re-running the previous line shouldn't be too hard (understanding that it's not going to undelete or undo state changes)
I am new to python programming... Just wanted to know does IDLE has a concept of 'executing selected statements'??
F5 runs the whole program... Is there any way to do this?
No, not now. Since you are at least the second person to ask this, I added the idea to my personal list of possible enhancements. However, while running a selection would not be a problem, producing accurate tracebacks for exception would be. Doing so is an essential part of Python's operation.
Currently, one can disable code that you need to not run by commenting it out (Alt-F3) or by making it a string. One can stop execution after a particular statement by adding 1/0. Or you can copy code to a new editor window.
Do you have a specific use case in mind, or are you just wondering?
Install Spyder, with its dependecies, and you will have wonderful FREE IDE !
You will have another solution, is to use IPython Notebook, where you will be able to use your Internet Browser to run python codes!:
One of the most frustrating things about programming in Python thus far has been the lack of some kind of "pre-analysis". In Java, for example, a pre-analysis is performed before the actual compilation of a program, in which things like name usage is checked. In other words, if I have called a variable list_one in one area, and say I mispell it as list_on in another area, Java will say "Hey you cant do that, I dont know what list_on is."
Python does not seem to do this, and it is terribly frustrating! I have a program that takes about 15 minutes to run, and the last thing I was to see at 14.5 minutes into it is something like
NameError: name 'list_on' is not defined
Are their any tools available out there can can perform this kind of check before the interpreter actually runs the program? If not, what are some ways to work around this issue?
Have you considered checking your code with something like pyflakes or pylint?
UPDATE
I found a fantastic solution to this problem for those that happen to be emacs users. You can install PyFlakes-Flymake. This is a great tool! It will perform a static analysis of your code on the fly, and highlight trouble areas in red. I suggest using PIP instead of the suggested easy_install. Other than that, it is pretty simple to get it up and running. And well worth the effort!
I've gotten omnicompletion with Pysmell to work before, but I can't seem to do it again.
I tried following some steps online, but most, if not all, of them are to vague and assume too much that you know what you are doing to some extent.
Can someone post a full, step-by-step tutorial on how to get code completion working properly, for complete Vim newbies (for dummies?)?
There's also Ctrl+n in insert mode which will autocomplete based on the words it has seen in any of the open buffers (even in other tabs).
You may try Pydiction (Excerpt below)
Description Pydiction allows you to
Tab-complete Python code in Vim,
including: standard, custom and
third-party modules and packages. Plus
keywords, built-ins, and string
literals.
Pyflakes has a vim plugin that does this pretty awesomely. Unlike Pydiction, you don't need to build a dictionary beforehand (so if you're bouncing between different virtualenvs it's a bit less hassle.) I haven't been using it long but it seems very slick.
Try hitting Ctrl-p while typing mid-word. Ctrl-p inserts the most recent word that starts with the prefix you're typing and Ctrl-n inserts the next match. If you have several possibilities, you can hit ctrl-p more than once to substitute each candidate in order.