GithubHelp home page GithubHelp logo

coffee-script-tmbundle's People

Contributors

aseemk avatar bts avatar carlosbrando avatar chenglou avatar danemorgridge avatar drnic avatar falsefalse avatar floydj avatar infininight avatar jashkenas avatar johnburnett avatar jrus avatar kenofyugen avatar kevinsawicki avatar krikis avatar kriskhaira avatar lggarrison avatar mads-hartmann avatar markbates avatar matehat avatar michaelficarra avatar nakajima avatar paulmillr avatar qard avatar samuelclay avatar tauren avatar theupel avatar wdavidw 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

coffee-script-tmbundle's Issues

console.log showing up in function browser dropdown

consoleproblem
I'm not sure if this is a problem with textmate2 or with the bundle, but "console" calls are showing up in the function browser dropdown (and at the wrong indentation, no less).

Is there an easy fix?

Here's a small amount of code to cause this:

class Test
    constructor: ->
        console.log()

How to make syntax highlighting work?

I installed the tmbundle following the commands and I can successfully reload the bundles, however, why I don't see the change of syntax highlighting? How do I make syntax highlighting work?

period is not treated as a word separator

Using the option key in combination with the arrow keys moves the cursor to word boundaries, where a boundary is any one in the set of word separators for a language. In the tm bundles for most other languages, the period is treated as a word separator. This is not the case in the current implementation of coffee-script-tmbundle.

Linux installation path is wrong

There is no such thing as an Application dir in any Linux distro. Please don't state "tested in Ubuntu 11.04" if you didn't.

E.G: in Ubuntu 11.10, the bundle can be copied, without bein zipped, directly in .config/sublime-text-2/Packages

WIP: Help! Trying to port TextMate::UI.menu helper to coffeescript

I'm trying to recreate TextMate's Support/lib/ui.rb's #menu helper which calls out to the tm_dialog cocoa app, but my attempt is hanging textmate. I don't know NodeJS well enough to know if I'm calling out correctly (see "Show menu (demo).tmCommand" in my fork, but reproduced below too).

My attempt (which hangs TM):

dialog: process.createChildProcess dialog_cmd, ["-u"]
dialog.addListener "exit", (code) ->
  dialog.close()
dialog.addListener "output", (data) ->
  res: data.strip()

Ruby's version:

res = ::IO.popen("#{TM_DIALOG} -u", "r+") do |io|
  Thread.new do
    plist = { 'menuItems' => options }.to_plist
    io.write plist; io.close_write
  end
  OSX::PropertyList::load(io)
end

It includes the RubyCocoa call OSX::PropertyList::load(io) which I cannot find in the Xcode docco :/

Any thoughts on how I can reproduce the Ruby call in CoffeeScript/NodeJS?

I "test" my command by opening it into TextMate (Ctrl+Cmd+E, and pressing Cmd+R; that hangs TM. Also activating the command hangs TM).

Enable soft tabs

On most setups (all?), coffee script uses soft tabs (just like Ruby). I couldn't manage to enable soft tabs in this bundle, setting environment variables in the bundle's config didn't work:

    {   name = 'TM_SOFT_TABS';
        value = 'YES';
    },
    {   name = 'TM_TAB_SIZE';
        value = '2';
    },

Coffee Lint command

I added to my coffee script bundle a new command which runs CoffeeLint for making sure my coffee script is nice and clean

  • Scope Selector: source.coffee
  • Key Equivalent: ^⌘L
  • Save: Current Document
  • Output: Show in New Window Format: Html
#!/bin/bash
coffeelint "$TM_FILEPATH" | ansifilter -H;

AnsiFilter i found on homebrew and i converts shell outputs

http://www.coffeelint.org/
http://www.andre-simon.de/doku/ansifilter/en/ansifilter.html

I suppose someone can figure out if adding this into this bundle is a good thing or not... I just wanted to show other people what i have setup

Quote expansions and shortcuts

