In Eclipse you can enable/disable "Compute deep outgoing state for folders" in Window | Preferences | Team | SVN | Label Decorations (or in other versions apparently -> Window | Preferences | Team | SVN | Performance).
The Documentation provides very little information about the functionality of this. ("Specifies if the computing of deep outgoing state is enabled.")
I was wondering what exactly does it do? What is a deep outgoing state?
By default a dirty (changed but not committed) file is prefixed with >. Folders that contains the dirty file are also prefixed with >. Here is an example where only the file Project/path/to/file.txt is dirty:
Without Compute deep outgoing state for folders the same example looks like this:
To compute the > dirty label for folders, the subtree of the folder have to be checked/visited for dirty files. By disabling Compute deep outgoing state for folders no subtrees need to be checked/visited, but dirty files are harder to find, especially when an ancestor folder is collapsed.
Related
Doing a git merge master on a branch, and conflicts are usually displayed in a file as follows:
<<<<<<< HEAD
=======
>>>>>>> master
In Visual studio, you get an option to Accept Current Change | Accept Incoming Change | Accept Both Changes.
Now I want to accept both changes, however, they are in the wrong order. If only the master's change was first, then they would be in the right order and I wouldn't need to move things around.
Have many such conflicts and looking to see if I can somehow display the master's change above HEAD's, and thus enable a quick Accept Both Changes resolution.
Any way to do this?
In my huge project, I would like to count the ".ts" file(s) existence. as well ".spec.ts" files. how to I count them separately. is there a way in "visual studio code" for it? simply counting the file by it's extension.
at present I am trying with "ctl + shif+ f" but not works.
thanks in advance.
Ctl-Shift-F is a good enough approach, if the total amount of files that you will potentially match is less than 10000. This is due to a limitation in vscode, that limits the total amount of matches to this number. Thanks to #Timothy G for pointing this out!
I would do it like this:
To count all .spec.ts files change the search pattern to regex and search for (.*\n?)* (this matches the whole content of the file, forcing a multi-line match in vscode).
Under "files to include" add *.spec.ts:
To count all *.ts files without the *.spec.ts files you set "files to include" to *.ts and "files to exclude" to *.spec.ts:
What about using the file system in your OS ?
In Windows you could search for *.ts and you could see the amount of elements in the bottom left corner of the window.
On linux you could use ls --file-type *.ts | wc --lines
When I copy this, for example:
<AdmobComponent/>
It pastes as:
< AdmobComponent / >
Does anyone have any suggestions? I don't even know where to start to fix this.
From within the IDE:
Go to File | Preferences | Settings and then click Text Editor | Formatting.
The top option should be FormatOnPaste, make sure this is unchecked.
If you are using the Prettier extension, then this is a known issue.
For anyone having a similar problem in Visual Studio 2019 it can be fixed as follows:
Go to Tools | Options | Text Editor | {language}
Now depending on the Language the options that need to be changed could be in a few different places or missing. But for C# and JavaScript go to Code Style | Formatting
Once there there are a few options. If "Automatically format on paste" is unticked it will completely remove any reformatting on paste.
Or for a more limited impact go into the "Spacing" section and change "Set spacing for operators" to "Ignore spaces around binary operators". By doing this some automatic reformatting is lost but I think it's worth it not to have all those spaces inserted into stuff like Kebab case variables.
I wonder why my node_modules folder is greyed out in my VS Code editor after I run the command npm install.
Here the picture of my folder:
Files/folders that are included in .gitignore are greyed out. Normally node_modules folder is included within .gitignore.
It's because your node_modules folder is referenced in your .gitignore file.
Visual Studio tells you that this folder is ignored by the version control by graying it out.
As was already pointed out, VSCode automatically ignores everything in .gitignore. However, it also explicitely ignores some folders by default. All of this can be configured. Here are the steps you might want to take:
Check out the official documentation on Workspace settings
Open the relevant settings (you can choose between User (global) and Workspace). I usually do this via CTRL (or Command on Mac) + SHIFT + P -> > settings, which will show you the relevant choices: . For each you can either choose the UI or the JSON variant.
Also make sure to check the default settings via Peferences: Open Default Settings (JSON). You will find that, as of now (May 2021), **/node_modules is also automatically excluded, independent of other ignore files. Currently the default settings look like this:
// Configure glob patterns for excluding files and folders in fulltext searches and quick open. Inherits all glob patterns from the `files.exclude` setting. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options).
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"**/*.code-search": true
},
// Controls whether to use global `.gitignore` and `.ignore` files when searching for files.
"search.useGlobalIgnoreFiles": false,
// Controls whether to use `.gitignore` and `.ignore` files when searching for files.
"search.useIgnoreFiles": true,
Enabling searching node_modules
"search.exclude": {
"**/node_modules": false
},
"search.useIgnoreFiles": false
WARNING: This will slow down things a lot since node_modules takes forever to search through - at least during cold start, that is when things are not cached. (Note that it is difficult to estimate how their caching works since it keeps evolving over time.)
To mitigate this, you might want to add some additional search.exclude settings. Note you will have to explicitely list everything you don't want, because...
The big shortcoming of VSCode search
search.exclude does not support:
negative look-ahead/behind
mutually cascading queries
Things like this will not work!
// does NOT work! :((
"search.exclude": {
"**/node_modules/#types": false,
"**/node_modules": true
}
This is a MAJOR problem which has been heavily discussed in the almost famous issue #869 for 6 years already! Join in and add to the 100+ comments! :)
Update: As of 2021/8/14, the issue has been taken off the backlog queue and put in the On Deck queue (but that also might not mean much).
I am using Eclipse.
It happens a lot when we develop code like this (assume it is developed sequentially, from top to bottom):
Part 1 (*)
Part 2
Part 3
Part 4 (*)
Part 5
But we just figured out that parts 1 and 4 (marked with (*)) are wrong and the others are just fine. The question is that how we can undo just those two parts (1 and 4) without undoing the rest?
If we could undo selectively, it was great. Note that simply reverting the code to the version 1 loses parts 2, 3 and 5 which are correct parts and should remain in the code. Also note that usually these parts are mixed in one or two code blocks (not in separate blocks).
Example:
Part 1: Add method f1(x, y) and move some code from main() to f1() --> incorrect (should be reverted)
Part 2: Add method f2(a, b, c, d) --> correct (should remain)
Part 3: Change another part of main() implementation --> correct (should remain)
Part 4: Change f2 signature to f2(s, n) --> incorrect (should be reverted)
Part 5: Change body of f2 --> correct (should remain)
The current approach I use is:
Keeping a copy of the latest version somewhere (e.g., in a temporary
text file), then undo to before part 1, and add those correct parts
from the temporary text file to the source code.
Manual comparison of different versions, and resolving conflicts.
Does anybody think of easier, yet more automatic way of selecting which change to undo and which one to keep?
Eclipse keeps a history of your changes for a few days (configured in the Preferences in 'General > Workspace > Local History'). You can right click on a file and select 'Compare With > Local History' to see the differences between two version of your file. You can copy changes from the old version to the current version.
For the longer term you should use a version control system such as SVN or GIT. There are Eclipse plugins for these which let you do similar 'Compare With' operations - but covering the entire history of the file (provided you commit your changes regularily).
I just found this paper:
Supporting Selective Undo in a Code Editor which will be presented in ICSE 2015 conference.
The authors show the history of changes graphically, so you can choose which changes to undo (and which one to keep).
Azurite (can be download and installed from here) is the name of their implemented Eclipse plugin that supports selective undo and lots of other simple features that are useful for developers.