When I like to create a new variable of type ImageObserver and the line starts like this:
IO
and I press Ctrl+Space , I get a couple of wrong suggestions! Suggestions for abbrevs that do not fully match!
Eclipse's content assist suggestions are:
IOException (no! full abbrev is IOE, not IO!)
IOError (no! full abbrev is IOE too, but not IO!)
IndexOutOfBoundsException (no! full abbrev is IOOBE, not IO!)
ImageObserver (yes! full abbrev is IO)
ImageOutputStream (no! full abbrev is IOS, not IO!)
How to get rid of all the other non-full-matching-abbrevs?
Keep in mind that the completion proposals fall into a bunch of categories (ie, lots of different sources of potential matches). Your example text, IO, can logically be interpreted as either a camel-case abbreviation (such as ImageObserver) or as the start of a class name (such as IOException), or even as a camel-case-starts-with match (such as ImageOutputStream, whose abbreviation starts with IO).
I don't know of a tool that's clairvoyant enough to know which of those you want given such a small input. Eclipse, by default, uses a "relevance" ordering for completion proposals and it weighs "starts with" matches ahead of camel-case matches (rightly so, in my opinion). There's no publicly exposed way to change that weighting algorithm, that I know of.
If these are classes or packages that you simply never want to see in Content-Assist, you can define Type Filters to exclude them. In Preferences, go to Java > Appearance > Type Filters to do so. But be aware that Type Filters apply to the entire workspace and in multiple places in the UI, not just Content Assist completion proposals.
You really want IOException to be excluded on auto-complete when IO is typed even though IOException starts with IO?
If so, this sounds like a feature request, but unless you are ready to contribute I can't see it getting added anytime soon.
Contributing
If you are interested in contributing, you need to write a Java Completion Proposal Computer. Once you do that, you can enable only your proposer in the preferences (Java / Editor / Content Assist / Advanced ).
You can even bind your special completer to its own Keyboard Short-cut so you can get "full abbrev" completions only.
Here is a screenshot of my binding of Template Proposals to Ctrl+4 so with a single key combination I can get quickly get them all.
Code Recommenders
I also recommend reading about Code Recommenders, the project adds significantly more sophisticated code completion to Eclipse.
I have raised a bug with Eclipse to see if sorting perfect Camel Case matches could be on the cards.
Related
I can configure Eclipse's code "Clean Up" to convert existing code expressions to lamba expressions if possible.
I am trying to find a way to manually trigger this, if possible only for the selected subset of my type.
I do not want to run the complete code cleanup, only the conversion to lambda expressions, and, if possible, also not for the complete type, but only for the selected part of it.
Clean-ups are intended for mass operations. Since you don't seem to be interested in mass operation, you could consider using quick assist (Ctrl+1) on individual expressions.
EDIT: The quick assist is available since Eclipse Luna, see http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2FwhatsNew%2Fjdt_whatsnew.html - second entry "Migrate anonymous class creations to lambda expressions and back".
Or: run the cleanup on a given file and the use the compare editor (against latest from git or similar) to only accept some selected changes.
I'm using mainly Notepad++ for my C++ developing and recently i'm in need for some kind of basic autocompletion, nothing fuzzy, just want to type some letters and get my function declaration instead of having a manual opened all of the time..
The integrated autocompletion feature of my Notepad++ version (6.9.2) gives the declaration of basic C functionality like say fopen and parses my current file user defined functions, but without declaration.
I guess it's normal for a text editor to not give easily such information since it has nothing to parse i.e. other files where your declarations are (as it's not an IDE), but i don't want either to mess again with MSVC just for the sake of autocomplete.
Is there an easy, not so-hackish way to add some basic C++ and/or user defined autocomplete?
UPDATE
Adding declarations the "hard way" in some file cpp.xml is a no-no for me as i have a pretty big base of ever changing declarations. Is there a way to just input say some list of h/cpp files and get declarations? or this falls into custom plugin area ?
Edit the cpp.xml file and add all the keywords and function descriptions you'd like. Just make sure you add them in alphabetical order or they will not show up.
Another option is to select Function and word completion in the Auto-Completion area of the Settings-->Preferences dialog. NPP will suggest every "word" in the current file that starts with the first N letters you type (you choose a value for N in the Auto-Completion controls).
Usually I pipe my log through a lot of greps to remove the "noise" before i open it in an editor.
I think it should be possible to do this filtering inside an editor (Especially Emacs)
Is this what chainsaw is doing? For log4j format only or more general?
(It is the only logfile viewer tool I can find)
How do you guys do it?
(I think UNIX grep syntax would be easiest for me)
Chainsaw does support both positive and negative filter matching. You can define positive and negative matches based on the logger tree (right click on nodes for the options), and you can define positive-match expressions in the 'refine focus' field, and negative-match expressions using the 'ignore' option below the logger tree. There is a tutorial available from the help menu which describes the expression syntax.
Chainsaw has had a lot of new features added since the last official release. The developer snapshot (including a reworked configuration screen) is available here:
http://people.apache.org/~sdeboy
Chainsaw doesn't just work with log4j. There are 'receivers' available that make it work with log4net, java.util.logging, log4php and others.
You can also process any regularly formatted text file using a VFSLogFilePatternReceiver (use the 'process a log file' option to configure Chainsaw to define one). There are some pre-defined log formats in the configuration dialog that act as example formats - tweak one to match your format. The JavaDoc provides more information: http://logging.apache.org/chainsaw/apidocs/org/apache/log4j/chainsaw/vfs/VFSLogFilePatternReceiver.html
If the greps are the same, you can simply code a script to do all that work for you (e.g. vimscript for vi). That way, you don't have to repeat all the tasks while leaving the logs intact for further investigation.
You're right on chainsaw and log4j - it's a logging viewer with different capabilities, e.g. a filter mechanism. However, I am unsure, if you are able to have multiple filters activated simultaneously.
Yes, you should try Chainsaw first.. it does support various ways of getting your logs.
Necroposting: I created a mode for Emacs that is specifically targeted at Log4j-like logs, but supports many more formats, especially if you customize it for yourself.
Features:
Colorization (just customize faces if that's too much)
Interactive filtering in the same buffer:
by level
by logger name
by thread
by message
easy narrowing
edit all currently set filters at once
A few log-specific movement commands
Copy (with M-w) only visible text, goes well with filtering (this is customizable)
Any refactoring tool like this?
Windows
After you press Alt+Shift+R as mentioned by kostja, you can select the text you want to change, then
Ctrl+Shift+Y for lowercase, or
Ctrl+Shift+X for uppercase.
Mac OS
Cmd+Shift+Y lowercase
Cmd+Shift+X uppercase
There is no intelligence in this. It just blindly changes the case on the selected characters.
note: This tip comes from eclipse help. If you need to find it, click Help, Search, then type "uppercase". You'll find a page with lots of shortcuts.
What I find useful is column select using Alt+Shift+A and select a column of letters.
Then use Ctrl+Shift+Y or Ctrl+Shift+X to lower case or uppercase letters.
This works for eclipse on windows.
There are a number of problems:
fooBar -> FooBar and vice-versa are unlikely to occur unless someone has been ignoring the Java style guidelines. (I rarely encounter such code, and when I do my initial reaction is to write off the code as beyond salvage.)
fooBar -> FOO_BAR and vice-versa are plausible, but pretty unusual.
foobar -> fooBar is also plausible, but it is problematic. It would entail Eclipse figuring out where the intended word boundaries are in a sequence of characters, and that is hard to get right.
If you look at these, they are all either unlikely to be needed much, or too hard to do properly. Hence, it doesn't surprise me that they are not supported by the standard Eclipse codebase.
Pressing Alt+Shift+R gives you all the power to refactor your variable name to your liking. AFAIK, there is no tool or shortcut that does just the capitalizing.
No. You'll have to use the standard rename refactoring and retype the variable name in capital letters.
Capitalizing variable names should be limited to those cases, where we change a class attribute to a "constant", and this doesn't happen that often...
There's a lot of Text editors which support autocomplete during programming, but I want one which can autocomplete while typing normal text as I see a lot of repetition of words I type. Any emacs fans who have implemented this ?
Try the builtin dabbrev-expand; it's bound to M-/.
Also see Predictive Mode if you fancy the more flashy stuff.
pabbrev-mode (predictive abbreviation) works by examining previously written text. Unlike dynamic abbreviation, the text is analyzed during idle time (which enables quick lookup of potential abbreviations). Pabbrev looks at word frequency to suggest the most common expression.
From the documentation, this is what it might look like as you typed the keys pred.
p[oint]
pr[ogn]
pre[-command-hook]
pred[ictive]
I love hippie-expand!
The Zeus editor has a non-programming auto complete feature (i.e. Alt + Space) that takes the current user input, searches the current file for words starting with that input and displays them in a drop down list.
vim has such a feature http://vim.wikia.com/wiki/VimTip4
i think ultra edit has a simmilar feature
You could set up auto-complete mode with a dictionary as your source. I have been very tempted to do this myself.
predictive-mode auto-completes from a dictionary of words. It learns which words you use most often, and can also automatically learn new words as you type if desired.
It's very fast, fast enough that turning on auto-completion doesn't cause any noticeable lag when typing, even with a large dictionary.
(Disclaimer: I'm the author of predictive-mode)