How do I get WebdriverIO autocomplete on VS Code

后端 未结 3 895
余生分开走
余生分开走 2021-01-21 09:43

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

Other code editors like Intellij provide something like Settings -> Preferences -> Languages & Fram

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-21 10:34

    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.

    All the above works fine for v4 version of WDIO.

    If you are using v5 version: Then as per their official documentation we need to create a jsconfig.json file on the root directory.

提交回复
热议问题