Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get protractor or json intellisense in vscode

How to get protractor intelisense into visual studio code, When I enter browser., I am not getting all available methods related protractor browser object. but when I manually type the methods, it runs fine. I have installed all required packages (package.json)as shown below

"devDependencies": {
    "@types/node": "^8.0.47",
    "astrolabe": "0.3.6",
    "exceljs": "^0.2.3",
    "jasmine-allure-reporter": "^0.2.3",
    "jasmine-reporters": "2.0.0",
    "protractor": "~2.2.0",
    "selenium-webdriver": "^2.47.1",
    "winston": "1.0.1"
  },
  "dependencies": {
    "path": "^0.12.7",
    "promise": "^7.0.4"
  }

Even installed one vscode extension "protractor snippets", but no luck... Need some guidelines or any specific steps I need to follow to get the protractor intelisense into vscode. same issue with json parsing...

like image 359
sunpat Avatar asked Nov 07 '22 14:11

sunpat


1 Answers

I had to create a global.t.ds file in order to decorate the protector global variables with intellisense:

import { ProtractorBrowser, Config, PluginConfig, ProtractorPlugin, Ptor, ElementFinder, ElementArrayFinder, ElementHelper, ProtractorBy, ProtractorExpectedConditions, ProtractorBrowser, firefox, http, remote } from '../node_modules/protractor/built/index';

declare global {
    let browser: ProtractorBrowser;
    let protractor: Ptor;
    let Command: any;
    let CommandName: any;
    let protractor: Ptor;
    let browser: ProtractorBrowser;
    let $: (search: string) => ElementFinder;
    let $$: (search: string) => ElementArrayFinder;
    let element: ElementHelper;
    let By: ProtractorBy;
    let by: ProtractorBy;
    let ExpectedConditions: ProtractorExpectedConditions;
    type PluginConfig = PluginConfig;
    type ProtractorPlugin = ProtractorPlugin;
    let utils: {
        firefox: any;
        http: any;
        remote: any;
    };
}

https://bitbucket.org/krewmarco/protractor-vscode-intellisense/src/master/

intellisense on browser object

like image 165
krewmarco Avatar answered Nov 15 '22 06:11

krewmarco