Sublime text syntax coloring quote issue - sublimetext3

I'm using sublime text 3 to code some react native stuff and when writing in text components I use quotes that mess up all the syntax coloring as in the picture below. Is there any way to fix this ?

React JSX syntax
JSX is the JavaScript Syntax extension you normally use in your render method.
Correct Color Scheme
Since JSX is an extension to the plain JavaScript, Sublime doesn't know about it. You have to tell Sublime to use the extension babel-sublime.
Installation of babel-sublime
Just follow the official documentation to install this plugin. I don't write it down, in case something changes in the future.
Also check the documentation about Package Control, which you use to manage your Sublime Packages.

Related

Sublime text 3 package to view JSON response like in Chrome network view

I want long JSON files to collapse in Sublime Text 3 like the Chrome network tab Preview section. Is there any Sublime Text package for this.
Something similar to following picture
Some of the answers here suggested Pretty JSON, but it didn't work for me. Although the installation was successful but still after pressing the shortcut key [command + control + j], it didn't work for me. I double-checked the setting, everything was correct. I was using Sublime version 3.2.2 and my macOS version was Catalina Version 10.15.3. I also found a thread in Github where multiple people mentioned the same issue with Sublime version 3.
Added a screenshot of my settings for reference.
Even though Pretty JSONdidn't work for me what worked for me was HTML-CSS-JS Prettify.
Following are the steps to install through Sublime Package Manager:
1. Cmd+Shift+P
2. type install, select Package Control: Install Package
3. type prettify, select HTML-CSS-JS Prettify
After installing it, for formatting the JSON text we need to use the shortcut key [command + shift + h]. That will format our JSON text.
Note: HTML-CSS-JS Prettify requires NodeJS in your system to work.
Hope this helps.
You can try Pretty JSON. It is the best I have found to prettify and validade JSON codes.
But it won't give list indexes like chrome. At most you can fold those list itens folding by levels.
We will use Pretty JSON package from package control in Sublime Text 3:
Installation
Install this sublime text 2/3 package via Package Control search for package: “Pretty JSON”
Usage
To prettify JSON, make selection of json (or else it will try to use full view buffer) and press keys:
Linux: ctrl+alt+j
OS X: cmd+ctrl+j
Windows:ctrl+alt+j
or through Command Palette Ctrl+Shift+P find “Pretty JSON: Format (Pretty Print) JSON” (you can search for part of it like 'pretty format')
If selection is empty and configuration entry use_entire_file_if_no_selection is true, tries to prettify whole file
If JSON is not valid it will be displayed in status bar of Sublime Text
Had the same problem: Pretty JSON did not work for me (Ubuntu 16.04 LTS and ST 3.2.2).
The alternative suggested by Rito, HTML-CSS-JS Prettify, requires NodeJS in your system to work.
Another alternative that does not require NodeJS which worked fine for me is the Pretty YAML ST-plugin which uses PyYAML internally.
Install is analogous to Rito's comment (and detailed on the github page).
Use Alt+Ctrl+Y to prettify a selection (or whole file)

Nodejs: does any way to beautify my package.json file?

At first, I don't care much about my project's package.json, with the time flow, it become more and more complex and dirty. it's hard to handle manually.
so, is there any plugin or tool to beautify my package.json file?
The easiest would be to use your editor/IDE JS/JSON formatter. For Sublime Text 2/3 that would be https://packagecontrol.io/packages/JsFormat
Alternatively, you can use an online tool like https://jsonformatter.curiousconcept.com/
The easiest way to code in JS is by using Visual Studio Code (IDE). It has all the formatting tools required to Parse JSON properly, auto indent the code and IntelliSense which help in writing JS easy are already present in it .

Emmet with sublime

I am trying to make something pretty easy and for some reason i can't. Generally with Emmet on html i don't have any problem, but i wanna make something custom. On javascript, when i type log i want on Tab should generate console.log() and write pointer inside (). I have searched folder with packages installed but i didn't find somewhere i could put code on. Also on the google i didn't find something that can help, i had this thing on the ATOM but i also can't find how they have it there.
You don't need Emmet for that, just create a snippet in Sublime Text.
Example:
<snippet>
<content><![CDATA[console.log($1)]]></content>
<tabTrigger>log</tabTrigger>
<scope>source.js</scope>
</snippet>
If you need this to work for HTML as well, you could change the scope to source.js,text.html

Which Notepad++ plugin is highlighting my HTML colors?

I have a plugin that I installed that does this:
I really like this function (highlighting HTML colors) but I don't know plugin does it. I want to put it on the another copy of Notepad++ but installing plugins is a rather big thing and I don't want to have to install them all - it gets cumbersome.
Does anyone know which plugin highlights my colors?
It's a wonderful feature.
I think that you are referring to the HTML Color plugin. You can find it here
http://npp.campulka.net/
I think that feature was taken out of Notepad++ due to the users' inability to read the text at times if the colors were too overwhelming. Instead, I recommend trying to install the Quick Color Picker or HTML Color plugins. They are about as close as you're going to get:
Quick Color Picker: https://code.google.com/p/nppqcp/
HTML Color: http://npp.campulka.net/
Source: Notepad++ hover preview on link or color?
Check Quick Color Picker for Notepad++.
The plugin puts the colored underline under the color code based on it's value and thus is not obtrusive in reading the text.
I'm using it without any issues with the Notepad++ v6.9.2
I just ran into this and resolved it as follows:
Download and install the UDL file found at https://github.com/notepad-plus-plus/userDefinedLanguages (get the zip file with all languages). Instructions for installation are on that page. Close Notepad++ and reopen, then go in your Notepad++ menu to "Language". You should now see a long alphabet list with subcategories off to the right indicated by an > Go to H then click on the > and select HTML with your HTML file open in Notepad++ The moment you do that, all your HTML syntax will (should!) be highlighted.

sublime text 3 html autocompletion not working correctly

I am trying to use sublimetext3 for editing html.
If I do
ul tab, then it generates <ul></ul>
if I do
ul.temp tab, then it generates <ul class="temp"></ul>
however, when I am trying
ul>li.temp tab, it is generating ul><li class="temp"></li>
What I am expecting to see is <ul><li class="temp"></li></ul>
I have package control. What am I missing in getting this functionality?
Note: Moved to an answer at the request of the original poster.
Perhaps the behavior you are looking for comes from the Emmet plugin
What you are describing it the expected behavior for Sublime Text.
The functionality that you are looking for comes from Emmet as skuroda said. Just install it using Package Control and you should be good to go.

Resources