Comments (19)
I'll try in on my macbook here in the next hour or so and see if it's a mac quirk or something.
from yarn-completion.
@kachkaev I have no idea why this isn't working for you. I just matched all my shell options to the ones you have enabled and it still works perfectly fine on my end.
The only thing I can think of that it might still be is that you're using BSD sed. If you can confirm that the issue is still persisting even using GNU sed, then I'm out of ideas and will have to unfortunately wait until more people report this issue.
from yarn-completion.
Thanks for for your hint about GNU sed β turns out this is exactly what caused trouble! Originally, even after installing GNU bash, man sed
was starting like:
Β Β
After I did brew install gnu-sed --with-default-names
and restarted the Terminal, it changed to:
Consequently, yarn autocompletion 0.6.0 began to work! π
I'm a frequent user of the command line, but am no way an expert in bash versions and flavours of other standard tools. All this is pretty foggy to me, so thanks for your help with sorting things out! To summarise, this is what I had to do in order to get yarn-completion
on macOS High Sierra working:
brew install bash
brew install gnu-sed --with-default-names
brew install bash-completion
## + copy a few commands to ~/.bash_profile as instructed by brew after bash-completion setup
curl -L https://raw.githubusercontent.com/dsifford/yarn-completion/master/yarn-completion.bash > `brew --prefix`/etc/bash_completion.d/yarn
## restart Terminal
Hope this helps someone else in a similar situation!
from yarn-completion.
Urrrrgh! BSD utils are going to be the death of me, I swear....
Glad to hear we've found the culprit. I'll try and get this compatible with BSD as soon as feasible. Thanks for your patience.
from yarn-completion.
Version 0.6.1
should work in BSD sed now.
from yarn-completion.
Very likely.
The way the JSON is parsed out for script names is pretty archaic since the goal is to keep it portable across platforms.
Happy to take a PR on it if you feel like making the parsing with sed work better
from yarn-completion.
I'm pretty sure I won't be able to crack it in any reasonable time because my level in bash script editing in 0.01 out of 1 π
Speaking of a a simple fix, could a RegExp that searches for the end of "scripts"
look like so?
- we terminate if there is
}
and it is at the end of a line (whitespacing ignored) - we terminate if there is
},
and it is either at the start or at the end of a line (whitespacing ignored)
This still won't be as clean as parsing json in full, but the likelihood of bugs should get smaller.
from yarn-completion.
@kachkaev This should be fixed now in 0.6.0
.
from yarn-completion.
Thanks for trying to fix this @dsifford! It could be that I've done something wrong, but after updating to 0.6.0 script detection broke completely. I still see it working as it was in the pre-update terminal tabs, but in all new tabs I get:
yarn run
βtab yarn run env
yarn
βtab all standard yarn commands, no helloX commands
npm run
still shows hello1 ... hello5
as it should.
I tested 0.6.0 on a couple of real-world packages in addition to the MWE above and the problem reproduced in all cases.
What could be causing this in brew's bash 4.4.19(1)-release (x86_64-apple-darwin17.3.0) with yarn-completion 0.6.0 also installed via homebrew?
from yarn-completion.
Not sure. I tried all the examples you provided when I made the change and it worked for me.
And actually, the change I made to the sed command made it even more POSIX compliant than the earlier one (the earlier one used extended regexp).
Did you try logging out completely and logging back in to make sure you weren't using a stale file or something?
from yarn-completion.
Same behaviour even after a full reboot. Curious to know what your mac test tells you! Thanks a lot for looking into this problem π
from yarn-completion.
Thanks for checking.
Do you have a repo that has a non-parsable package.json file that I can clone when I test on my macbook? I want to be certain that I'm reproducing this correctly.
from yarn-completion.
@kachkaev Cant reproduce on my macbook.
Tried it using the package.json in this repo and it worked just fine for me: https://github.com/callthemonline/client-nextjs
from yarn-completion.
Also, I just tried it again using both GNU and BSD sed and it still worked for me.
I assume you have the default BSD sed installed on your system? Can you try installing GNU sed and see if that works?
from yarn-completion.
@kachkaev what's the output when you enter shopt -p | sort
?
from yarn-completion.
Downgrading to 0.5.1 by running
curl -L https://raw.githubusercontent.com/dsifford/yarn-completion/c40137136d8b803407f5f2fb99c1ae92af594b07/yarn-completion.bash > `brew --prefix`/etc/bash_completion.d/yarn
returns yarn-completion
to its old behaviour described in this issue (after Terminal is relaunched, of course). This means that my setup is not broken as such and it's not the case of me having using two conflicting yarn completions somehow.
Upgrading one commit up to 3b5a4d7 makes things as broken as on current master
(0.6.0
), i.e. I only see yarn run
β run yarn env
. The behaviour is the same both for https://github.com/callthemonline/client-nextjs and a dummy project where package.json
just contains hello1...5
scripts.
from yarn-completion.
Feel free to supplement README with my setup commands. I can easily imagine someone else getting into a similar trouble, so itβll be great if we can save their time!
from yarn-completion.
Open a PR with the edits and I'll be happy to merge
from yarn-completion.
Thank you! 0.6.1 worked for me even after uninstalling gnu-sed
π
from yarn-completion.
Related Issues (20)
- command not found: completions-yarn
- Feature request: support workspaces whose names do not match their directory names HOT 2
- Feature request: support workspaces run through scripts HOT 3
- use package name instead of directory basename for workspace HOT 1
- How can we plug this into our own bash autocompletions? HOT 9
- Feature request: NPM repository autocomplete HOT 1
- Colon-contained completion glitches HOT 2
- Zsh support? HOT 6
- Version number error with 1.14.0? HOT 1
- Homebrew 0.14.0 upgrade issue HOT 1
- Tests are failing HOT 4
- Workspace package completion HOT 11
- Tests fail on latest yarn HOT 1
- Add it to bashit HOT 2
- Git-Bash completions HOT 2
- installing yarn completions under .local/share/bash-completion fails HOT 1
- Targets with a : don't work correctly (special characters require escaping) HOT 12
- Yarn v2/berry support ? HOT 3
- Excellent work HOT 1
- Fix build HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yarn-completion.