Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

visual studio - Shortcuts for getting all the parameters of a blazor component

Is there a way to set up intellisense to do the following thing:

As components come with parameters, and parameters without default values will most likely be required anyway. Is there a way to just 'tab tab' and get all the unused parameters when adding a component to the page?

i.e.

Say that I have a component called "Sample" with the following params:

[Parameter] public string AAA {get;set;}
[Parameter] public string BBB{get;set;} = "HELLOHELLOW";
[Parameter] public string CCC{get;set;}

can I do <Sample></Sample> and then perhaps do 'tab tab' to make it <Sample AAA="", BBB="HELLOHELLOW", CCC=""></Sample>

Often, I have components with 4 or 5 parameters and it's both time consuming and a pain to handle them one by one...

question from:https://stackoverflow.com/questions/65546440/shortcuts-for-getting-all-the-parameters-of-a-blazor-component

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Your idea is a brand new feature for Intellisense. And so far, I only found is that code snippet.

But code snippet cannot automatically and flexibly generate the corresponding structure based on the parameters in your component file. It must be hard-coded rather than soft-coded.

Unless, you write

<Code Language="XML">
  <![CDATA[<Sample AAA="", BBB="HELLOHELLOW", CCC=""></Sample>]]>
</Code>

Obviously this is not a good method nor what you want. And there is no such function to realize this and Intellisense is not so flexible to achieve this.

So you have to suggest your idea to the Team. Suggest a feature on our DC Forum.

enter image description here

When you finish it, you can share the link here and anyone who is interested in it will vote it and it will help get more Microsoft's attention.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...