Can "Remove Unnecessary Usings" in VS2017 be customized? - visual-studio-2017

VS2017 includes a feature to remove all unnecessary using statements from the top of a .cs file. While useful, I'd like to configure it to not remove System.Linq even if it is unused. Otherwise I have to add it back in as soon as I need to use an extension method.
Is there any way to change the default behavior?

Related

Auto curly braces in WebStorm, check for modification

I am using WebStorm to make React application.
Firstly, when I use JSX tag attribute, it automatically creates curly brace. How can I disable this option?
Secondly, when our source code was modified, many IDE shows us that this file is changed. In VSCode it's done like this:
but WebStorm is not. So I can't know whether this file has changed or not. How can I set this?
Firstly, when I use JSX tag attribute, it automatically creates curly brace. How can I disable this option?
See https://stackoverflow.com/a/46949738/783119 -- should explain the situation (so I do not repeat the same here)
Secondly, when our source code was modified, many IDE shows us that this file is changed.
Settings/Preferences
Editor | General | Editor Tabs
Enable Mark modified tabs with asterisk option.

How do I turn off the auto message on a new file in Webstorm IDE?

When I create a new file in a webstorm project I get a superfluous message telling the next person 'who made the file and when'. Since the invention of source control I really don't see why jetBrains have decided to make this default anyway how do I turn it off?
This is probably because you have USER and DATE as part of your file template:
Just get rid of the the stuff in the template and you should be good to go. In other words, get rid of 3 and 4, and you will no longer be prompted.
Usually webstorm will not prompt you for this, but for some reason in the installation the username was not added to its list of macros.

Is there anyway to rename the "Source" button to something like "HTML"?

Is there anyway to rename the "Source" button to something like "HTML", I ask this as users are confused at how to add html code using the editor?
Yes, inside of the "lang" folder you will see all of the various language files.
For my case, and probably yours, You will want to edit the file "en.js". The file is "compressed" to some degree so it may be difficult to read, but it's still not too difficult to change one string. If you do plan on changing multiple strings you will most likely want to use a service to format Javascript.
Search for the following segment of code. It was one of the very last lines in the file.
"sourcearea":{"toolbar":"Source"}
change it to
"sourcearea":{"toolbar":"HTML"}
Avoid This Method Unless Required
And as for a very unsuggested method, since you can't modify the language files for some reason, you can modify the ckeditor.js file and force a specific label.
Inside of "ckeditor.js" change the line below
a.ui.addButton("Source",{label:a.lang.sourcearea.toolbar,command:"source",toolbar:"mode,10"});
to the follow code
a.ui.addButton("Source",{label:"HTML",command:"source",toolbar:"mode,10"});
The only thing modified is the "label" value in the above line. We remove the reference to the a.language.sourcearea.toolbar and insert a string in it's place instead.

Customizing include-guard for Eclipse CDT

I want an automatically generated include-guard by creating a new C++-class with Eclipse/CDT, but I don't find any way to change the ${include_guard_symbol} attribute.
My wish is an include-guard with a namespace prefix like following:
#ifndef NAMSPACE1_NAMESPACE2_HEADER_HPP
But if I use #ifndef ${namespace_name}_${include_guard_symbol} for this, it will produce:
namepace1::namespace2::_HEADER_HPP
How can I do this?
I had a dig around in the source for CDT, and found an undocumented preference setting you can use to change what is generated by ${include_guard_symbol}. There's no GUI for it either, but if you add the codetemplates.includeGuardGenerationScheme setting to <projectpath>/.settings/org.eclipse.cdt.ui.prefs, you can choose between file name (the default), file path or UUID.
Given the file <projectpath>/src/include/Class.h, the following values give these results:
0 gives an upper-case filename, i.e. CLASS_H_
1 gives a UUID, for example. HC9ABE718_D04E_411C_B5A2_F9FE1D9F9409
2 gives an upper-case file path, that is, SRC_INCLUDE_CLASS_H_
To avoid any doubt, here's the contents of our .settings/org.eclipse.cdt.ui.prefs:
codetemplates.includeGuardGenerationScheme=2
eclipse.preferences.version=1
formatter_settings_version=1
It's obviously not exactly what you're after, but we use 2 to give us an approximation of our namespaces since, generally speaking, our namespaces follow our folder structure.
The relevant code is in these files in the CDT source:
core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/PreferenceConstants.java for the constants for each option
core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/corext/codemanipulation/StubUtility.java for the generateIncludeGuardSymbol() method that does the work.
It would be really nice to see an extra option added for using the namespace, and a GUI too.
I'm using Eclipse Oxygen (CDT 9.3) and as Eelke described in their comment, there has been a UI setting for this for a while now.
However it only lets you choose from the preset schemes, no namespace or richer customisation options available yet.
Search for 'guard' in the preferences dialog, or navigate to C/C++ > Code Style > Name Style and select Code > Include Guard and then choose from the available guard schemes.

Problem in getting the path of a shortcut file!

In my application,I have an option of adding files to a list..were it will let the user to select multiple files at the same..am using CFileDialog to do tis and I enabled OFN_MULTISELECT (for multiselect)...The problem am facing is,When I try to add a shortcut file..its not taking the actual shortcut path,its reffering to the actual path.Actually I wanted to avoid shortcut file being added to my list,but every shortcut file that is being added does not have the extension ".lnk"(i dont know the reason).
So,is there any way that we can neglect the shortcut file being added.
You need the flag:
OFN_NODEREFERENCELINKS = 0x100000;
regards
Oops
PS: it does not neglect links from being added, but it ensures to let the link as it is. You will get files with *.lnk extensions for links. afterwards you can filter them out in you code.