ReSharper File Layout - Sorting Conversion Operators Separately from Other Operators - resharper

I'm forced to comply with StyleCop rule 1201. StyleCopAnalyzers is stating that conversion operators must appear before other operators. I use ReSharper code cleanup to organize the files which has worked great until I needed to define operator + and a conversion operator for the same class.
How can I get ReSharper file layout to differentiate between conversion operators and other operators so that I may have them sorted according to StyleCop?
[edit]
I will also accept a way to change the ordering rule for StyleCop.Analyzers, but according to issue 2541 there doesn't appear to be a way currently.

Related

Can I Append Custom Highlights to an Existing Syntax Without Forking It?

I'm looking to add a few custom syntax highlights to an existing one, but I don't want to maintain a copy of the base one I'm using in its entirety. Is there a way to extend an existing syntax (and continue to do so through updating, if possible) and just append a few new rules to it?
I've tried using extends: Packages/HTML/HTML.sublime-syntax in my own .sublime-syntax file, but I get a console error for "syntax inheritance does not allow for mixed versions" and I have no idea what that means. I don't see it mentioned in the documentation either. Help?
The Documentation on Syntax Definitions has a section on inheritance and how you do it; there a section on Limitations:
A syntax may extend a syntax that itself extends another syntax. There are no enforced limits on extending, other than that all syntaxes must share the same version.
version is a new concept in recent versions of Syntaxes; it's listed under compatibility. The general gist is that there are various things about syntaxes which are either bugs or unexpected/undesirable behaviour, but since there are so many syntaxes already available that would be broken if that behaviour was changed, the concept of version was added so that newer syntaxes can avail themselves of fixes.
As a result, as mentioned above all syntaxes must be the same version, ostensibly so that their behaviour is consistent. Syntaxes that are newly rewritten/revamped in Sublime Text 4 use the new version, and the HTML syntax is one of them.
Hence, you need to include version: 2 in your syntax to be able to extend the HTML syntax.

How can I programmatically determine Excel's list separator symbol?

Not all configurations of Excel use the same list separator symbol. In particular, it is common for Excel to use "," as the list separator in the United States and ";" as the list separator in Europe. Among other things, this affects the syntax for disjoint ranges. The same range may be formally expressed as "Sheet0!A1:B2,Sheet0!C3:D4" on one computer, but "Sheet0!A1:B2;Sheet0!C3:D4" on another computer.
I am writing code to manipulate disjoint ranges. I need to know when to use the "," syntax and when to use the ";" syntax (or, perhaps, when to use something completely different). How can I figure out what syntax to use?
Note that I'm aware that I can read the list separator from the regional settings (as described here). However, I don't want to know the regional setting per se; I want to know Excel's setting. Perhaps they are always the same, but I've seen no claim to that effect.
I'm looking for a solution for all versions of Excel, 2010 and newer. I'm using C# and Excel-DNA, but I would be grateful for a solution in any language.
You can use the property below; which returns the type of separator as a string.
Application.International(xlListSeparator)
For those of you using Windows SDK:
char buf[16];
int res=GetLocaleInfoA(LOCALE_USER_DEFAULT,LOCALE_SLIST,buf,16);
if(res<=0||16<=res){//Call failed. TODO: check GetLastError()
EXCEPT throw std::exception("Error");}
std::string listSeparator(buf,res-1);

ReSharper conflict with Stylecop over using directive order SA1210 SA1211

StyleCop 4.7 rules SA1210 and SA1211 require the using directives to be sorted alphabetically. I've run into a conflict between StyleCop's rule and Resharper's applied sort: case-sensitivity.
Resharper 8.2 performs a case insensitive sort of the directives, while StyleCop's rule requires a case sensitive sort. So, I ran into an odd case with the following directives because of poor namespace choices (not my own):
using AB.Common;
using ab.Utility;
Pressing ctrl-E-F sorts common first; but the rule requires utility to be first because of the difference between AB and ab. I've gotten past it by removing the StyleCop rule and just letting Resharper's reformat reign. Of course the namespace itself should be refactored, but I don't have that option.
Any other opinions about how to deal with this other than turning off the StyleCop rule?
Turning the StyleCop rule off seems like the best answer, there is no need for both ReSharper and StyleCop to check the ordering.
But if you want to have them both on, you could alias the namespaces to something like:
using Common=AB.Common;
using Utility=ab.Utility;

Is There Any Way To Make More Custom Naming Style For ReSharper 6?

My project have a coding convention that:
For local variables (inside methods): Use the format [prefix][variable name]
[Prefix] will be the first character of the data type if variables are of primitive type such as Integer, Byte, String...
Example:
Dim sCompanyName As String
Dim iArrayIndex As Integer
Dim bContactStatus As Boolean
Is there any way for Resharper to create custom naming rule for this case?
Thanks.
Strictly speaking, ReSharper isn't set up to handle Hungarian notation because the a la mode way of naming variables in .Net doesn't require it. Thus, if you really need to have this, you would need to implement the naming system yourself by creating a ReSharper plug-in to suppress R#'s own naming suggestion system and implement one of your own.
That said, it a very difficult, and possibly unfeasible, task.
While I totally agree with Piers on the "dated" nature of Hungarian notation, I do realize that sometimes one may get stuck maintaining legacy code or dated company standards.
It may be helpful for your to know that CodeIt.Right includes set of rules that help enforce Hungarian notation style, as well as set of rules that help to move from Hungarian notation to MS .NET conventions. And finally if you are not totally happy, you can customize existing rules or quickly develop own custom ones.

Is it possible to define custom naming conventions for resharper?

I'm using Resharper (with the StyleCop plugin, although I don't think that's relevant to the question/answer) to enforce naming conventions amongst other things in our code base. Pretty much everywhere this works brilliantly, with one exception.
For test method names I prefer the following convention:
ThingOrBehaviourUnderTest_Action_ExpectedOutcome
Currently this results in an inconsistent naming warning and to-date I've just ignored it (I know I can disable the warning in that file, but then it disables the warning for all any other naming inconsistencies). In the list of styles I can assign Resharper offers camel case, which would result in:
ThingOrBehaviourUnderTestActionExpectedOutcome
or underscore separated words:
Thing_or_behaviour_under_test_action_expected_outcome
Both are close to what I want, but not quite there. I guess I'm after a way of allowing underscores as valid characters in camel cased test method names, or a way of supporting a custom naming convention. Is this possible?
I know this question is pretty old, but ReSharper 7 now finally supports the definition of extended naming rules. Those make it possible to have separate name styles for test methods.
The AgentSmith plugin for ReSharper should meet your needs through its regex rule support.

Resources