GithubHelp home page GithubHelp logo

TSX falls back to JS about prettier-vscode HOT 6 CLOSED

prettier avatar prettier commented on June 5, 2024
TSX falls back to JS

from prettier-vscode.

Comments (6)

CiGit avatar CiGit commented on June 5, 2024

😕 Can you explain a little more what you mean ?
Prettier doesn't handle typescript.

from prettier-vscode.

madslundt avatar madslundt commented on June 5, 2024

Yes sorry.

The problem is when formatting the document, using TSX, it formats the document like it was just vanilla JavaScript (I suppose). This make the types and interfaces fly around and doesn't look so good.

Example using TSX:
export class Todo extends React.Component <void, TodoState>
is formatted into
export class Todo extends React.Component < void, ↵ TodoState >

But if prettier doesn't handle TypeScript, this should maybe not be an issue here.

from prettier-vscode.

CiGit avatar CiGit commented on June 5, 2024

This extension runs on Javascript and Javascript React. Have you (or any of your extension) set tsx files to be any of those two? I'm asking because I see a line break and I'm pretty sure the provided typescript formater doesn't insert those. Any other formatter installed ?

from prettier-vscode.

esbenp avatar esbenp commented on June 5, 2024

@CiGit is it not because the extension only activates on javascript and javascriptreact? When doing typescript react I think VS Code sets the language to typescriptreact or something similar. So I think we just need to add that as a valid language

from prettier-vscode.

CiGit avatar CiGit commented on June 5, 2024

We currently can't activate it on typescript. There is a WIP PR on prettier to be able to parse/print typescript.

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.