mklabs / yarn-completions Goto Github PK
View Code? Open in Web Editor NEWCompletion handler for Yarn
Completion handler for Yarn
Installed, worked as expected for the most part.
Scripts like test
work fine. Scripts like test:unit
or test:integration
don't appear at all.
I tried with the latest version and checked out master, it didn't work either.
Commands like "app:serve" are seen as "command:description for command" by TabTab.
Escaping ":" in the commands should fix the problem.
Upon install with yarn global add yarn-completions
I get the following written in my .zshrc
[[ -f /Users/martin/.npm-packages/lib/node_modules/yarn-completions/node_modules/tabtab/.completions/yarn.zsh ]] && . /Users/martin/.npm-packages/lib/node_modules/yarn-completions/node_modules/tabtab/.completions/yarn.zsh
However when I type in terminal "yarn " and hit tab I get the following:
yarn _yarn_completion:4: command not found: completions-yarn _yarn_completion:4: command not found: completions-yarn _yarn_completion:4: command not found: completions-yarn yarn
If I have this alias alias y='yarn'
Is it possible to type y and press tab and still get completions?
Thank you for any help.
After npm or yarn install of yarn-completions, /usr/bin/completions-yarn points to /usr/lib/node_modules/yarn-completions, which is not there.
It works after:
sudo ln -fs ~/.yarn-config/global/node_modules/yarn-completions/bin/yarn-completions.js /usr/bin/completions-yarn
Hi @Matmo10
I thought about adding an issue here to maybe help you get yarn-completions work on your system. I hope you'll get this notification :)
Based on that comment: yarnpkg/yarn#609 (comment)
I installed yarn-completions - didn't work. Realized it's actually some kind of plugin for tabtab, so I installed that. Still doesn't work. Re-sourced my bash profile. Still doesn't work. Is there really more configuration required?
How did you install yarn-completions ? You don't need to install tabtab separately, this is included in yarn-completions itself.
Normally, you just need to install yarn-completions with npm globally.
npm install yarn-completions -g
What do you use for your shell ? Bash, zsh or fish ? If you use bash, you should see a line specific to tabtab, at the end of your ~/.bashrc
, that loads a shell specific script for your system and enable the completion mechanism for the command yarn
.
I am using zsh and upon install, this was inserted into my zshrc
:
[[ -f path ]] && . path
However, spaces in the path were not escaped, so it errored.
Perhaps it should become:
[[ -f "path" ]] && . "path"
The command yarn upgrade-interactive
does not tab-complete with this plugin.
The yarn cache folder is hardcoded to ~/.yarn-cache, but on OS X, yarn defaults the cache to ~/Library/Caches/Yarn.
You can obtain the cache folder by running yarn cache dir
. There's no ~/Library/Caches/Yarn/.link either - I have no idea how yarn does links on OS/X.
After installing globally using:
npm i -g yarn-completions
then typing yarn + tab shows:
yarn module.js:457
throw err;
^
Error: Cannot find module '../src/cli'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/adcaballero/.nvm/v6.6.0/lib/node_modules/yarn-completions/bin/yarn-completions.js:3:1)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
module.js:457
throw err;
^
yarn add [tab key]
yields the following error:
throw err;
^
Error: Cannot find module 'got'
at Function.Module._resolveFilename (module.js:472:15)
at Function.Module._load (module.js:420:25)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/samhh/.yarn-config/global/node_modules/yarn-completions/src/completions/add.js:3:11)
at Module._compile (module.js:573:32)
at Object.Module._extensions..js (module.js:582:10)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
Do I need to enable ZSH to use this?
If package.json contains
"scripts": {
"build": "..."
"build:watch": "...",
then "build:watch" i not offered for tab-completion.
There is no ~/.config/yarn/global/node_modules/tabtab/.completions/yarn.zsh
after installation.
yarn add create-<tab>
=> list of completion results from registry
Have to rely on external search services similar to npmsearch or npmsio. Most of the results should be cached in some way.
Tested in numerous times, but never ended up with results that felt fast / robust enough to publish it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.