subtlegradient / language-javascript-jsx Goto Github PK
View Code? Open in Web Editor NEWJavaScript with JSX Bundle for Atom
JavaScript with JSX Bundle for Atom
Stuff like event
and document
highlight as though they're special. When developing something for which these types are undefined or irrelevant (such as server-side node.js), it's annoying having these words commandeered with the assumption that we're in a browser-targeted environment.
Example:
Any chance of an option to stop environment-specific tokens from being given special treatment?
What's the purpose of having .syntax--variable.syntax--other.syntax--readwrite
on most elements?
Also, I see a lot of syntax--entity.syntax--other.syntax--attribute-name
as well as .syntax--meta.syntax--scope.syntax--inner
, while some elements have .syntax--js
, others have .syntax--es
, and other others have .syntax--jsx
.
Almost every element is styled to the same color, or doesn't make sense semantically (i.e. string quotations are colored different than the string contents themselves)
To reproduce the problem.
Enjoy autocomplete for require/import statements....
autocomplete-modules won't work anymore.
Hi,
I found a small bug on the latest version of the package. Whenever you write the hidden attribute on any component, with a value other than a string, i.e. hidden={value}, it automatically hides the attribute on the editor.
<Component hidden={true} />
becomes:
<Component />
It really doesn't matter the value of the hidden attribute, as long as the attribute is 'hidden'.
When writing a new react component method in ES6 class syntax, I came across this nasty bug.
Here is some context:
export default class BlahBlah extends Component {
method() {
return ()
}
}
With the above code, all is fine.
The bug fires when I type <
, then a d
inside the parenthesis after the return
. (Creating a DIV tag)
The atom editor completely locks up and I am forced to close the application...
Any ideas?
undefined
is the only keyword not properly labeled with a class name...
This regex just doesn't seem to bbe able to match the word undefined
https://github.com/subtleGradient/language-javascript-jsx/blob/master/grammars/javascript.cson#L742-L745
Digging through the code to see what snippets is available is not ideal.
Within a component, writing a property which contains curly braces inside a string produces formatting that does not suggest that the string will come out like it does.
The code <input id='CardNumber' pattern='[0-9]{13,16}' />
is valid syntax and is compiled naturally by Babel. As such, I think the formatting should reflect this.
Splitting large opening tags such as this doesn't work:
title={"Edit "+this.props.friend.fname+" "+this.props.friend.lname+"'s Account"}
modal={false}
open={this.state.editOpen}
onRequestClose={this.editClose} >
It's not recognising it as a complete opening tag.
I initially assumed this bug to be related to the PHP formatter built into Atom, but after some trial and error I tracked it down to this package instead.
See original issue I posted here.
This is one code example that triggers the issue (extracted from a .php file):
// Set address name if it wasn't entered
if (!$location->getAddressOne() && $location->getAddressTwo())
{
$location->setAddressOne($location->getAddressTwo() ? ' ' . $location->getAddressTwo() : '');
}
$hasAddress = $location->getAddressOne() ? true : false;
Changing the first line of the code to remove the apostrophe corrects the problem:
// Set address name if it wasnt entered
if (!$location->getAddressOne() && $location->getAddressTwo())
{
$location->setAddressOne($location->getAddressTwo() ? ' ' . $location->getAddressTwo() : '');
}
$hasAddress = $location->getAddressOne() ? true : false;
Any chance on implementing autoformat. Or creating another package for does autoformat for this language-javascript-jsx.
undetected close tag />
I know this is pretty nitpicky, and people like credit, but seeing "Javascript by SubtleGradient" in my status bar is super annoying. Is it possible to change that to something more subtle like "Javascript+"? It also takes up a ton of space.
Some suggestions: Since you're covering all the bases (React, ES6/7, etc) how about JavaScriptNext? Or JavaScriptHarmony? Understandably both those terms seem a bit dated, but they do seem appropriate.
I find it hard to work with JSX in Atom Editor with this plugin since it skips a lot of ES6 features and also doesn't include the tons of JavaScript features upstream has, it would be nice if the gammers here all sourced upstream: "source.js" like so:
"patterns": [
{
"include": "source.js"
}
]
The highlight to keyword function
expects a function even it is, at this instance, an object attribute. Also eslint dot-notation rule in favour of this syntax instead of PropTypes['function']
. Which results in this mess up output:
Files of the type "Javascript with JSX" (and possibly others in the package) conflict with the native language-todo
package's ability to highlight markers in comments like TODO
, FIXME
, etc. Not a huge issue but it makes them easier to spot in comments when they highlight properly.
The javascript coloring is being thrown off by an escaped /
at the end of a regular expression.
const addProtocol = (url: string): string =>
(!url || /^https?:\/\//.test(url) ? url : `http://${url}`)
Interestingly, if you remove the !url ||
before the RegExp, it works fine. Something about the ||
is throwing it off.
More info: facebookarchive/nuclide#1121
e.g.
const bar = 42;
const baz = `foo ${bar}`; // 'foo 42'
foo
should be styled as string and ${bar}
should be styled as variable.
Hi,
Sometimes we make use of lodash/get
in our codebase. This causes the code following it to not be properly formatted:
Likely due to this line, it looks like certain keywords trigger this kind of highlighting, which is undesirable. How do I either:
get
static
keyword is used)To reproduce:
<p>
<
First of all, thank you for this package, I haven't found any other package that adds syntax highlighting for jsx AND es6, so thanks..
There is probably only one thing that im missing currently and that is highlighting on attributes on jsx elements.
Currently it looks like this and it gets a little messy after a while.
A file that contains JSX and has a .js
extension is highlighted as normal Javascript (not with JSX). This has only started happening recently, and was working fine on these types of files until a few days ago.
Maybe something changed within my editor to cause this, but it seems like it is related to how file type/syntax is detected with language-javascript-jsx
.
I am having strange highlighting issues with v0.3.7.
Most of the test appears read. Basically its the same happening with this package what happend once to the language-javascript package.
Any tips how to fix this red syntax issue?
const App = () => ( <> <p>React 16.2</p> <p>React 16.2</p> </> );
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.