GithubHelp home page GithubHelp logo

Comments (10)

zoontek avatar zoontek commented on June 5, 2024 1

No need, I found one: prettier/prettier#770

from prettier-vscode.

CiGit avatar CiGit commented on June 5, 2024

There is currently no option to disable it for some file pattern.

The extension does not run on JSON language, it runs on javascript and javascriptreact as specified here
Prettier throws an error on JSON object files and thus, the extension shouldn't do anything (a log in the developer tool)

Is this issue about JSON betting prettified or about a feature request?

from prettier-vscode.

zoontek avatar zoontek commented on June 5, 2024

It performs on JSON and sometimes on certain JS files, by removing empty lines breaks, which is super annoying :(

JS file:

JSON file:

from prettier-vscode.

CiGit avatar CiGit commented on June 5, 2024

Do you have any other formatter installed (extension)? prettier does not remove single line breaks like on your JS file.

For the JSON file, removing lines is the behavior of vscode's embed formatter.

from prettier-vscode.

zoontek avatar zoontek commented on June 5, 2024

I don't think. editor.formatOnSave is set to true, and when prettier-vscode is disabled, it doesn't do that. Very strange.

from prettier-vscode.

CiGit avatar CiGit commented on June 5, 2024

About which file type are you speaking? Both?
Just to be sure about your JSON file. If you set "json.format.enable": false, in your settings, does it still happen ? This is the embed json formatter.

Can you try [email protected] with the command line on your JS file?

Can you also test with all extensions disabled but prettier ?

I'm unable to reproduce your problem with the JS file. With the JSON file I think this is the embed formatter.

from prettier-vscode.

zoontek avatar zoontek commented on June 5, 2024

"json.format.enable": false does the trick for the JSON files 👍
I disable every extensions except this one, and still encounter the problem. But it doesn't appear when I use the babylon parser (only appear with the flow parser)

I'll just use the babylon parser for now. Thanks for your precious help! :)

from prettier-vscode.

CiGit avatar CiGit commented on June 5, 2024

Still seems there is an issue tho. I cannot reproduce this issue with the flow parser and a minimal code. Is it possible for you to provide a minimal code which produce this error and your settings for prettier.
Note: I also tried with CRLF

from prettier-vscode.

zoontek avatar zoontek commented on June 5, 2024

I isolate the bug. Here is the minimal setup to reproduce it:

// @flow

import React, { Component } from 'react';
import { connect } from 'react-redux';

class MyClass extends Component {
  render() {
    return <span>8€</span>;
  }
}
const mapStateToProps = (state, ownProps) => ({
  navigation: ownProps.navigation,
});
const mapDispatchToProps = (dispatch, ownProps) => ({});
export default connect(mapStateToProps)(MyClass);

It doesn't happen if I remove the character, and seems not related to this plugin (does the same using prettier directly). I should create an issue on the prettier repo.

from prettier-vscode.

github-actions avatar github-actions commented on June 5, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from prettier-vscode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.