How do I get WebdriverIO autocomplete on VS Code

若如初见. 提交于 2019-12-01 23:29:10

问题


Is there a way I can get autocomplete on VS Code for webdriverio?

Other code editors like Intellij provide something like Settings -> Preferences -> Languages & Frameworks -> JavaScript -> Libraries From there we can add a directory with webdriverio commands

How can I do similar thing with VS Code?


回答1:


my understanding is, vscode is built with typescript and by default it does not support autoComplete(Intellisense) on a package that is built with javascript. So all the js package creators would provide an @types file. These @types file help vscode to find all the function definitions, object properties. etc., etc., of your JS package and show as suggestions. Which in case here is webdriverio package.

So adding a @types dependency that is related to your JS package will mostly fix the issue. i.e.,

npm install @types/webdriverio --save-dev

After adding the package, i started getting the browser object suggestions.




回答2:


Above answer worked well :

you need to install below dependency :

if you are using webdriverio v4 (for cucumber BDD ) use below 
npm install @types/webdriverio@4 --save-dev

or use :
npm install @types/webdriverio --save-dev

VSCode Intellisense



来源:https://stackoverflow.com/questions/47502115/how-do-i-get-webdriverio-autocomplete-on-vs-code

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!