Rayrun
← Back to Discord Forum

Code autocomplete in VSCode using JS

whatever_1
whatever_1

For some reason my code does not autocomplete with some of the PW methods, can anyone tell me how can I fix that? I have installed PW manually on my Mac machine and have installed PW extension for VSCode but still nothing. Code autocomplete is turned on in VSCode settings.

This thread is trying to answer question "How can I fix the code autocomplete issue with some PW methods in VSCode?"

12 replies
whatever_1
whatever_1

I am new to PW and it would be really helpful for me to have autocomplete turned on so that I can learn all the methods, I know I can read the docs everytime but it takes a bit more time.

refactoreric

Hi, how do your test files/source files look? Do they have the right (.ts or .js) extension? Do you import or require the @playwright/test module?

All the test files end with spec.js, all the page objects with .js and i do import @playwright/test module

the odd thing is that when i write expect() the methods do appear

but for example .locator() does not

pressing command+I (ctrl+space for win) only shows me default js methods

How does your tsconfig look like if you have any?

unfortunately currently i dont have access to that machine and the code is not on github, ill check on monday

(my guess is that tsconfig or jsconfig does not include node_modules aka. playwright typings)

whatever_1
whatever_1
@mxschmitt: I will check it tomorrow

I will check it tomorrow

whatever_1
whatever_1
@mxschmitt: do you mean playwright.config.js?

do you mean playwright.config.js?

I mean jsconfig/tsconfig if you have any. These influence how Typings behave inside VSCode.

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.