Skip to content
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

yo completion unreliable #21

Open
binduwavell opened this issue May 17, 2016 · 6 comments
Open

yo completion unreliable #21

binduwavell opened this issue May 17, 2016 · 6 comments

Comments

@binduwavell
Copy link
Collaborator

I have yo 1.8.1 installed with completions installed in zsh and bash. The following results are the same for both zsh and bash.

I type 'yo ' and hit tab. I hope to receive flags and generators. Mostly I receive nothing. At some point if I keep pressing tab I may receive flags for yo (like --generators, --help and then\[object Object\]). If I accidentally hit tab again that goes away and I have nothing... I don't know if there is a timeout issue or something else...

I have never gotten the autocompletion to return generators or sub-generators

I have the following generators installed:

generator-generator
generator-nm
binduwavell/generator-alfresco

The first two are installed normally with npm, the last is local and I have run npm install and npm link to get it "installed". I did try unlinking this and had the same results.

@binduwavell
Copy link
Collaborator Author

Not sure if it helps, I enabled TABTAB_DEBUG per the docs and noticed data being written to a cache.json file. I deleted that file and performed a couple completions yo alf<tab> returned no results. yo <tab> returned the regular flags for yo and that weird \[object Object\] thing. Here is the resulting cache.json:

{
  "timestamp": 1463446897140,
  "cache": {
    "yo alf": {
      "timestamp": 1463446886324,
      "value": [
        "-f",
        "--force",
        "--version",
        "--no-color",
        "--no-insight",
        "--insight",
        "--generators"
      ]
    },
    "yo ": {
      "timestamp": 1463446897139,
      "value": [
        {
          "name": "--force",
          "description": "Overwrite files that already exist"
        },
        {
          "name": "--version",
          "description": "Print version"
        },
        {
          "name": "--no-color",
          "description": "Disable colors"
        },
        {
          "name": "-f",
          "description": "Overwrite files that already exist"
        }
      ]
    }
  }
}

@binduwavell
Copy link
Collaborator Author

I did not notice anything else interesting in the debug output, here is a snippet of the file:

Received -f,--force,--version,--no-color,--no-insight,--insight,--generators
Emit evt: alfre
Emit evt: yo
Received -f,--force,--version,--no-color,--no-insight,--insight,--generators
Emit evt: alfres
Emit evt: yo
Received -f,--force,--version,--no-color,--no-insight,--insight,--generators
Emit evt: alfresco
Emit evt: yo
Received [object Object],[object Object]
Received -f,--force,--version,--no-color,--no-insight,--insight,--generators
Emit evt: alfresco
Emit evt: yo
Received [object Object],[object Object]
Received -f,--force,--version,--no-color,--no-insight,--insight,--generators
Emit evt: alfresco:amp
Emit evt: yo
Received -f,--force,--version,--no-color,--no-insight,--insight,--generators
Emit evt: alfresco:amp
Emit evt: alfresco:amp
Emit evt: yo
Received [object Object],[object Object],[object Object],[object Object]
Zsh shell detected
Installing completion script to stdout directory
Received -f,--force,--version,--no-color,--no-insight,--insight,--generators
Emit evt: yo

@mklabs
Copy link
Owner

mklabs commented May 18, 2016

Thanks a lot for your feedback.

The cache file seems correct, initially I suspected an issue there but seems fine.

I think this is due to generators namespace (the alfresco:amp), and zsh maybe understanding it as a description.

The fish shell script handles it with that node eval (https://github.com/mklabs/node-tabtab/blob/master/scripts/fish.sh#L8), I think we need to update zsh / bash scirpts to do the same.

Will test it further and keep you posted.

@mklabs
Copy link
Owner

mklabs commented May 19, 2016

Making good progress @binduwavell

The issue with

Received [object Object],[object Object],[object Object],[object Object]

in the debug output is related to the logger. I added a commit that JSON.stringify every non string argument.

I reworked the zsh script to use _describe method to try to fix #19

@Physium
Copy link

Physium commented May 23, 2016

glad to see a similar issue here (am on OSX, EL Captian with Bash) and its in process of being fix!

Not sure if this is the right place to post this but I would just like to check if does npm uninstall -g yo automatically uninstall and remove the completion bash script path from .bashrc?

@mklabs
Copy link
Owner

mklabs commented May 23, 2016

does npm uninstall -g yo automatically uninstall and remove the completion bash script path from .bashrc

Not not yet, that's however what the yeoman/yo#442 PR is aiming to do.

For now, you'd need to manually remove these lines from your ~/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants