90poe / vscode-cy-helper

VS Code IDE Extension for Cypress.io
https://marketplace.visualstudio.com/items?itemName=Shelex.vscode-cy-helper
Apache License 2.0
18 stars 8 forks source link

'command <> not found' is displayed when I try to go to custom command definition #9

Closed perochowa closed 4 years ago

perochowa commented 5 years ago

Hi! I would very much like to be able to utilize the 'Go to Custom Command Definition' option but I can't seem to get it to work.

After installing it, I get the error in the picture. I've tried uninstalling/installing it multiple times and even tried older versions but I get the same error.

Would you know what else I can try? Thanks in advance!

image

Shelex commented 5 years ago

Have posted update v0.2.9 where fixed issue with extension activation when cypress is used without cucumber - could you please install it and verify commands are now available?

In case issue still exist could you please provide information about:

Maximus1285 commented 4 years ago

I just installed this extension on my VS Code and I got the same issue: Custom command not found

Shelex commented 4 years ago

@Maximus1285 So, let me explain where Custom command not found is thrown:

  1. In case it was not able to recognize any custom command on current line in opened file
  2. In case it was not able to recognize custom command closest to cursor position
  3. In case it was not able to find where command definition is located

So could you please provide info about:

  1. Line where you are experiencing error, maybe it cannot recognize commands somehow.
  2. Just to be sure - is command created with Cypress command api: Cypress.Commands.add('command', () => {})?
  3. Custom command folder path is defined as concatenation of ${workspaceRoot}/${customCommandsFolderConfiguration} For example: workspaceRoot = "/Users/Shelex/repos/vscode-cy-helper" customCommandsFolder = "cypress/support" It will look for your custom commands created in /Users/Shelex/repos/vscode-cy-helper/cypress/support folder. So questions:
    • what value is in cypressHelper.customCommandsFolder extension config?
    • is cypress folder located right in workspace?

Thank you!

Maximus1285 commented 4 years ago

@Shelex Here's the info you requested:

  1. I'm not quite sure to understand what you need when you ask for Line where you are experiencing error
  2. That's exactly how I'm creating my custom cypress command, using Cypress.Commands.add('command', () => {})
  3. The custom commands are located in cypress/support/commands.js
Shelex commented 4 years ago

@Maximus1285 Thank you for response!

I'm not quite sure to understand what you need when you ask for Line where you are experiencing error.

