Stop NetBeans "fixing" imports - netbeans

How do I stop Netbeans (8.2) automatically "fixing" imports, on every keystroke?
For example,
deleting an import statement halfway through typing the statement [presumably because 'import x' isn't used when you are trying to type 'import x.y' ].
Removing all the imports when I type a ", /*. {, or anything that makes the rest of the program syntactically invalid [presumably because it is "not using" the imports.
It is annoying to have to 'fix-imports' on almost every keystroke, but awful when fix-imports gets it wrong (eg. a program that using java.awt.* and java.util.List, but not java.awt.List)

To be honset I don't get your question exactly. What you describe seems not to be the default behaviour of NetBeans.
From your question it seems that you're writing your imports on your own. This is not necessary. When you want to use an non imported class just use the autocompletion (Ctrl+Space) or organize imports (Ctrl+Shift+i).
I've never had any of the issues that you describe. You might have installed some additional plugins.

The particular plugin that seemed to be causing the problem is
https://github.com/rsmz/AutoSaveModified
It saves every 1 second but that causes imports to be fixed every 1 second.

Related

coqIDE is not properly connecting files in project and is not compiling

I'm new to using coq/coqIDE and I'm not computer savvy either so I don't know whats wrong or what to call the issue. I was trying to go through the Software Foundations book, but coqIDE isn't working right. I'm using the latest windows 10, and coqIDE 8.10.2
The first issue is when I go to the tab compile -> compile buffer in Basics.v, coqIDE doesn't create a .vo file or a .glob. None of the other buttons worked either. Running coqIDE as admin didn't make it work either, but I figured out I can get around this by manually dragging Basics.v into the coqc application file.
I had no issues with coq working during the first lesson, but in the next lesson we're meant to import the definitions from Basics.v into Induction.v, when I run what they say
From LF Require Export Basics.
I get the error The file C:\Users\...\Coq Files\Tutorial\lf\Basics.vo contains library Basics and not library LF.Basics even though the _CoqProject file contains "-Q . LF" as it should.
I can get around this error too by just writing "Require Export Basics."
which properly loads, up until I actually try calling a definition from Basics
Running
Require Export Basics.
Example example: evenb 2 = true.
works until I get to evenb, and then gives the error
The reference evenb was not found in the current environment. even though it's in Basics.v
If I get even more anal and try
Add LoadPath "C:\Users\...\Coq Files\Tutorial\lf".
From LF Require Export Basics.
I get the error
Cannot find a physical path bound to logical path matching suffix <> and prefix LF.
And then finally if I try
Add LoadPath "C:\Users\...\Coq Files\Tutorial\lf".
Require Export Basics.
Example example: evenb 2 = true.
Loads properly.
So I'm wondering how should I fix the load path so that the project works without putting that junk in every file and how do I make the compile tab work.
There were some people talking about "hitting make in the top-level" but I have no idea what that means. I tried it anyway and ran the Makefile as a .bat even though I already downloaded it properly so there shouldn't be any need, but the Makefile didn't change anything anyway.
I don't think I'm forgetting anything, thanks in advance.
Instead of choosing Compile > Compile buffer, try Compile > Make instead (when browsing any one of the vernacular files in Logical Foundations) - I think that is what others meant by "hitting make in the top-level". But first, you may want to remove the workarounds you added in e.g. Induction.v, and save a trivial change in Basics.v such as adding/removing a newline somewhere in order to convince make to recompile it.

Slow debugging using PyDev in Eclipse

I would appreciate it very much if you helped me with the following most annoying problem:
I'm using PyDev in Eclipse on my Ubuntu 14.04 machine, and every time I run my code in debug mode, it takes around 3-4 minutes to start.
My research yielded, that it takes a very long time to run each "import" statement row (without import statements, the problem vanishes).
Can anyone tell how can I overcome this problem?
Thanks!
I'm attaching:
1) my import statements.
2) my file tree (the file I'm running is in the folder "Gil").
3) and the debug window (during these 3-4 minutes, eclipse adds more and more lines there, that just say "light.py" (this is the file I'm running))
I'm only guessing here, but from your output in PyDev it seems you're executing something with multiprocessing or another thing which creates python subprocesses (which is why I think you're having a new light.py entry every time in the debugger).
Without looking at your code it's a bit hard guessing on what's actually happening, but I can give you some suggestions here:
Make your imports lazier (if you're always executing a new process which has to re-execute all the imports, that can indeed lead to quite more time -- imports in Python are usually slow, even more so with a debugger in place... maybe do a profile in regular mode to actually know what's going on -- if it's open source or you can afford the price, http://www.pyvmmonitor.com/ can probably help you quite a bit here -- if you haven't profiled your code before, you probably have low-hanging fruits which can give you a nice speedup).
Use only programatic breakpoints with the remote debugger (see: http://pydev.org/manual_adv_remote_debugger.html) -- this will make your code run at regular speed until it hits the programmatic breakpoint.
If none of those help, please add more details on your code (are you using stackless, greenlets, threads, multiple processes, etc? -- also 3-4 minutes may be much or not. Without having the original time to get there, it's hard to know...).

How do you organize imports in Eclipse with Pydev?

I'm looking for ways to sort and to remove unused imports. Cmd+Shift+O just adds used modules.
(Apologies if this is a duplicate, I really can't find anything non-Java.)
Another two steps method is :
Cmd+Shift+O to sort the existing imports (and may be pull some new ones)
Run Pylint or PyFlakes to spot unused imports
This way you will avoid the trap of PyDev not finding imports.
I don't know a simple way to do this. My approach is two step:
Delete all imports (or comment them out)
Cmd+Shift+O to build a new set of imports
But PyDev can't always figure out which modules you need (especially when you use aliases), so this isn't foolproof. Always make sure you can revert your changes.

Is there a quick way to show the code of a method declared in the Scala Console?

I frequently use the Scala console to evaluate and test code before I actually write it down in my project. If I want to know the contents of a variable, I can just enter it and scala evaluates it. But is there also a way to show the code of methods I entered?
I know there's the UP-key to show single lines, but what I was searching for is to show the whole code at once.
There's a file in your home directory named .scala_history that contains all of your recent REPL history. I regularly copy and paste code from this file into project source files. It's not exactly the same as showing the code for individual methods in the REPL, but it might help you accomplish the same goals.
See the comments by Paul Phillips in this issue for a discussion of some related functionality in the REPL (grouping statements in the history):
At some point I implemented the logic for this, but the real obstacle
is jline. It has enough trouble figuring out where the cursor is under
the simplest conditions. Start throwing big multiline blocks into the
history and it breaks down in tears. Would love to see this and
SI-2547 addressed by the community.
...
I expect to fix this soon too, but it depends on how well the recent
jline work goes. I implemented it long ago, and display issues are the
impediment.
Both of these comments are over two years old, so I wouldn't hold your breath.
I dont know a command to load all the code from command line.
What you can do is to :load path/to/my/file.scala to load some complex code and re- :load it when you changed the code in the file.

How to configure line wrapping for imports in eclipse

The eclipse and checkstyle guys of you will surely now this problem: After organizing imports in eclipse with CTRL-SHIFT-o, each import will be on a separate line, without line-wraps.
If you configured checkstyle to warn if you have lines greater than 80 characters, it will probably warn about your imports. Normally I insert newlines at appropriate positions in
the statement and everything is okay. But the next time someone uses the organize imports function of eclipse every import is on one line again.
The auto-linewrap of the eclipse formatter does not work with imports.
So I wonder if there is another way of telling eclipse to linewrap huge import statements?
Or is there a plugin to do this?
Why not defining an exception for the LineLength Checkstyle rule (with the ignorePattern property) ?
That way, any line beginning with import would not raise that warning.
If that is not possible, you will need to define a custom code formatter (see this SO answer)