A few minor things:

  1. When I type # inside of a """ string, it should auto-expand to #{_} the same way that it does inside of a " string.
  2. Since Cmd+" generates """\n_\n""", why not make Cmd+' generate '''\n_\n'''? The shortcuts could be labeled "Generate Heredoc Quotes (double)" and "Generate Heredoc Quotes (single)." Typing heredoc strings without a shortcut in TextMate is a bit nasty, because three ' keypresses result in '''_'...
  3. When I type ###, it ought to expand to ###_###, don't you think? Or perhaps ###\n_\n### as with the heredoc quote keyboard shortcut mentioned above.

CoffeeScript v0.9.0+ style assignment in snippets

It would appear that this change in CoffeeScript assignment operators:

"0.9.0 introduces a massive backwards-incompatible change: Assignment now uses =, and object literals use :, as in JavaScript."

It hasn't bubbled back into the TextMate bundle snippets.

Just a heads-up, it's a small change to the following snippets:

Function, Class, Require

and the following Commands:

New Function

I believe that's it, thanks!
-Kris

Cannot find module issue

Hello, I am wondering if this is possible or am I doing something wrong?

the following code:

Mustache = require 'mustache'

person =
  name : "john"
  email: "[email protected]"

template = """
  <p>Hello {{name}}</p>
  <p>your email is: {{email}}</p>
