Open bard83 opened 2 years ago
I, too, would like this feature.
How would a reformat take care of this? Is there an option for this in omnisharp or .editorconfig? Also, do both of you know what ramifications this choice has? - https://stackoverflow.com/questions/125319/should-using-directives-be-inside-or-outside-the-namespace
Reformat would probably work. For people who don't configure a formatter to abide by their standards, it would butcher their code to be weirdly modifyable. Omnisharp settings are like walking into linux for the first time without prior knowledge. Very complex. I don't even know if they have a reformatter. I dont use them.
I do understand the ramifications. I keep it very java-like. Fully qualified usings and namespace.
How would a reformat take care of this?
TBH I didn't remember about that point. Well, I must admit that it seems pretty hard task to do and honestly not a responsibility of the formatter. Drop that.
Is there an option for this in omnisharp or .editorconfig?
Haven't found anything in both of them. Currently even though .editorconfig would have specified a configuration for it, the current templates generation won't either consider it. It will generate class/enum/interface based on the static templates, doesn't it?
Side note: .editorconfig
bothers me, even if it'd define the possibility I wouldn't use it. Why should I define .editorconfig file and then carry it over all my solo projects? I would, rather, rely on my IDE for such configuration.
Also, do both of you know what ramifications this choice has?
The request here is not about to create a configuration enabled for default, which I can image will start to create inconsistency over all the extension users. But rather opt-in the configuration for those users which have the needs to do like so. My team decided to have namespace on top of the file, means that in the next months I'll spend time to move the namespace on top of any created files first and then start to write my code...
Reformat would probably work. For people who don't configure a formatter to abide by their standards, it would butcher their code to be weirdly modifyable. Omnisharp settings are like walking into linux for the first time without prior knowledge. Very complex. I don't even know if they have a reformatter. I dont use them.
Omnisharp does provide a formatter. I do not see any option for the namespace position though: https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options I have implemented a reformat after create in branch feature/formatTemplateAfterCreate. If .editorconfig does have an option for the namespace, it could be tested with that branch. Either one of you can try if this is enough to fix your issue / feature request.
Otherwise, this could be implemented by having 2 replacement variables in the templates, or by simply placing the namespace at the beginning of the file. I'd rather have this functionality by using an existing tool.
Current behavior namespace in class/interface/struct etc... always appears after using block.
Expected behavior The name space position should be configurable to be either after the using block for default or when the configuration flag is ticked on top of the class: e.g.
Default position:
When option is enabled:
Reformat feature should take care about the new configuration property.