Giter VIP home page Giter VIP logo

babel-sublime's Introduction

babel

The compiler for writing next generation JavaScript.

Gitpod ready-to-code

v7 npm Downloads v6 npm Downloads

GitHub CI Status Coverage Status Slack Status Follow on Twitter

Supporting Babel

Backers on Open Collective Sponsors on Open Collective Business Strategy Status

Babel (pronounced "babble") is a community-driven project used by many companies and projects, and is maintained by a group of volunteers. If you'd like to help support the future of the project, please consider:

  • Giving developer time on the project. (Message us on Twitter or Slack for guidance!)
  • Giving funds by becoming a sponsor on Open Collective or GitHub (which goes to our Open Collective account)!

Sponsors

Our top sponsors are shown below! [Become a sponsor]

Intro

Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.

In

// ES2020 nullish coalescing
function greet(input) {
  return input ?? "Hello world";
}

Out

function greet(input) {
  return input != null ? input : "Hello world";
}

Try it out at our REPL.

FAQ

Who maintains Babel?

Mostly a handful of volunteers, funded by you! Please check out our team page!

Is there a Babel song?

I'm so glad you asked: Hallelujah —— In Praise of Babel by @angus-c, audio version by @swyx. Tweet us your recordings!

Looking for support?

For questions and support please join our Slack Community (you can sign up here for an invite), ask a question on Stack Overflow, or ping us on Twitter.

Where are the docs?

Check out our website: babeljs.io, and report issues/features at babel/website.

Want to report a bug or request a feature?

Please read through our CONTRIBUTING.md and fill out the issue template at babel/issues!

Want to contribute to Babel?

Check out:

Some resources:

How is the repo structured?

The Babel repo is managed as a monorepo that is composed of many npm packages.

License

MIT

babel-sublime's People

Contributors

arcanis avatar aritheelk avatar aziz avatar dashdashzako avatar devsnek avatar gpbl avatar hawkrives avatar jlc467 avatar jlhwung avatar jzelenkov avatar ljharb avatar michaelbeil avatar sindresorhus avatar thom1729 avatar voronianski avatar zaynali53 avatar zertosh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

babel-sublime's Issues

"Await" miscategorized?

Could be wrong about this, but my gut says 'await' belongs in keyword.control.flow alongside return and yield (the latter being a close relation) rather than in keyword.operator.

Bug with jquery.js sourcecode.

jQuery version: 1.11.2(didn't check other versions)
Line #: 2356
Screenshot of the problem: http://i.imgur.com/H5eQJ70.png
It stumbles on this whole line(doesn't highlight any syntax for some reason) AND it doesn't highlight syntax in the subsequent lines unless you remove the ternary operator in the end(question mark and further till the closing curly bracket).

If you remove this whole line it also fixes the problem.

It works fine with regular Javascript Syntax. Any ideas as to what causes it?

Names of static functions aren't scoped

In the following:

Deck.get = function get(keyPath) {
//...
};

get in function get(keyPath) isn't scoped to entity.name.function.js (and thus not colorized).

It's only scoped to meta.function.static.js.

Storage type differentiation

Currently, the following are all under storage.type:

  • async
  • var
  • let
  • constant
  • static

Contrast with function, arrow function, class, accessor (get/set), and extends, which all have unique scopes (aside: is "extends" really a "storage type"? I'm no grammar buff, so I could be totally wrong, but isn't it almost more of an operator? scratch that, no ... I have no idea what it should be).

It would be helpful to be able to target more specific scopes for the items above. In particular, async and static seem categorically different from var, let and constant to me.

Move snippets to separate plugin

How about an idea to create separate ST plugin with snippets from SNIPPETS.md, something like react-es6-snippets? These snippets are useful and it is not fun to copy them by hands. I can do it by myself, just look for approval, hope there is no any scary legal stuff.

goto definition for es6 methods

goto definitions doesn't seem work for es6 methods, however they do work for standard es5 methods. Is there anything that I can look at to make it work?

Thanks!

Move snippets to separate repo?

Not a fan of having snippets automatically included :(. Could we move em to a separate repo?

I have my own set of personal JS snippets, and since you can't disable package-specific snippets my only choice would be to fork 6to5-sublime and keep it up-to-date manually everywhere I have a sublime text installation.

Scope for class names

Currently the following rules apply in most cases:

  • A lowercase identifier is variable.other.readwrite
  • An all-uppercase identifier is variable.other.constant

It seems reasonable also to recognize that variables which begin with a capital are constructors. The only time constructors become targettable is when they are being invoked to create an instance:

new Foo(): meta.instance.constructor entity.name.type.new

How about entity.name.class or entity.name.constructor? Even in class declarations, the name does not get a targettable scope currently.

Slashes break template string highlighting

Hey,
while template strings in general are highlighted correctly, it seems like when they contain slashes everything following these is treated as a comment.

bildschirmfoto 2015-03-19 um 11 22 51

Thank you!

Breaking Syntax

The following code loses all syntax highlighting after { //first comment.

The issue looks to be because of i<p -- using spaces as in i < p fixes it.

function foo() {
    let i = 0, p = 2, a = true, b = false;
    let next = i<p ? a : b;
    if (!next) { //first comment
        console.log("test")
    } else { //second comment
        console.log("test B")
    }
}

Apologies if this is the wrong repo for this ticket.

es6 functions not showing up in goto symbol in project

Just noticed that es6 functions aren't showing up in the goto symbol in project command palette - they show up just fine in the goto symbol (in the current file) palette. Is there some symbol re-indexing that I need to do? Or is there something else that needs to happen?

Coffeescript?

sublime-react syntax highlighting supported cjsx, i.e. coffeescript with jsx. Any plans for babel to do the same? I can't get the deprecated sublime-react syntax highlighting to work anymore.

syntax highlighting of HTML/XML snippets

I'd like to have syntax highlighting of multiline HTML and XML strings, as that is something that is available with the default JavaScript view. Here's the default view for JavaScript files:

image

And here's the same content with babel highlighting:

image

Any thoughts on adding support for HTML/XML highlighting?

Ternaries with spaces before colon breaks highlighting.

For example:

Imgur

This appears to be caused by the space in the ternary.

Copy-paste this snippet to your editor:

'use strict';
var React = require('react');
function test() {
  var a = "bar";
  return (
    <div foo="bar" className={"foo" + (a ? 'foo' :'bar')} herp="derp">
      <div foo="bar" className={"foo" + (a ? 'foo':'bar')} herp="derp" />
    </div>
  );
}

Play with spaces before/after the :.

Regexp delimiters

Given a regexp:

/hello/

The opening slash only has the scope string.regexp.js while the closing slash has the scope string.regexp.js punctuation.definition.string.end.js. It seems like both should be targettable.

meta.group.braces.round.function.arguments

This scope applies correctly for bare function invocations and method invocations:

foo();
bar.foo();

But it's missing when the function is or appears to be a constructor, with or without new:

Foobar();

Whose parens instead receive meta.group.braces.round.js meta.brace.round.js

Suggestion: Colorize `this`

I did this in my custom Atom user stylesheet while test driving the editor, and found it to be a very good visual cue.

Scoping JSX snippets to HTML?

Just started thinking about this, but I wanted to get a conversation going.

It should be possible to scope React's JSX blocks to HTML, most likely named text.html.jsx. If that worked, wouldn't we suddenly gain access to all of the HTML tools available to Sublime? At very least, this should enable Sublime's build-in Expand Selection to Tag. Formatters/Tidy would be welcome.

I haven't looked into what they're doing, but Allan Hortle's JSX package does allow Expand Selection to Tag to function correctly.

Colour scheme seems to be inconsistent with screenshots

A small difference I can't really wrap my head around.

My object keys seem to be in yellow, and every dot is highlighted red. In the screenshots below I'm editing a .jsx file set to use the JavaScript(Babel) syntax in sublime.

screen shot 2015-04-15 at 16 39 32
screen shot 2015-04-15 at 16 39 48

Currently I'm only using it for .jsx files (I haven't fully started using es6 syntax in my normal .js files) and am moving over from sublime-react. Ideally I'd like to retain the normal colour matching with jsx support. Am I able to revert back to the highlighting shown in the readme screenshots?

Missing support identifiers

support.class.builtin.js is missing WeakSet and Symbol (I think Symbol is not a class, technically, but I'm not sure where else it should go).

support.type.object.node is missing require (could be grouped with support functions I suppose, but it does also have properties)

support.module.node.js is missing querystring

support.class.builtin.js is missing all of the typed arrays plus ArrayBuffer and DataView -- Babel doesn't (can't, at least meaningifully, I imagine) implement typed arrays though, so this may be intentional. On the other hand, Proxy is there and not in Babel either. I think this regex should cover the typed arrays plus Array collectively:

(Float(32|64)|(Ui|I)nt(8|16|32)|Uint8Clamped)?Array

Also absent: JSON, Reflect, and Intl.

And: setTimeout, clearTimeout, setInterval, clearInterval, setImmediate and clearImmediate (didn't even know that last one existed till just now!).

Odd scope encountered -- correct behavior?

I'm not sure what's going on here with the maxLogs identifier (yellow):

image

The scope on maxLogs is:

(...) constant.other.object.key.js string.unquoted.label.js

If I enclose it in parentheses, the scope changes to variable.other.readwrite, which is how it gets identified everywhere else it appears. To replicate this, the pattern seems to be:

In any ternary, if the expression between ? and : is not enclosed in parentheses, and the last value is an identifier, and the total expression is not just a single identifier, then that last value will get this odd scope.

React component skeleton

I've been using different 'flavor' of React.createClass

'use strict';

import React from 'react';

export default React.createClass({
    render() {
        return ();
    }
})

I'd like to update the snippets with this minimalistic approach of exporting the component + adding the 'use strict'; statement. What do you think?

Use of a < with no whitespace near it results in weird colors

screen shot 2015-02-12 at 10 44 32 pm

function tableToJson(table) {
    // from http://johndyer.name/html-table-to-json/
    var data = []; // first row needs to be headers
    var headers = [];
    for (var i=0; i < table.rows[0].cells.length; i++) {
        headers[i] = table.rows[0].cells[i].innerHTML.toLowerCase().replace(/ /gi,'')
    }
    // go through cells
    for (var i=1; i<table.rows.length; i++) {
        var tableRow = table.rows[i]
        var rowData = {}
        for (var j=0; j < tableRow.cells.length; j++) {
            rowData[ headers[j] ] = tableRow.cells[j].innerHTML;
        }
        data.push(rowData)
    }
    return data
}

or even as little code as

screen shot 2015-02-12 at 10 45 50 pm

i<table
return data

If I add a space to the right side of the <, all is well.

Because it's a <, I'm thinking it has something to do with the JSX highlighting, maybe?

Let me know if you need any more information.

Rename syntax name

Then Syntax -> Open all with current extension as... -> JavaScript JSX.

IMO, I think JavaScript JSX should be renamed to something else (maybe JavaScript 6to5?). JSX isn't the only thing that has highlighting support, but generally/ideally anything that 6to5 supports syntactically (e.g. ES7+).

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.