Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.

Conversation

akinsho
Copy link
Member

@akinsho akinsho commented Jun 26, 2018

This PR fixes #2348, rather than always using the default prettier bundled with the plugin it uses the local prettier version and falls back to the bundled one if a local installation isn't present also.

All credit to the prettier-vscode plugin I basically fully borrowed their implementation.

@codecov
Copy link

codecov bot commented Jun 26, 2018

Codecov Report

Merging #2360 into master will increase coverage by 0.42%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2360      +/-   ##
==========================================
+ Coverage   37.65%   38.07%   +0.42%     
==========================================
  Files         300      300              
  Lines       12483    12508      +25     
  Branches     1643     1645       +2     
==========================================
+ Hits         4701     4763      +62     
+ Misses       7533     7491      -42     
- Partials      249      254       +5
Impacted Files Coverage Δ
...src/Services/Configuration/DefaultConfiguration.ts 87.5% <0%> (ø) ⬆️
browser/src/Services/Language/PromiseQueue.ts 25% <0%> (+8.33%) ⬆️
browser/src/Editor/BufferManager.ts 35.13% <0%> (+26.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 74a4dc7...46860df. Read the comment docs.

@bryphe
Copy link
Member

bryphe commented Jun 30, 2018

Awesome! Makes sense to use local prettier if it's available - looks good to me 👍

@akinsho akinsho merged commit 3c05476 into onivim:master Jun 30, 2018
@akinsho akinsho deleted the feature/use-local-prettier branch June 30, 2018 17:23
@badosu
Copy link
Collaborator

badosu commented Jul 2, 2018

@akin909 Does this fix #2255 ?

@akinsho
Copy link
Member Author

akinsho commented Jul 2, 2018

@badosu I basically took the opportunity to just remove the background color prop on the prettier status item and the foreground should just be white I believe so hopefully this solves that

@CrossR
Copy link
Member

CrossR commented Jul 2, 2018

Since this has been merged (or I'm assuming its due to this PR?) I get this when launching Oni with the workspace having a package.json

image

Is that a known issue?

@akinsho
Copy link
Member Author

akinsho commented Jul 2, 2018

@CrossR I imagine its just a project without prettier, I haven't seen it before but its likely due to this I'll have a look after work I've used a build with this PR in in a project without prettier and haven't encountered it could you share the package json? probably the function I borrowed throws an error at some point.

EDIT: actually all errors seem to be caught in a try catch so not sure where that is coming from, is there a stack trace

@CrossR
Copy link
Member

CrossR commented Jul 2, 2018

image

It happens for me in Oni as well, at least on a machine that doesn't have Oni's node_modules downloaded etc.

@akinsho
Copy link
Member Author

akinsho commented Jul 2, 2018

Ahh in which case is prettier specified in the package.json but not available in the node modules?

@CrossR
Copy link
Member

CrossR commented Jul 2, 2018

Ah! Yep, my dev machine with Oni on and node_modules downloaded this works fine, but for my local machine prettier is specified but not available.

@akinsho akinsho restored the feature/use-local-prettier branch October 1, 2018 09:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prettier plugin should prioritize project or global prettier installation over the plugins
4 participants