"""

output = Mustache.to_html template, person

console.log output

works fine when using cat test.coffee | coffee -s through terminal, but if running with cmd+b the Run command within textmate it returns:

Error: Cannot find module 'mustache' at Function._resolveFilename (module.js:289:11) at Function._load (module.js:241:25) at require (module.js:317:19) at Object. (.:3:14) at Object. (.:11:4) at Module._compile (module.js:373:26) at Object.run (/usr/local/lib/node/.npm/coffee-script/1.0.1/package/lib/coffee-script.js:55:19) at /usr/local/lib/node/.npm/coffee-script/1.0.1/package/lib/command.js:115:29 at Socket. (/usr/local/lib/node/.npm/coffee-script/1.0.1/package/lib/command.js:149:14) at Socket.emit (events.js:39:17)

Is there any way to use require modules using textmate bundle?
It seems require 'sys' is possible though...

H1, H2, H3 Snippets Lack UUID

These three snippets lack a UUID which prevents them from being loaded in TextMate. Didn't do a pull request as I am unsure of their purpose and where they would fit in the menu structure. (You can generate a UUID with uuidgen in terminal.)

Show line numbers in Compile and Display JS

The only bad part about Coffee Script is that it reports it's errors as line numbers in the compiled result.

Is there anyway the Compile and Display JS window could show line numbers? (or even paste itself into a new TextMate document) This way it would be easier to see where the error occurred in the compiled JS from a stack trace.

"Go to Symbol" and functions in hashes

I've started to find the "Go to Symbol" prompt to be extremely useful. Unfortunately, there are a lot of problem cases with it. It seems to treat : and = interchangeably everywhere (not just in a class), so

a = -> b: ->

gives you

a
  b

but

c = -> {d: ->}

gives you

c
d

Neither seems very sensible to me; functions in objects (other than class prototypes) should be ignored, the way that functions given as callbacks are. Don't you think? Or is it more important to list every function that's assigned a symbol than to present a clean hierarchy? Keep in mind that the current behavior means that if you write

$('#item1').bind click: -> false
$('#item2').bind click: -> false
$('#item3').bind click: -> false
$('#item4').bind click: -> false
$('#item5').bind click: -> false

then you'll see "click" 5 times in the "Go to Symbol" list.

Add '.iced' as a recognized extension

IcedCoffeeScript is an extension of CoffeeScript, with two new keywords (await and defer) that look just like function calls. So the syntax highlighting for CoffeeScript is fine for IcedCoffeeScript as well.

Therefore, it would be nice if coffee-script-tmbundle recognized .iced as an extension that should be treated as CoffeeScript.

unable to run (Cannot find module 'vm')

starenka@kosmik2:~$ coffee -v
CoffeeScript version 1.1.2
starenka@kosmik2:~$ coffee

node.js:63
    throw e;
    ^
Error: Cannot find module 'vm'
    at loadModule (node.js:275:15)
    at require (node.js:411:14)
    at Object.<anonymous> (/usr/local/lib/coffee-script/lib/repl.js:6:12)
    at Object.<anonymous> (/usr/local/lib/coffee-script/lib/repl.js:123:4)
    at Module._compile (node.js:462:23)
    at Module._loadScriptSync (node.js:469:10)
    at Module.loadSync (node.js:338:12)
    at loadModule (node.js:283:14)
    at require (node.js:411:14)
    at Object.run (/usr/local/lib/coffee-script/lib/command.js:47:14)
starenka@kosmik2:~$ node --version
v0.2.4
starenka@kosmik2:~$ which node
/usr/local/bin/node
starenka@kosmik2:~$ which coffee
/usr/local/bin/coffee
starenka@kosmik2:~$ echo $PATH
/home/starenka/bin:/usr/local/bin:/usr/bin:/bin:/usr/games

Enhanced string interpolation expressions

This is a enhancement request for string interpolation expressions (not sure if it's the correct name). Basically I would like the string interpolation expressions behave like they do in the Ruby bundle.

  1. Syntax highlighting in string interpolation expressions
  2. If the cursor is in a string and I type # the bundle would add {} and place the cursor between the braces
  3. Selecting a word in a string and pressing # would wrap the word in #{}

class A.B syntax highlighting

Currently,

class Foo.Bar

highlights Foo as a class name, but not Bar. I believe the most correct behavior would be for the entire string, Foo.Bar, to be highlighted. Or, perhaps just Bar should be highlighted, since that's the name given to the constructor function.

Note that the entire string Foo.Bar is highlighted in

new Foo.Bar

Extra bonus bug: While reporting the bug above, I discovered that single-char class names aren't highlighted at all. So class A.B doesn't highlight A, while class AA.B does highlight AA.

Keywords are highlighted even when preceded by .

Say the object obj has the property return. (Hey, I didn't choose it.) Then the line

obj.return = 1

compiles just fine, but the word return is highlighted like a keyword. Likewise for any other keyword. Obviously one could type obj['return'], but it would be nice to have accurate highlighting for the dot syntax.

class folding

I added

|^\s*class\s.*$

to foldingStartMarker. I'm not sure if it covers all cases, but it's better than nothing. At least it my classes fold. ^_^

Folding does not work on functions

Folding doesn't work on coffeescript functions, only on code that looks like javascript. I changed my folding markers as follows, and while it no longer folds on {}'s (which I prefer anyway) it works properly for functions...

foldingStartMarker = '.*(->|=>)\s*$';
foldingStopMarker = '^\s*$';

Use Tabs In Snippets Instead of Spaces

Currently all the indentation in snippets is hardcoded to two spaces. If you change from using spaces to tabs in the snippets then you configure how large you want the indentation to be using soft tabs. The previous behaviour is available if you set Tab Size: 2 and Soft Tabs. If you want to indent 4 spaces instead you can set Tab Size: 4 and Soft Tabs.

Pygments support doesn't handle utf-8 characters

Hitting apple-B to compile& show a coffeescript file fails if it contains a string constant with a unicode character such as "ẚ".

For instance, if the entire file is:

'ẚ'

Hitting apple-b will fail, saying

*** Error while highlighting: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 1: ordinal not in range(128) (file "/Library/Python/2.6/site-packages/Pygments-1.4-py2.6.egg/pygments/lexer.py", line 148, in get_tokens)

According to rtomayko/rocco#10 if you add "-O encoding=utf8" to the call of pygmentize it resolves this issue.

Compiling with TextMate produces incorrect result

Compiling a coffee script file with TextMate (Compile and Display JS) gives a different result compared to compiling with coffee on the command line. This happens if I insert raw javascript with backticks and the javascript code is invalid. For example:

<% if @autoload %>

The above will be compiled into an empty expression ending with a semicolon.

Default example on README.md doesn't work

This code in textmate:

sys: require 'sys'
http: require 'http'

server: http.createServer (req,res) ->
res.writeHeader 200, {'Content-Type':'text/plain'}
res.write 'Hello, World!'
res.end()

server.listen 3000

sys.puts "Server running at http://localhost:3000/"

Produces this:
({
sys: require('sys'),
http: require('http'),
server: http.createServer(function(req, res) {
res.writeHeader(200, {
'Content-Type': 'text/plain'
});
res.write('Hello, World!');
return res.end();
})
});
server.listen(3000);
sys.puts("Server running at http://localhost:3000/");

Which as expected doesn't work:
ReferenceError: http is not defined

Changing to equals fixes it:

sys = require 'sys'
http = require 'http'
server = http.createServer (req,res) -> ...

Syntax highlighting with double-backslashes in regexes

The line

str.replace(/\\/g, '')

is perfectly valid CoffeeScript, removing all backslashes from a string. However, the regex /\\/ doesn't get highlighted. Worse, if there's a slash later on the line, then regex highlighting goes all the way up to it, e.g.

str.replace(/\\/g, '\\\\').replace(/\\"/g, '"')

highlights

/\\/g, '\\\\').replace(/

In short, the syntax highlighter isn't currently distinguishing between a single backslash (which escapes the closing / of a regex) and a double backslash (which doesn't). More precisely, it needs to ignore any even number of backslashes preceding the closing \, since the current behavior is correct for a regex like

/\\\/foo/

Enabling spell-checking for comments

I'm an inexperienced TextMate user, so be nice. ;)

With Check Spelling While Typing enabled, spelling mistakes in string literals are underlined but those in comments are not. According to the 4.10 Spell Checking

By default spell checking is disabled for source code except strings and comments

Any idea as to how I'd go about having spell-checking apply to comments as well as strings? ack spell returns no results – it would appear that the spellChecking preference mentioned in the TextMate documentation is not being specified. Why then, I wonder, does the behaviour differ from the (quoted) default?

Syntax Definition: single line comments missing character specifier

At least one TextMate command ('Continue Line Comment') relies on the scope specifying the character used to start a line comment. The coffeescript grammar is currently not following that convention.

It's a quick fix (change 2 occurrences of comment.line.coffee to comment.line.number-sign.coffee) that I have ready. I'll merge it asap.

Error: Cannot find module 'vm'

Coffee script seems to work OK in the terminal

coffee -v #=> CoffeeScript version 1.1.1

npm -v # => 1.0.6

node -v # => v0.4.8

When I try to compile to JS in TextMate I get this error:

module:238
throw new Error("Cannot find module '" + request + "'");
^
Error: Cannot find module 'vm'
at loadModule (module:238:15)
at require (module:364:12)
at Object. (/usr/local/lib/coffee-script/lib/coffee-script.js:5:8)
at Object. (/usr/local/lib/coffee-script/lib/coffee-script.js:110:4)
at Module._compile (module:384:23)
at Module._loadScriptSync (module:393:8)
at Module.loadSync (module:296:10)
at loadModule (module:241:16)
at require (module:364:12)
at Object. (/usr/local/lib/coffee-script/lib/command.js:7:18)

TextMate Shell variables:

http://cl.ly/1Y2o2W3n3V2M3U0H183I

Paths:

http://cl.ly/2T2p2A0u3d0C1h3F042K

Support IcedCoffeeScript keywords

Related to #99: When I'm editing an IcedCoffeeScript file (.iced extension), it would be nice if await and defer were highlighted as keywords (or in some way had a different color from ordinary identifiers).

In plain old CoffeeScript (.coffee), await and defer are just ordinary identifiers. So it might make sense (if it's easy to do so -- I know very little about authoring TextMate bundles) to only highlight the extra keywords if the filename is .iced. Then again, IcedCoffeeScript can run plain old .coffee files too (and runs them as IcedCoffeeScript, await/defer and all), so it's debatable whether it should be extension-sensitive.

/= messes up highlighting

For some reason, the line

a /= 255

is colored incorrectly, as are lines that follow. The _=, += and -+ operators do _not* have this problem. Looking at the .tmLanguage file, I see that /= is defined differently (line 381), preceded in the regex by

(?&lt;!\()

I don't understand the reason for this. Explanation?

Highlight escape sequences in regexp

It would be nice if escape sequences could be highlighted in regular expression literals, just as in the JavaScript and Ruby bundles. For example:

a = /\t/

In the above code, both the JavaScript and Ruby bundles highlight "\t" with a slightly brighter green than the rest of the regular expression literal.

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.