I recently bought a new keyboard and keep making spelling errors, closing the Content Assist midway. Is there any option within Eclipse preferences that let it stay open if at least some of the members have been found and spelled correctly?
For example if it suggests "myMethod()" and I write "myMb", Content Assist closes.
Eclipse does not feature a spelling error correcting content assist. I am also not aware of any plugins that do this.
What comes somewhat close is Eclipse Code Recommenders’ Subwords completion, which allows you to put in substrings of the method name, e.g. myMd would complete to myMethod(). However, when there are characters not part of the method’s name in your search string, the method won’t be found.
Related
This question already has answers here:
Remove unused variable declarations automatically - Android Studio/Inteiij
(2 answers)
Closed 3 years ago.
In IntelliJ, in a .java file, some unused code is greyed out indicating that the declared variable or function is never used. Unused imports are removed using Ctrl+Alt+O. Is there any shortcut to remove those unused declarations?
As #Magnilex pointed out, hover over the unused variable / method and hit alt + enter to open the intentions menu (if that's how its called).
But in addition to this, don't just remove / safe delete this on variable, but choose "Fix all 'Unused declaration' problems in this file" which will not only get rid of this one, but of all.
See here:
An alternative approach might be to us the "Run inspections by name" and run the "Unused declaration" inspection for your whole project / module / Package, whatever.
This can be achieved by either right clicking on the editor, and chosing >Analyze >Run Inspection by Name from the context menu (or the keyboard short cut, which is ctrl+alt+shift+i by default). Then type "Unused declaration":
This will inspect your code for unused declarations and display them in an overview:
See also https://stackoverflow.com/a/56593832/2987273
Check the Code-Cleanup documentation, see if any of those solutions fit your needs. Creating a profile for that task might be a decent idea, as you can trigger it from anywhere, and hit all relevant occurrences.
Just be aware that his approach might "eat up" some new / uncompleted code, or even raise false-positives, e.g. due to a child project which is not in scope. So: handle with care.
There is not shortcut to remove unused code in a file. Just to make that sure: IntelliJ IDEA is only able to check if the code is currently used in your project.
If the declaration is used by another consumer, that is not part of your project, you may break the consumer when removing that piece of code.
Due to that fact, it's not possible to implement a general automatic remove unused declaration.
There may be cases where this is more safe like an unused private method, but there is no save automatic way to do that.
Therefore, there is no shortcut.
What you can do in order to check your code base and decide whether or not to remove code marked as unused is to run a Inspect Code analysis.
Just right click on you file or source code folder, got to Analyze and Inspect Code. Choose the scope, like a folder or a specific file and press Ok.
After that you can scroll through the warnings aso.
I'm trying to set up vim to work nicely with Java. I've set up eclim, which seems to work great for letting me know when something is wrong, but I'd really like to get vim to do two things to make my code easier to read.
Have brackets and braces show up with a different colour from the main font.
Get classes to highlight as a different colour.
I haven't come up with anything good for the first point, but it seems like the second should be doable with ctags. I found a plugin called TagHilight that should do this but I can't seem to get it to work.
I also found a file called javaid.vim that is supposed to do this, but again I've had no luck with that.
For your first requirement of highlighting braces and brackets, there is no default highlight group for braces. You need to create one for yourself. Here is how you do it!
For your second requirement of how to highlight classes, you should be using this TagHighlight plugin. And this page explains in detail about the plugin and how to get it working. It also shows you snapshots where your exact requirement is met! :)
I have been working with customizing the formatter in Eclipse to suit my style and I finally feel like it seems to do it exactly as I want it to except when inserting templates.
Whenever I use any Eclipse template (for example "Add unimplemented methods") it inserts a blank line before the code, even though the "Blank Lines" settings is set to 0 for "Before method declarations".
Anyone who knows how to disable this blank line or do I have to remove it manually every time?
I have the same issue with Eclipse too, and it's been a pet peeve of mine for some time. I believe it's a bug, because it has nothing to do with the formatting settings at all - turning off all 'new line' features and setting all 'blank line' parameters to 0 still doesn't fix the issue. You might want to report it as a bug.
I was looking for tool on Java that does the same (similar) functionality of "inspect element" of "Google Chrome". Does anyone has information whether this is available and how it can be implemented?
The question refers to cases when you have the Source code and you don't know the inside of it. Thus, the idea is to inspect elements (objects) on UI while running code!
Since you have access to the code you can use the Java Object Inspector.
Just add one line of code at the right place:
Inspector.inspect(objectToInspect);
Inspect Element in Chrome/Firefox and View Source in Safari are there because the internet is open sourced. The HTML code pushed to a user's machine is viewable by them (obviously not the spreadsheets or other static files held on a server.)
Compiled projects don't have this feature for practical reasons.
In many languages it is impossible to "decompile" an object into its source.
If you could go to Microsoft Word and Inspect any element, you could just copy and paste their application without paying.
So no, you cannot take a compiled Java object and click to see its source code.
I remember hearing about a project that did something like that a few years ago. I can't recall the name, but I ran across this while searching for it. https://github.com/cozycode/Swing-Inspector Based on the description, at least. it looks like it might be useful. If I remember what the original project was i'll post a follow up.
for you to find the java code, in the inspect element go to Sources. Look in the picture below. I inspected google and went to Sources this what i found. press on the files. that say js, and the java code will appear.
if you cant see the pic, tell me. or try to download it, and open it on paint.
enter image description here
I'm having trouble using the refactor feature in eclipse (Indigo on Win7 64) to move my hard coded strings to the string.xml file.
Automatic Code Generation for Strings.xml from Eclipse
It creates the entry in string.xml ok but when it builds the appropriate code, part of the code can be duplicated and the resulting code is nonsense. For example:
...setText("Inbox")
becomes:
...setText(R.string.inboxg.inbox)
instead of
...setText(R.string.inbox)
This behavior varies depending on the length of the line and what is being replaced.
Anyone seen this before, know of a fix?
I've had a very similar occurrence happen to me when refactoring the package name. I can't really see a way to fix this (besides a global find and replace), perhaps an issue needs to be submitted:
Android google code issue repository:
http://code.google.com/p/android/issues/list
I've done a quick search through the issues and couldn't find anything related.