Skip to content

add jsconfig section #2054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .textlintrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"Sinon–Chai",
"TypeScript",
"YouTube",
["VSCode", "VS Code"],
["^Vue", "Vue.JS"],
"webpack",
["WebSocket(s?)", "WebSocket$1"],
Expand Down
15 changes: 15 additions & 0 deletions source/guides/tooling/intelligent-code-completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ See the {% url `cypress-example-todomvc` https://github.com/cypress-io/cypress-e

If the triple slash directive does not work, please refer to your code editor in {% url "TypeScript's Editor Support doc" https://github.com/Microsoft/TypeScript/wiki/TypeScript-Editor-Support %} and follow the instructions for your IDE to get {% url "TypeScript support" typescript-support %} and intelligent code completion configured in your developer environment first. TypeScript support is built in for {% url "Visual Studio Code" https://code.visualstudio.com/ %}, {% url "Visual Studio" https://www.visualstudio.com/ %}, and {% url "WebStorm" https://www.jetbrains.com/webstorm/ %} - all other editors require extra setup.

### Reference type declarations via `jsconfig`

Instead of adding triple slash directives to each JavaScript spec file, some IDEs (like VS Code) understand a common `jsconfig.json` file in the root of the project. In that file, you can include the Cypress module and your test folders.

```json
{
"include": [
"./node_modules/cypress",
"cypress/**/*.js"
]
}
```

The Intelligent Code Completion should now show help for `cy` commands inside regular JavaScript spec files.

### Reference type declarations via `tsconfig`

Adding a {% url "`tsconfig.json`" http://www.typescriptlang.org/docs/handbook/tsconfig-json.html %} inside your {% url "`cypress` folder" writing-and-organizing-tests#Folder-Structure %} with the following configuration should get intelligent code completion working.
Expand Down