Is it possible to configure the order of items in the directives section in a razor file while performing code cleanup?

Hello,

Basically, as the title says, I just want to configure how ReSharper "optimizes usings" in a razor file (Blazor). Current behaviour is shown on the screenshots below. This functionality is enabled only when "optimize usings" is enabled for C#. I like this feature and I don't want to disable it. I just don't like the order :)

Before:

After:


Is it even possible in the current version of ReSharper?

Thanks in advance,
Krystian

0
6 comments

Hello Krystian,

 

Unfortunately, there's no option to disable code cleanup for some specific file type, we have a feature request for that - Define Code cleanup profiles for files or exclude some files from cleanup. Please feel free to comment or vote for it.

As a workaround you may enable Code Cleanup on save, which allows to configure for which files it's applied.

Let me know if you have any more questions.

0

Hello Angelina,

I don't want to disable code cleanup here. I want to be able to configure the order of elements in the directives section, as shown in the screenshots. Any idea how does ReSharper determine the order? Why is the @inject before usings and @implements after usings?

Thank you for your time,
Krystian

0

Hello Krystian,

 

Sorry for the delay in responding.

This is a way Optimize usings work: we clear all usings and then add them, first inject. then usings etc.

I've filed a corresponding feature request - Configure way how we add usings when Optimize usings is applied. Please feel free to comment or vote for it.

0

Hello Angelina,

Thank you. I will vote for it, but the link doesn't seem to work. Could you please take a look at it? :)

Best Regards,
Krystian

0

Thank you, I've also updated the link. Sorry for the inconvenience.

0

Please sign in to leave a comment.