Skip to content

Add open code fix to place statements at the top of the file by default? #5737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #15408
cartermp opened this issue Oct 5, 2018 · 3 comments
Closed
Tracked by #15408
Labels
Area-LangService-API Area-LangService-CodeFixes Code fixes associated with diagnostics
Milestone

Comments

@cartermp
Copy link
Contributor

cartermp commented Oct 5, 2018

Currently, the add open code fixer will place an open statement at the top of the containing scope you are working in. There is a setting to place the statement at the top of the file. The tradeoff is thus:

At top Not at top
Benefit Can use symbols from that namesspace anywhere else in the file Separates namespaces by scope (e.g., module), which some people may prefer
Drawback Could be seen as polluting the top of the file Cannot access that namespace outside of the scope it was opened in

So I think the root question is, do people generally prefer open statements at the top of a file, or would they prefer tooling to always try to hide them in the scope in which the symbol was used?

@saul
Copy link
Contributor

saul commented Oct 5, 2018

This is the only setting that I change every time I install VS - 100% yes from me 👍

@cartermp
Copy link
Contributor Author

cartermp commented Oct 7, 2018

The change of the default has been merged and is in the nightly feed. We have a lot of runway between now and VS 2019 RTW to collect any feedback. I'll leave this issue open until then.

@abelbraaksma
Copy link
Contributor

I'd prefer that the open is placed at its nearest neighbor, in the top of top of the file. That way, people that have their opens similar to csharp, I.e system on top, and alphabetical, don't have to edit manually each time this fix is applied.

@cartermp cartermp closed this as completed Feb 2, 2019
@psfinaki psfinaki added the Area-LangService-CodeFixes Code fixes associated with diagnostics label Jun 15, 2023
@psfinaki psfinaki mentioned this issue Jun 15, 2023
85 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-API Area-LangService-CodeFixes Code fixes associated with diagnostics
Projects
None yet
Development

No branches or pull requests

4 participants