Consider this enum:
Private Enum colors
white = 0
black = 1
End Enum
IntelliSense shows black and then white while I'd prefer to see white and then black.
I don't care about the numbers.
Is there a way to customize the enum sequence of the items shown by IntelliSense?
You could prefix the values to create you custom list order.
if you type "colors." and then the TAB key it writes the first element (black). I'd prefer to put the most used one first for writing it faster.
Don't use TAB for completion then. Type colors.b then hit Ctrl+Space, and it'll either complete to Black (if it's the only member that begins with a B) or moves the autocompletion list selection to Black (or whichever alphabetically comes first), given you also have Blue, and Brown.
Using prefixes merely to control the sort order of members in the IDE's autocompletion list is a rather arbitrary reason for not using clear identifier names and resorting to funky prefixing schemes.
You're not writing code for it to be merely executed. You're reading code for it to be read, and maintained.
"It helps me type faster" is actively harmful if your successor has to squint and stop and think and try to make sense of your prefixing scheme - it's distracting, and slows down reading the code.
Programming is at a minimum, 80% reading, not writing. Learn to type faster instead of making reading harder than it needs to be.
Related
Is there a way to make the language property list shorter? Make it show only EN-US and PT-BR, for instance, so it's easier to find them?
You probably don't need to do it.. You can likely just make your life easier like:
Make a new form, lets say it's called LocalForm.vb
Drop a label on it, lets say called HelloLabel
Set form to de-DE, set the text of the label to Hallo
Set form to fr-FR, set the text of the label to Salut
Set the form back to (default) - you now have LocalForm.resx, LocalForm.de-DE.resx and LocalForm.fr-FR.resx and you can add controls
Add a Button, called StartButton
Double click the LocalForm.de-DE.resx file
Dismiss the "if you mess this up you'll have to fix it yourself" dialog
Add a line for StartButton.Text Starten
Repeat for other language files
Dropping a control named XyzButton on the form, and then visiting each LocalFor.*.resx in turn and adding the locale for it is a lot easier than back-and-forthing with the language setting, though I know why it's done the way MS chose to do it - you're supposed to lay your form out perfectly with all its hundreds of controls, and then switch to French and write all the French for all hundreds controls, and then switch to German and write it all in German.. In a use case like that there isn't a lot of work to do with that awkwardly huge Language dropdown. Incremental adds that way are a bit of a pain..
Perhaps raise a connect bug/feature asking them to put the "already used" languages (as determined by the presence of Form.*.resx files) at the top of the list, and wait many years for it to be implemented :)
Note: There's a bit of a nuisance with this "edit the resx" in that if you rename a control it doesn't always get picked up. Last time I was localizing I threw together an app that watched (FileSystemWatcher) files named *Form.resx and if it saw a change (load the current version, compare to the prev version) that was a rename, it made the same change in the other files (or maybe alerted if they weren't in sync.. can't quite remember now and I've no idea where the code has gone)
Maybe don't rename your controls after you first decide a sensible name for them/add them to the translated resx..
I am programming in Pascal (compiling with the Free Pascal IDE) but I imagine the following issue could be in all programming languages, whether you have to declare variables or not.
In Pascal you have to declare your variables before you can use them. They can only be declared at the top of a function/procedure or, in the case of global variables, at top of the main program.
As my program got longer over the past year and more and more variables were declared, I have had to scroll back up all the time to check which variables I have declared in order to use them in a function or main part of the program.
Is there any solution to not have to scroll back up all the time?
Putting variables in a separate unit file and having the file opened next to the main program file is the only thing I can think of, but at this stage I have too many functions and classes to shift everything around that way. Too much rework of the code would have to be done.
In Lazarus, the freeware and excellent IDE for FPC[1], there is a simple way to do this:
Place the mouse over a variable
If the variable has been declared, the IDE will visually mark it
If it is marked, single-clicking the variable will take you straight to where
it is declared.
More generally, when you hover the mouse over a variable, the IDE will change its background color to something like light grey[2], including any other occurrences of it which are on-screen
at the time, so by itself this is sufficient to locate the variable's declaration site if it happens to be on-screen, as it often is if the variable is a local.
[1] I don't know why anyone would use Notepad++ or another IDE for FPC considering
how good Lazarus is.
[2] The top and bottom pixel rows of the changed background color are drawn darker than the others, which makes it look rather like (wearing my spectacles) the variable name is underlined.
Delphi IDE although a paid solution offers free community packages for students and such. i had a great time using it for my college assignments. its more user friendly as I had a lot of trouble navigating Lazarus. on delph I there is a side-panel that shows you all your stated variables,constants,uses,procedures and more.
I can imagine that this might not (ever) be a feature.
(I wouldn't necessarily want "other" method calls to be blue as shown in the second block; blue is just to emphasize what's different from first block.)
If there's a way to just color methods defined in the current class, please advise.
(I want this because my eyes need all the help they can get.)
No, there is no such feature in IntelliJ IDEA as of version 14.1. It can be implemented as a plugin, but I'm not aware of any such plugin.
Just documenting, as I was looking for a way to do this and I have found a way that is satisfactory enough to me.
There's a way, but it's a workaround, it will have side effects.
How:
Go to File > Settings > Inspections (Choose the Global Profile if necessary).
Type in the search: qualified.
Tick the checkbox next to "Instance method call not qualified with 'this'".
Click on Severity > Edit severities, add new entry by clicking the green + button.
Name it whatever you want.
You must put it at the bottom of the list using the arrows. If you don't, the F2 key will no longer work as you expect it as it will prioritize errors at the top of the list.
Set the Error stripe mark to #FFFFFF, or the same color as the scrollbar.
Set it bold if you wish.
If you want to set a color, you must set a background color to white (or black if you have a black interface). If you don't, the color will appear black in most conditions.
If you really want to, do the same for "Unnecessary 'this' qualifier"; there is an additional checkbox to make it only apply to methods and not fields.
Side effects:
This enables inspections, which is not desired.
Pointing the mouse cursor onto the method calls will cause a hover text to appear describing the inspection.
If your code has no errors, no warnings, and no additional informative inspections, pressing F2 will jump through these calls.
Just reading a text on Objective-C at the moment on the verbosity of method calls in the language. It says that method calls and even method declarations are 'often split across multiple lines to prevent a single line of code from becoming so long that it wraps within the editor' (as well as for the sake of clarity).
Just wondering what code wrapping within the editor means? I know how text can be wrapped around an image in order not to interfere with the image and allow for flow but not sure about this.
Thanks.
The text will wrap when the line of code is longer than the editor window is wide. Usually this is disabled in code editors and a horizontal scroll bar is displayed instead and the end of the line of code disappears out of view. Some developers prefer wrapping, most (in my experience) don't. If wrapping is off then long lines of code are difficult to grok so shorter lines are preferred. I don't think that objective-C cares about whitespace (I'm a C# kinda guy) so it's your preference that matters.
I have an Eclipse custom editor and I implemented 'report errors as you type', but every now and then my error squigglies (using JFace annotations) are not shown or linger after they should be removed.
I am using MonoReconciler with my implementation of IReconcilingStrategy. During the reconcile step I call annotationModel.replaceAnnotations to remove the old errors and add the new ones. Most of the times this works fine. Every now and then the updates are lost, and I notice the following:
the red stamp on the left ruler disappears, but the red underlines stay
on the next character I type, the underline disappears
I verified in the debugger that the annotations are correctly calculated. The underline disappears immediately after typing a character, and not after the 500ms delay of the reconciler. It looks like a lost UI update/redraw.
There must be a race condition somewhere (the reconciler runs in its own thread). What am I doing wrong? I couldn't find any documentation about this use-case.
Edit: To reproduce, checkout the scala-worksheet and create a new one. Type
object Test {
val m = Map( 't' -> 1 )
}
Now edit the arrow: remove the >. The underline is missing. Type a space, it comes back. Add it back, the underline is still there until you type another space.
I fixed it by calling invalidateTextPresentation on the underling SourceViewer, but it seems to me that shouldn't be necessary. I'd like to understand what is the correct way to use editor annotations.
PS. The lost updates can also be seen in this screencast.
It's hard to tell from a distance, typically in eclipse, any changes that impact the ui should be executed on the ui thread (and eclipse will not always warn about this).
Normally you use Display.getDefault().asyncExec(...) to execute something on the ui thread but you probably already know this. It can happen that 2 queued up changes cause a race.
(I have implemented semantic highlighting, error highlighting etc several times for the company I work for, Sigasi. If you can point me to your implementation I may be able to figure out what's going wrong.)