-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
No environnement name suggestion for Environnement.GetEnvironmentVariable() #55587
Comments
@CyrusNajmabadi did we recently add this? |
No, we did not. But a third party coudl by adding a completion provider for this. |
It seems like we could also add a string completion feature similar to how |
Design review conclusion: initially implement this by adding a completion provider for the string passed to In the future, specific sub-proposals could be created to expand this list with support for well-defined buckets of items (e.g. well-known preprocessor directives in Azure Pipelines if the current project is known to use Azure Pipelines as a CI provider). |
Where should such a provider be integrated intoThere are at least three places, where such a provider could be integrated into: EmbeddedLanguageCompletionProviderThis approach is used by the DateAndTimeEmbeddedCompletionProvider which does this suggestion: InternalsVisibleToCompletionProviderThis one completes ArgumentProviderThis isn't a completion provider and only seems to be able to suggest a single value. DefaultArgumentProvider is one of the derived types of this provider. What other argument value suggestions should be consideredIt seems reasonable to me to create a base class for argument values suggestions, because there are other .Net types in the BCL that would benefit from such a completion:
There are a lot of parameters, with types beyond strings, where argument values can be suggested:
What should the provider look likeI like the idea of the I would create a base class (e.g. A derived provider like a Another derived provider could be @sharwell and @CyrusNajmabadi What do you think about the proposal? |
The proposal seems like an interesting place to start. Note that static properties (e.g. I'm not sure we need to be specific to arguments in the new provider. For example, setting a property value is very similar to passing an argument. Perhaps we call it a symbol value completion provider, and in the first round we only trigger it for arguments (associated with a parameter symbol). |
I wasn't aware of #52163, but it solves 90% of the use cases I had in mind. It is also unclear, whether Roslyn should provide specialized suggestions for argument values. It is probably better to allow library authors to provide such suggestions, like they can provide diagnostics with analyzers (A nice use case are the matchers in FakeItEasy https://fakeiteasy.readthedocs.io/en/stable/argument-constraints/#other-matchers A custom provider could suggest String arguments are different, though. @CyrusNajmabadi created the EmbeddedLanguageCompletionProvider for such cases, and I'm not sure whether this one is extendable by library authors. Are there any plans to open up Roslyn for library authors to extend completion in any of these places? If yes, suggestions for |
Closing out as this could be handled by an externla completoin provider. We are unlikely to add support for it ourselves. |
This issue has been moved from a ticket on Developer Community.
When calling Environment.GetEnvironmentVariable the first parameter is the environnement name variable to be retrived.
It would be nice to have a list of predefined and well know environnement (here like ASPNETCORE_ENVIRONMENT or any Windows/Linux standard environnement variable) variable name as an IntelliSense suggestion
Original Comments
Feedback Bot on 7/19/2021, 08:07 PM:
Thank you for taking the time to provide your suggestion. We will do some preliminary checks to make sure we can proceed further. We'll provide an update once the issue has been triaged by the product team.
Mika Dumont [MSFT] on 7/30/2021, 09:12 AM:
Thanks for taking the time to provide this feedback! In 16.10 Preview 2 we added a completion option that automatically inserts arguments when writing a method call. This feature is off by default so you will need to enable it in Tools > Options > Text Editor > C# > IntelliSense and select Tab twice to insert arguments (experimental). Start writing a method call and press tab twice (tab+tab).The method call should includes arguments based on the method’s default values. You can then use parameter info to cycle through the list of arguments that you would like inserted by pressing the up and down arrow keys. Let me know if this works for your scenario.
Why do we ask for more info?
We try to reproduce all issues reported with the information provided in the description and comments. When we can’t reproduce the issue, we ask you for more information so we can resolve the issue as quickly and efficiently as possible.
In our guidelines, you can get tips on how to provide clear and simple reproducible steps.
jeremie.leclercq on 8/2/2021, 00:48 AM:
Tried the mentionne option, how over is not adressing the initial suggestion.
Indeed the Environment.GetEnvironnementVariable has a single string parameter and is NOT optional (so no default value) :
I guess the proper way to adress is to create an enum at .Net level and to modify the method signature
=> Method Environment.GetFolderPath() is working this way
The text was updated successfully, but these errors were encountered: