admin管理员组文章数量:1356225
I would like VS Code to show auto-import suggestions even if there is an instance with the same name in the current file I'm in.
In the screenshot below, you'll see a simple dependency injection example of the issue. Notice that when the instance name is the same as the class I'm trying to import, VS Code displays the error:
'LogSvc' refers to a value, but is being used as a type here.
Instead, I would've expected this class to be auto-imported when all the other classes were auto-imported.
Additionally, when I access the quick actions on the class, the option to import the class isn't visible:
I can change the name of the instance and importing the class is then added to the quick actions and the auto-import works fine...
But I shouldn't have to (nor do I understand why) I have to do that.
本文标签: visual studio codeHow to autoimport class with same name as instanceStack Overflow
版权声明:本文标题:visual studio code - How to auto-import class with same name as instance? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743983754a2571188.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论