I mean text located on line where you are calling 'go to custom command definition'. For example: cy.command1().command2().then(()=>

is cypress folder located right in workspace? I don't understand what you mean by this question

You have current open folder in vscode. Example: /Users/Shelex/repos/vscode-cy-helper And is cypress located in cypress folder right in opened project or you have nested structure? Example of nested structure: Opened project: /Users/Shelex/repos/vscode-cy-helper Cypress folder: testing/e2e/cypress

Maximus1285 commented 4 years ago

@Shelex thank you for your clarification!

I mean text located on line where you are calling 'go to custom command definition'.

The line where I experience the issue is cy.visitPage(urls.investigation);

And yes, cypress folder is located right in workspace

Shelex commented 4 years ago

@Maximus1285 Hmm, weird. Checked it on: MacOS 10.14.6 & VS Code: 1.40.1 Fresh-installed plugin with basic repo: https://github.com/Shelex/cypress_basic With exact line in test you have mentioned and default cypress setup. And extension works well.

Could you please also try example repo and how extension work there?

Maximus1285 commented 4 years ago

@Shelex I just tested it using cypress_basic repo and it still didn't work Watch this video custome_command_not_found

Shelex commented 4 years ago

@Maximus1285 Thanks! And is there any error trace in View => Terminal => Output tab => Select 'Log (Extension Host)' ?

Maximus1285 commented 4 years ago

@Shelex No, nothing shows up in View => Terminal => Output tab

Shelex commented 4 years ago

@Maximus1285 Okay, another idea is to check other extensions if they manipulate configuration or file system. Could you please provide list of your installed extensions?

Shelex commented 4 years ago

@Maximus1285 By the way, upgraded extension to 0.3.2 with fix for global dependencies issue for one of my colleagues. As it looks similar to yours (unable to open custom command definition) could you please upgrade to v0.3.2 and check if your issue still reproduces.

joszo commented 4 years ago

I've also struggling some problems with go custom command definition

There is also problem w generating types definition, because command is not found. It worked on my project only once...

Tested on version v.0.3.5

Shelex commented 4 years ago

@joszo

joszo commented 4 years ago

@Shelex

do you have specific folder for integration files or custom commands on cypress.json?

The structure for my project is like the default one from cypress.

I've created package.json

{
    "devDependencies": {
        "cypress": "3.7.0",
        "cypress-xpath": "1.4.0"
    }
}

Then npm i and next npx cypress open - the default structure was created. After that I've delete example folder, and added my test.spec.js in integration folder.

Are commands created with Cypress.Commands.add?

Yes in commands.js : Cypress.Commands.add('visitGoogle', () => { cy.visit('https://google.com') })

`Cypress.Commands.add("visitGoogle", () => { cy.visit('https://google.com') })

I've tried with one quote and double quotes.

Could you please provide text of line where you are calling go to definition?

What do you mean by that?

Could you please check if extension is working for some basic setup?

I will check it tomorrow :)

joszo commented 4 years ago

Probably I found a clue - when I disabled all my extensions, and enable Cypress helper than go to definition and generated types started to work. If you want I can share you my extensions which I have installed.

Shelex commented 4 years ago

@joszo yes, please.

joszo commented 4 years ago

Hmm strange, I've deleted some of unused extensions, then I started to enabling all extensions and for now everything is working.

I will monitor it - maybe process from another extensions blocked it...

Shelex commented 4 years ago

@joszo Anyway, could you please provide your installed extensions list. You can do it by executing command on binary of vscode: MacOs : "/Users/shelex/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" --list-extensions Windows: "c:\Program Files\Microsoft VS Code\bin\" --list-extensions

joszo commented 4 years ago

andrew-codes.cypress-snippets
angelomollame.conflict-squeezer
CoenraadS.bracket-pair-colorizer
dracula-theme.theme-dracula
esbenp.prettier-vscode
k--kato.intellij-idea-keybindings
paulhoughton.vscode-jscpd
PKief.material-icon-theme
remimarsal.prettier-now
rexebin.dracula
ritwickdey.LiveServer
shd101wyy.markdown-preview-enhanced
Shelex.vscode-cy-helper
streetsidesoftware.code-spell-checker
waderyan.gitblame
WallabyJs.quokka-vscode
wayou.vscode-todo-highlight
Shelex commented 4 years ago

For a months was checking extension behaviour with all listed above installed and found nothing strange. Btw, there is a bunch of issues reported to VS Code (https://github.com/microsoft/vscode/issues/80165, https://github.com/microsoft/vscode/issues/79782) regarding ActivationHost failures on startup. As I see it is similar to experiences we had here. Closing this issue for now. Feel free to reopen in case you have issue of such kind.

FFdhorkin commented 4 years ago

I'm having the same issue. I get this error when i tell it to go to definition... or when I tell it to generate type info. I've tried disabling all of my other extensions and the other things mentioned in this issue, no luck. (It's possible my problem is because I'm using commands.ts and not commands.js, though?)

Shelex commented 4 years ago

I'm having the same issue. I get this error when i tell it to go to definition... or when I tell it to generate type info. I've tried disabling all of my other extensions and the other things mentioned in this issue, no luck. (It's possible my problem is because I'm using commands.ts and not commands.js, though?)

Hey @FFdhorkin ! Sorry for late reply. You are right - extension even don't check typescript files. However, since cypress 4.4.0 typescript works out-of-box so I will consider adding support for ts too.

Shelex commented 4 years ago

@FFdhorkin In extension version 0.6.0 typescript support was added.

FFdhorkin commented 4 years ago

Cool, thanks for making sure I saw!