How can I change the file sorting of VS Code? - visual-studio-code

In my project I have files labeled as such day1.txt, day2.txt, day3.txt, etc.
Now in my normal file system they are listed in the correct order:
day1.txt
day2.txt
....
day10.txt
day11.txt
In VS Code they are listed like so:
day1.txt
day10.txt
day11.txt
day2.txt
day3.txt
Is there a setting somewhere to change this? It is driving me mad.
I've given the settings a search and I didn't see any obvious parameter to change that would affect this.

Yes there is a way.
In your Settings (File → Preferences → Settings) search for: explorer.sortOrder
A small pen will appear on the left side of the setting. Select the way you want to sort the files. There are five options available:
Default
Mixed
Files first
Type
Modified

Unfortunately, there's no option that will allow you to sort all of the open editors alphabetically.

No, unfortunately there's no such option as of yet, but there's already a feature request.

Maddening having to constantly search for the file in the OPEN EDITORS section. Such a nice program otherwise. What a shame.

Related

What is this marked number next to the file name in Visual Studio Code?

I know the meaning of M as "modified" on the right side of the file name.
But what is that number 4 next to the M ?
Is there a name for these marks?
Any docs of this will helpful!
That is the number of linting errors and warnings currently in the file.
To see the actual errors and their details, open the Problems panel, which by default is at the bottom part of the editor. (If it's not shown, open it by going to the menu View > Problems).
As #Goofballtech mentioned, this is the number of errors & warnings associated with a given file. You can turn this off by setting problems.decorations.enabled to false in your VSCode settings.json.
You can find more information here: https://code.visualstudio.com/updates/v1_20#_error-indicators-in-the-explorer

Is there way to change NON-NLS tag itself to something else?

In Eclipse Kepler I started externalizing strings and the wizard puts the NON-NLS behind the lines. I know the reasons why and that's great, but is there way to modify this tag to be something else?
For example for code style you can use tags to enable and disable the formater and you can define your own and I prefer much shorter ones.
If instead:
//$NON-NLS-1$
I could change it to for example something like this:
//$NX-1$
And still being properly detected by the Source -> Externalize Strings wizard.
For me it would improve my readability, it makes big lines, then it wraps them where they didn't needed to etc... And I can make sure not use NX prefix on anything else so it will not misbehave.
Is there setting/plugin/workaround which could achieve desired effect?
Thanks in advance for any hints.
UPDATE: Marked answer didn't solved it per say, because looks like mine question doesn't have solution (maybe except recompiling eclipse)
You can edit the template in preferences.
Go Window > Preferences > Java > Editor > Templates the editor nls template.
Change current template from //$$NON-NLS-${N}$$ to //$$NX-${N}$$ or some thing else you want.
Refer

Partial AutoComplete in eclipse?

I'm very happy with the way eclipse autocompletes for me, but I was wondering if it could do something more...
I often have very similarly named variables, such as myPlayerManagerPane and myCharacterManagerPane, I was wondering if there was a way that would allow me to get half way into the name, type a character or two and then autocomplete. This would let me copy and past lines of code for both, then surgically edit the variable names. It's gotten to the point where I'm trying to do this (I'm autocompleting on autopilot) and getting fun variables such as myCharacterManagerPaneManagerPane as I autocomplete a whole name, halfway through another.
Is there a way around this?
In Window > Preferences > Java > Editor > Content Assist, select "Completion overwrites", instead of "Completion inserts". This would overwrite the entire variable with the new one.
Alternatively, you can press Ctrl to toggle this behaviour when the content assist window pops up.
Your question (or rather, its prelude) can easily be confused with another one; namely,
Say I have two variables variableLabel and variableConfiguration, how can I have Eclipse complete the common prefix of the two variables, i.e. variable, before writing either L or C and having Eclipse "AutoComplete" complete the rest?
This is the question which lead me to this thread, so I feel I must answer it:
In Window > Preferences > Java > Editor > Content Assist, check "Insert common prefixes automatically". Pressing Ctrl+Space now results in the desired functionality.
Relevant StackOverflow question

Find all assignments to variable

Eclipse has an easy way to find all references to a variable, but is there a quick way to only look for assignments?
Quick? Hm... Find all references with Ctrl+Shift+G, then filter in the Search view (results) via the View menu (dropdown triangle). You can select Reads there to filter these.
Shortcut: Cursor to the variable, menu Search > Write Access > Workspace. No keybinding assigned by default, but you can do this as usual (Preferences > General > Keys).
Ctrl+Shift+U shows all usages of a variable, with different icons for read and write references.
You can also set different colors for read and write occurrences of the selected variable (in the right part of the editor). These colors are set in Eclipse preferences, in "General -> Editors -> Text editors -> Annotations". There is "Occurences" and "Write occurences". I set the same color, slightly darker for "Write occurence", so I can easily spot write occurences, without any key stroke.
Ctrl+Alt+U finds all the references within a class (local references) for a particular variable, on my ubuntu machine.

Best way to search for instances of a string in Eclipse

I am trying to find where a particular variable is being set. Is it possible to search through a set of project source files to find all the possible spots a certain variable might be getting set?
The search in the drop-down menu is a bit confusing to use. After I enter a search I happen to be looking at, and I know it is there, when I do a search from the root of the file system, it tells me that the string is not there :)
Is this a common newbie issue? I just recently started using Eclipse and could just be missing something simple :)
Thanks,
Alex
Select the field where it is declared, then ctrl+shift+H to open the search dialog. The "Java Search" tab should be selected with the Search string populated with your field name, including package. In "Search For" select "Field" and in "Limit To" select "Write accesses" That will show you everywhere that field is assigned.
Here's a screenshot of the search dialog.
I believe the default mapping is Ctrl Shift G.
Highlight the variable and do Ctrl Shift G it will find all references of that variable.
Be careful, it will not just do assignments, so you might be getting more data than you want.