Add option for generating tsconfig.json
joszo opened this issue · comments
I think a useful feature would adding option for generating tsconfig.json
Usually, in a new project, I create in root/cypress
folder the tsconfig.json
file with below syntax (I always copy it from the other project because I don't like to remember that kind of stuff)
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "../node_modules",
"types": [
"cypress"
]
},
"include": [
"**/*.*"
]
}
It would really improve the setup process if people like to use autocomplete in spec file easily.
@joszo
Thank you for creating issue!
Yeah, I think to resolve it with next steps:
- Command palette item to generate default
tsconfig.json
file. - Check before
Cypress: Generate Custom Command Types
iftsconfig.json
exists, and if not - prompt to create default one.
@joszo
Just published version 0.3.7
- now there is command palette item
Cypress: Create default tsconfig.json file
- after
Cypress: Generate Custom Command Types
there is prompt to create tsconfig.json file if it is not found in workspace.
I've tested your solution it generates the tsconfig.json as excepted, but I found small issue for edge case scenario:
- Open
commands.js
- Right-click -> Cypress: Generate Custom Command Types
- Types will be generated
- In the right bottom corner, there is information about missing
tscofing.json
- Click
yes
- Remove
tsconfig.json
- Right-click -> Cypress: Generate Custom Command Types
Actual result: The popup No tsconfig.json file detected, do you want to create?
is not displayed. User have to reopen the VSC, and then everything works correctly.
Expected result: Popup should appear
@joszo
That is because of way how filesystem was handled.
After extension activation whole folder was scanned and saved in memory. Only when file was deleted, extension rescanned whole folder again to avoid file read errors.
I have changed the way how filesystem is handled in v0.3.8 so this case should be fixed after you upgrade extension.
Tested on v0.3.8, the tsconfig.json
file is generated without reopening the vsc.