Skip to content

Colorization of JSX code in VS 2015 #4835

Closed

Description

Hi,

I've installed TypeScript 1.6 and tried to replace my .jsx files with .tsx. Everything works as expected except that JSX code is not colorized. I've tried to reset my "Fonts and Colors" settings, but nothing helps.

tsx

Is that supposed to work? Is there any way to fix this?

Thank you!

Activity

  1. olmobrutall commented on Dec 24, 2015

    @olmobrutall

    Here are links:

    Emmet syntax: http://docs.emmet.io/abbreviations/syntax/

    YouTube video: https://m.youtube.com/watch?v=EfrqtMmmb0k

    Challenges for react: https://github.com/proxy/gist.github.com/max-mykhailenko/41d0c3991d92f38dcbc6

    Anyway, I think syntax coloring, proper formatting and basic tag auto-closing should be priorized.

    While VS and TypeScript have a much deeper understanding of the type system, the experience is almost ruined because of the final polish.

    Pleeese fix this.

  2. billti commented on Jan 7, 2016

    @billti
    Member

    Ryan Cavanaugh (@RyanCavanaugh) Vladimir Matveev (@vladima) Is simple colorization of the JSX element and attribute identifiers, and punctuation, not something we can do easily within the enabled classifiers?

  3. mhegazy commented on Jan 7, 2016

    @mhegazy
    Contributor

    We will need to re-enable the syntactic classifier. There should not be a perf hit now after the work Cyrus Najmabadi (@CyrusNajmabadi) did in VS2015 update1.

  4. CyrusNajmabadi commented on Jan 7, 2016

    @CyrusNajmabadi
    Contributor

    Also, I put in some very useful helpers in the Roslyn codebase for this work. Check out ITextViewExtensions.GetVisibleLinesSpan as well as:
    http://index/#Microsoft.CodeAnalysis.EditorFeatures/Implementation/Classification/SemanticClassificationViewTaggerProvider.cs,74

    With these helpers you should need very little code in your view tagger.

  5. vladima commented on Jan 11, 2016

    @vladima
    Contributor

    fixed in #6406 and #6411

  6. olmobrutall commented on Jan 11, 2016

    @olmobrutall

    Awesome!

  7. matijagrcic commented on Jan 12, 2016

    @matijagrcic

    Vladimir Matveev (@vladima) Awesome work! Do we need to wait for a particular VS update or can we just use latest TypeScript? :shipit:

  8. vladima commented on Jan 12, 2016

    @vladima
    Contributor

    managed side of changes should be available in TypeScript 1.8 which is our next release (I don't have any exact timings at this point)

  9. olmobrutall commented on Jan 12, 2016

    @olmobrutall

    Vladimir Matveev (@vladima) That's awesone! You have some pretty screenshot already?

  10. vladima commented on Jan 12, 2016

    @vladima
    Contributor

    something like this (colors for tags, attributes and inner text can be redefined)
    jsx

  11. olmobrutall commented on Jan 12, 2016

    @olmobrutall

    👍 Oeeee!!

  12. techird commented on Jan 26, 2016

    @techird

    Vladimir Matveev (@vladima) Is that possible to get this working in my visual studio now? Can't wait for typescript 1.8.

  13. vladima commented on Jan 26, 2016

    @vladima
    Contributor

    Unfortunately no, this requires changes on the managed side that were not yet released

  14. matijagrcic commented on Jan 28, 2016

    @matijagrcic

    This is working great with TypeScript 1.8.

    2016-01-28 22_12_53-typescriptreact - microsoft visual studio

    TypeScript_Dev14Full.exe download

    Thanks for all the hard work!

  15. olmobrutall commented on Jan 28, 2016

    @olmobrutall

    Awesome team and awesome language. Thanks a lot!

  16. techird commented on Jan 29, 2016

    @techird

    Really productive!!

  17. djanosik commented on Jan 29, 2016

    @djanosik
    Author

    Is it intentional that colors used for tags, attributes and inner text are different from colors used in .cshtml or .jsx files? What colors I need to redefine to make it look the same?

  18. djanosik commented on Jan 29, 2016

    @djanosik
    Author

    Well, it looks it uses colors for VB XML Literals instead of colors for XML or HTML. That feels wrong.

  19. olmobrutall commented on Jan 29, 2016

    @olmobrutall

    I think it makes sense. This is markup inside code like in VB, no code inside markup like in cshtml.

    I think .jsx are wrong and .tsx right.

  20. djanosik commented on Jan 30, 2016

    @djanosik
    Author

    It makes sense, but it should be consistent at least.

  21. olmobrutall commented on Jan 30, 2016

    @olmobrutall

    I've found colorization errors about this feature using Inner Types. I posted a separated issue #6756

  22. paulvanbrenk commented on Jan 30, 2016

    @paulvanbrenk
    Contributor

    Dusan Janosik (@djanosik) this inconsistency is because the jsx support was originally implemented by the ASP.NET team and the tsx support by the TypeScript team. We have a plan to unify this, however no clear timeline yet; the next version of Visual Studio is more likely than an interim release of TypeScript.

  23. djanosik commented on Jan 30, 2016

    @djanosik
    Author

    Paul van Brenk (@paulvanbrenk) Good to know. I've changed VB XML Literals colors because it's not readable when you use Dark color theme.

  24. CyrusNajmabadi commented on Feb 1, 2016

    @CyrusNajmabadi
    Contributor

    pinging David Poeschl (@dpoeschl) . Hey David, is is a known issue that the VB xml literal colors aren't readonable in the Dark theme? Sounds like something we'd want to fix for both VB and TypeScript.

  25. nippur72 commented on Apr 12, 2016

    @nippur72

    what are the VB XML color code-names for <, >, /, = ?

    I would like to colorize the whole component definition, delimiters included.

    Also, it would be nice if code within JSX expressions ({ }) had a custom background (slightly lighter or darker) like in the razor syntax.

  26. paulvanbrenk commented on Apr 12, 2016

    @paulvanbrenk
    Contributor

    nino-porcino (@nippur72) I don't think VB XML literals has configurable options for the delimiters, at least I couldn't find them.

    I'll see if I can use the VB XML Literals - Embedded Expression color for the JSX expressions, but that may look terrible.

  27. locked and limited conversation to collaborators on Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueVisual StudioIntegration with Visual Studio

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions