Code Monkey home page Code Monkey logo

javascript.tmbundle's Introduction

Installation

You can install this bundle in TextMate by opening the preferences and going to the bundles tab. After installation it will be automatically updated for you.

General

License

If not otherwise specified (see below), files in this repository fall under the following license:

Permission to copy, use, modify, sell and distribute this
software is granted. This software is provided "as is" without
express or implied warranty, and with no claim as to its
suitability for any purpose.

An exception is made for files in readable text which contain their own license information, or files where an accompanying file exists (in the same directory) with a “-license” suffix added to the base-name name of the original file, and an extension of txt, html, or similar. For example “tidy” is accompanied by “tidy-license.txt”.

javascript.tmbundle's People

Contributors

50wliu avatar aseemk avatar elaberge avatar elifoster avatar hurtak avatar igor10k avatar igormilla avatar infininight avatar jacksteele avatar jasonhansel avatar joefiorini avatar joshvarner avatar kevinsawicki avatar larshp avatar lilyball avatar luop90 avatar macfreek avatar mathiasbynens avatar maximsokolov avatar mkhl avatar noniq avatar patrickrgaffney avatar paulmillr avatar rhelmer avatar sorbits avatar spencer-easton avatar subtlegradient avatar tbates avatar technoberry avatar whitlockjc 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript.tmbundle's Issues

Brace completion can cause Textmate to stall / crash

When using the latest release of the JavaScript bundle, some brace-completion functions cause TextMate2 to hang indefinitely.

For instance, pasting the following codeblock into TextMate and trying to remove the braces after the if statement will cause TextMate to freeze. Turning off the JavaScript bundle restores normal operations.

$('#accordion').on('hide', function(e) {
    if ($accordionHeadings.length == $accordionHeadings.filter().length) {

    }
});

javascript inline regexp not recognized when not first argument passed to method

Screenshot of behavior:
ccede0b6-255d-11e3-8b36-9de087c2541f

Copy paste this to test:

var item = "be'er";

item.replace(/'/g, "");

var items = ["'beer", "food'", "chee'se"];

_.invoke(items,
  "replace",
  /'/g,
  ""
);

_.invoke(items, "replace", /'/g, "");

// this should be a comment
console.log("why am I colored like a string?");

I'm trying to figure out the correct fix for this; if anyone has advice for where to look and doesn't want to fix it themselves, let me know.

comma-first auto-indent problems.

I'm seeing some really nasty auto-indent issues with comma-first in JavaScript.

var tako = require('tako')
  , couch = require('couch');

If you try to type on the next line it'll be indented, which would not be a big deal, but even if you hit backspace to the start of the line as soon as you start typing it pushes the indentation out again. the same problem happens with

var x =
  { key: value
  }

Any idea what the problem is here? Is there an option I can just turn off?

Multi-line function arguments are not highlighted properly

I have noticed a weird situation where adding new lines can break the syntax highlighting for function arguments. Below are a few code samples with documentation on how it is working/broken:

// In this case, $ is highlighted just like any regular keyword but all other arguments highlight properly
function test(
  $, arg1, arg2) {
// In this case, all arguments highlight properly except for arg1 which has no highlighting
function test(arg0,
  arg1, arg2) {
// In this case, all arguments highlight properly except for arg1 which has no highlighting
function test(arg0,
arg1, arg2) {
// In this case, all arguments are highlighted properly
function test(arg0
  , arg1, arg2) {

Regardless of whitespace surrounding a function argument, it should highlight properly.

support Ecmascript 6 method syntax

It would be great if the bundle supported Ecmascript 6 method syntax

I tried to do it thusly, but don't understand Textmate grammar syntax well enough to make it work:

    injections = {
        'source.js - meta.ternary-if.js - string - comment' = {
            patterns = (
                {   name = 'entity.name.function.js';
                    match = '(?<!\w)[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?=(?:\s*:\s*function\b)|(?:\())';
                },
                {   name = 'entity.name.attribute-name.js';
                    match = '(?<!\w)[\p{L}\p{Nl}$_][\p{L}\p{Nl}$\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*(?=\s*:)';
                },
            );
        };
    };

Regexp literal not scoped in ternary statement

If you ever have a regexp literal within a ternary statement, the regexp does not get scoped as it should be. Here is a simple example:

var  timeParts = cli.timeFormat ? /(\d+)(\w+)/.exec(cli.timeFormat) : [];

What you'd expect is that /(\d+)(\w+)/ would be scoped string.regexp.js but it is not. The same code outside of a ternary statement behaves as expected.

Shebang line scoping support

The shebang line should be a comment but it's now scoped partly as a regexp and the rest is not scoped. The /usr/ in #!/usr/bin/env node is scoped as source.regexp.js while all other parts are nothing more than source.js.

'window' in '$window' scoped unnecessarily

The variable name $window ends up with window being scoped as support.constant.dom.js but since the keyword window is part of a variable name, it should not be scoped at all.

Wrong support.constant.dom.js

I've noticed that that TM wrongly highlights some constants. That's how it currently looks

{
    name = 'support.constant.dom.js';
    comment = 'HTML 5 (http://www.w3.org/TR/html5/single-page.html#window)';
    match = '(?<!\.|\$)\b(applicationCache|closed|console|crypto|document|...)\b(?!\$)';
}

screen shot 2014-09-10 at 19 55 14

It should be vise versa, var top should not have highlight, but window.top should.

In short I think that match should look like this

'(?<=\.)\b(applicationCache|closed|console|crypto|...)\b(?!\$)';

Am I missing something?

ES6 Template Literals

Following #42 I think it'd be great to have strings that are template literals, show as they do in CoffeeScript. This should show as a string: Hello, ${name}. Additionally, it'd be great if the ${} could be colored slightly differently...I'm not good enough to really make this work, but here is my progress.

I was able to get the string stuff working simply by adding:

{   name = 'string.interpolated.js';
            begin = '`';
            end = '`';
            beginCaptures = { 0 = { name = 'punctuation.definition.string.begin.js'; }; };
            endCaptures = { 0 = { name = 'punctuation.definition.string.end.js'; }; };
            patterns = (
                {   name = 'constant.character.escape.js';
                    match = '\\(x\h{2}|[0-2][0-7]{0,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)';
                },
                                { inlcude = '#interpolated_js' }
            );
        }
repository =  {
interpolated_js = {
            patterns = (
                {   name = 'meta.embedded.line.js';
                    begin = '\$\{';
                    end = '(\})';
                    beginCaptures = { 0 = { name = 'punctuation.section.embedded.begin.js'; }; };
                    endCaptures = {
                        0 = { name = 'punctuation.section.embedded.end.js'; };
                        1 = { name = 'source.js'; };
                    };
                    contentName = 'source.js';
                    patterns = ( { include = '$self'; } );
                },
            );
        };
}

Update known CSS/DOM style properties

Presently obj.border has border marked up as support.constant.dom.js but extending it to borderWidth lose the highlight.

Similarly background is matched as support.constant.dom.js but making it backgroundColor change that so that it is instead matched as support.constant.js.

The grammar probably needs a bit of cleanup and should ideally scope the known CSS properties (and others) specifically so that we can easily link ⌃H to the proper documentation and similar.

Class Declaration Inheritance: Support more than identifiers

Class declarations can inherit through arbitrary expressions, examples:

class Rectangle extends aggregation(Shape, Colored, ZCoord) {
  /* ... */
}

class MyClass extends Mixin1(Mixin2(MyBaseClass)) {  
  /* ... */
}

This is LeftHandSideExpression in the ECMAScript spec.

Support Custom Tags in Docblocks

Issue #3 added support for docblocks, but only a list of hardcoded tags from JSDocs. Since JSDocs allows defining custom tags, it would be great to support a tag highlighting, regardless of what JSDocs supports.

Reformat document doesn't work in TextMate 2

Traceback (most recent call last):
File "Reformat Document / Selection", line 12, in
if os.environ["TM_SOFT_TABS"] == 'NO':
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/UserDict.py", line 22, in getitem
KeyError: 'TM_SOFT_TABS'

regexp in array

Regular expression literals are not properly recognized when immediately preceded by [ (in an array).

Examples:

[ /a.b/ ] // not highlighted
[ /a?/ ] // regex is not highlighted, but entire rest of file after `?` is highlighted as regex

pls fix the damn highlight

code example:

var example = function(a1) {

	var $class = 'unfunc';
	var $count = parseInt('1', 10) + parseInt (a1, 10);
	
	if(isNaN($count)) {
		$count = new Number(1);
	}
	
	if (isNaN ($count)) {
		$count = new Number (1);
	}
	
	switch($count) {
		case 1:
			$class = 'unfunc-one';
			break
		case 2:
			$class = 'unfunc-two';
			break;
		default:
			$class = 'unfunc-max';
	}
	
	switch ($count) {
		case 1:
			$class = 'unfunc-one';
			break
		case 2:
			$class = 'unfunc-two';
			break;
		default:
			$class = 'unfunc-max';
	}
	
	return $class;
}

and this is how it looks in textmate:
default

Comments.tmPreferences is ignored?

Currently the Javascript bundle does block comments /*..*/, regardless of how many lines are in the selection.

I would like to have line comments //. However, when I edit Preferences/Comments.tmPreferences (with Xcode) it has no effect.

I was able to get line comments by editing Source.tmbundle/Preferences/Comments.plist, but I don't want to make the change globally, just for javascript.

Auto indentation for one-line statements

In JavaScript often one-line statements are used.

Instead of

if (true) {
    doSomething();
}

you often use

if (true)
    doSomething();

But the auto indentation of Textmate 2 always wants to indent the last line to

if (true)
doSomething();

Here is a short video that shows how it looks like in Textmate: http://cl.ly/2a3q3Q1R1W1X2o3N062n

beautifier mangles `.catch()`

If I run the following code through jsbeautifier, it mangles the .catch() so that

deleteBars: function (request, response) {
  return Foo.bar(request.body.barIds, baz)
  .then(function (bars) {
    return Promise.all(_.map(bars, function (bar) {
      return bar.destroy();
    }));
  })
  .then(function () {
    response.sendStatus(200);
  })
  .catch (function (error) {
    response.sendStatus(403);
  });
}

becomes

deleteBars: function (request, response) {
  return Foo.bar(request.body.barIds, baz)
    .then(function (bars) {
      return Promise.all(_.map(bars, function (bar) {
        return bar.destroy();
      }));
    })
    .then(function () {
      response.sendStatus(200);
    })
    .
  catch (function (error) {
    response.sendStatus(403);
  });
}

This is not the behavior you get on http://jsbeautifier.org/

"Documentation for Word" is broken

Steps to Reproduce

With the JavaScript language dialect being used and a JavaScript file open:

  • Select any word (It doesn't seem to matter if it's a legit JavaScript keyword, API or any random word)
  • Use the keyboard shortcut (⌃H) to trigger the Documentation for Word command

Expected
I'd expect to be presented with documentation for the valid JavaScript keyword or some error stating it couldn't be found

Actual
I'm presented with some IIS error page

Environment
Mac OS X (10.8.4) running TextMate 2.0-alpha.9459.

I'd love to submit a patch to fix this, would you be interested in switching to Mozilla's documentation instead of DevGuru?

`static` keyword shown as invalid

Code that I'm using (from Stimulus homepage)

// hello_controller.js
import { Controller } from "stimulus"

export default class extends Controller {
  static targets = [ "name", "output" ]

  greet() {
    this.outputTarget.textContent =
      `Hello, ${this.nameTarget.value}!`
  }
}

output
image

The same thing is happening with the private keyword.

issue with indented block comment parsing

I think this is a recent regression (past few days), but I have a codebase with a tab indented comment like...

    /* Check for commands like "/msg" */

The syntax highlighting does not detect the end of the comment properly
As a result the rest of the codebase appears as if it were a literal string

If the preceding tab is removed from the comment, the rest of the codebase is highlighted properly once again (although the actual comment still isnt colored as a comment).

If the "/ and " are removed AND then indentation removed, then it highlights everything correctly

I think there's two separate issues coming into play here

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.