Closed ponienchen closed 4 years ago
Hi @ponienchen! Please specify the version of IDE and the sample of your command. I just tried 2020.2 and was unable to reproduce.
Thanks for your reply.
My ultimate version is IntelliJ IDEA 2020.2.2 (Ultimate Edition) Build #IU-202.7319.50
Sample command:
Cypress.Commands.add("login", (email, password) => {
console.log(password);
});
Type Definition in support/index.d.ts:
using the command:
cy.login('abcdefg');
The plugin's autocomplete works.
But got the warning message:
========================================
What it looks like before enabling the plugin:
Oh, it seems I'm starting to understand the problem. You have your code in a JS file, right? Some background at the plugin side: plugin make special efforts on supporting custom commands for JS tests only since in TS case, it's easy to get the definitions down and have all the code completion and navigation features done by the IDE itself. So I've actually never tried tests in JS with TS definitions. I'll look into this case. BTW, why don't you use TS everywhere?
I didn't have particular needs to use TS everywhere else, except for type definition for making auto-completion work for custom commands.
I was following this example to set up the auto-completion.
https://docs.cypress.io/guides/tooling/intelligent-code-completion.html#Set-up-in-your-Dev-Environment
https://github.com/cypress-io/cypress-example-todomvc#custom-commands
Okay, I'll probably disable direct custom command resolving in plugin in the favor of TS definitions. I'll also probably add some support to make it easier to work with the definitions file.
Thank you so much for your help!
Hi @ponienchen!
In version 1.6.1, I've added the ability to disable custom command support (as well as alias and fixture ones) via the Registry
. You can call it by Tools -> Internal Actions -> Registry
menu item:
So closing this issue now.
Than you for the update. It is working for me.
I am using intelliJ Ultimate IDE.
I have custom commands in support/commands.js and their type definitions defined in support/index.d.ts
When I enable the plugin, my test files start to complain about my custom commands: "Method Expression is not of Function type". And if I use command+B to view custom command usages, it will be excluded from the search results, making it quite inconvenient for me.
As soon as I disable the plugin, the warning is gone and everything goes back to normal. I think it is caused by the plugin's auto completion support: "Auto completion and navigation for aliases references, fixtures and custom commands (PRO version only)"
Could you please get it fixed ?