Closed fdinardo closed 7 years ago
I have figured it out.
Inside this file declarationInfo.ts the method getProperties
uses a RegExp
to split the property line definition by fields. This RegExp doesn't matches two common scenarios:
a. public virtual Person _Person
b. public int? Size
Since the item.type
and item.name
are initialized to results[1]
and results[2]
respectively, the scenario a makes to match Virtual
as type and Person
as name.
For the scenario b is different: the ?
is a special char so the regexp doesn't match at all.
The fix is easy: we could replace this line:
let propRegExp = /public\s(\w*<?\w+>?)\s(\w+)/g;
to
let propRegExp = /public\s(?:virtual\s)?(\w*<?\w+>?\??)\s(\w+)/g;
here we can test the regexp: newRegExp
For the scenario b the new regExp works great because it shows the ?
as well, which notify the developer that this field is <Nullable>
I'm really sorry to not be able to make this change by myself. I tried to clone the project and run it in debug mode, but I'm not able to achieve this.
I'm so sorry.
p.s. If someone can help me to get it done I will appreciate. I really love this plugin, I think it's a shame for Microsoft to not fully support Razors and tag-helpers with visual studio code. I have a lot of problem formatting razor file as well.
Finally, I made a pull request #12 I hope this will be merged.
Hey :) I merged the pull request.
Hi! Thanks for this amazing plugin. Intellisense is able to show only some of the Model's properties. I think I get the reason, but i don't know how to fix. An example will get us on the right path: Model:
In the Html document if I use
@Model.ID
everything is fine. If I use@Model.MyOtherModel
I get an error. I think the reason for this is related to the number of words in the property declaration. The intellisense shows me thatOtherModel
is the name - which actually is the type- of the property andvirtual
is the type -which is not the type-. It seems that it splits the line and takes always the "second" word as the property's type and the third one as the Property's Name.I don't think this issue is related to the plugins, os or visual studio core versions, but if they are needed let me know. Thanks.