vim-prettier icon indicating copy to clipboard operation
vim-prettier copied to clipboard

Bug: correctly formatting on `<Leader>p`, incorrectly formatting on save

Open n-xlkt opened this issue 6 years ago • 2 comments

Do you want to request a feature or report a bug? Bug

What is the current/expected behavior? current behavior: respecting let g:prettier#config#semi = 'false' on <Leader>p, but not on file save expected behavior: same behavior on <Leader> p and file save

What version of vim-prettier are you using - (output of :PrettierVersion) ? 1.0.0-alpha

What version of prettier are you using - (output of :PrettierCliVersion) ? 1.16.4^@

What is your prettier executable path - (output of :PrettierCliPath) ? ../client/node_modules/.bin/prettier

Did this work in previous versions of vim-prettier and/or prettier ? Not sure

n-xlkt avatar Sep 16 '19 18:09 n-xlkt

Hi @n-xlkt ,

Thanks for reporting this issue, just to make sure i understood.

  • When using <Leader> p you get the formatting as you expected
  • When saving a file the auto formatting is not matching the one from <Leader> p ?

Can you provide a minimal sample code for me to reproduce and look into it ?

thanks a lot!

mitermayer avatar Sep 18 '19 17:09 mitermayer

For sure! Hope this clarifies.

original sample:

import React, { Component, Fragment } from "react"
import { Row, Col } from 'react-bootstrap'
import { Link } from 'react-router-dom'

const overdueReview = {
  color: '#F15B4E'
}

using <Leader> p:

import React, { Component, Fragment } from 'react'
import { Row, Col } from 'react-bootstrap'
import { Link } from 'react-router-dom'

const overdueReview = {
  color: '#F15B4E'
}

using :w:

import React, { Component, Fragment } from "react";
import { Row, Col } from "react-bootstrap";
import { Link } from "react-router-dom";

const overdueReview = {
  color: "#F15B4E"
};

here's pertinent samples from my dots:

" ale linting events
let b:ale_fixers = ['prettier']
let g:ale_fix_on_save = 1
let g:ale_sign_error = '❌'
let g:ale_sign_warning = '⚠️'

" prettier
let g:prettier#config#print_width = 100
let g:prettier#config#semi = 'false'
let g:prettier#config#trailing_comma = 'none'
let g:prettier#config#single_quote = 'true'```

n-xlkt avatar Sep 18 '19 18:09 n-xlkt