Coder Social home page Coder Social logo

aponxi / sublime-better-coffeescript Goto Github PK

View Code? Open in Web Editor NEW
437.0 437.0 64.0 695 KB

Syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.

Home Page: http://aponxi.github.com/sublime-better-coffeescript/

Python 100.00%

sublime-better-coffeescript's People

Contributors

alexdowad avatar aponxi avatar arjansingh avatar ashtuchkin avatar btmills avatar cdloh avatar cryrivers avatar danielkcz avatar daquirm avatar donovanhide avatar ehuss avatar exromany avatar fichtefoll avatar johnogle222 avatar lavrton avatar mattschofield avatar mfkp avatar mitranim avatar philippotto avatar ppvg avatar radcool avatar spencermountain avatar stared avatar sunln avatar szhu avatar turtlepie avatar vgel avatar wbond avatar whoaa512 avatar xavura 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

sublime-better-coffeescript's Issues

Setting the 'compileDir'

Okay, so I've organized my project as follows:

/projectroot/coffee
/projectroot/js

I want the coffee-script in 'coffee' to compile into 'js'. I set my compileDir to '../js/' since that should be the relative path from my coffee-script directory. However, whenever I try to compile, it doesn't save to 'js'. If I just set compileDir to 'true' it'll compile in 'coffee' just fine.

I hope I'm being stupid and just forgetting something. Any thoughts?

Refreshed onSave after closing tab that shows the compiled javascript

Maybe this is linked to issue #23

After closing the tab that shows the watched, compiled js; we still get "Refreshed" message in the console when we change something then save it.

IIRC this is for refreshing the output if there was a change done. Either we are cluttering the console with false "Refreshed" output, OR we are actually compiling but not displaying anything, thus cluttering the memory.

env: node: No such file or directory

I am running OSX 10.8.2, Sublime Text 2.0.1, sublime-better-coffeescript v2013.01.26.20.45.16, which I installed with Package Control. I tried the following in a file named script.coffee:

-> "Hello World"

and I obtained:

env: node: No such file or directory

My coffee executable is located at /usr/local/share/npm/bin, the global location for npm when node is installed with brew, so I set "binDir": "/usr/local/share/npm/bin" in the settings.

My node executable is located in /usr/local/bin, but I can't set that, and I think /usr/local/bin is already in my Sublime Text 2 path.

Pressing Option+Shift+C yields Compilation failed in the status bar.

If I run the file with Command+Shift+B, I obtain:

[Errno 2] No such file or directory
[cmd:  [u'coffee', u'/Users/alex/Media/GitHub/sc6-telemetry-code/tel/script.coffee']]
[dir:  /Users/alex/Media/GitHub/sc6-telemetry-code/tel]
[path: /usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

And of course Command+B yields:

[Errno 2] No such file or directory
[cmd:  [u'cake', u'sbuild']]
[dir:  /Users/alex/Media/GitHub/sc6-telemetry-code/tel]
[path: /usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin]
[Finished]

I don't want to make a Cakefile. I should be able to compile a single source.coffee file into something like source.js.

C/C++ Goto Symbol broken by this package

This package nearly completely breaks goto symbol for C/C++. It causes sublime to use the entire function definition, rather than just the function name. This issue occurs in both Sublime text 2 & 3, and I have verified that it goes away as soon as this package is removed, and comes back when it is reinstalled.

Behavior with this package:
Screen Shot 2013-03-22 at 10 44 58 PM

Behavior without this package:
Screen Shot 2013-03-22 at 10 45 39 PM

Output should show the compile errors

ReferenceError: marked is not defined
at Object. (.:4:3)
at Object. (.:78:4)
at Module._compile (module.js:449:26)
at Object.exports.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:83:25)
at compileScript (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:177:29)
at Socket.compileStdio (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:215:14)
at Socket.EventEmitter.emit (events.js:93:17)
at Pipe.onread (net.js:417:51)

I wanna see that.

Test ride

We have just moved to the Sublime Text 3 by default (master) branch. Test things out a bit.

Thank you. :trollface:

Add output panel

Have the results shown too, by a command.

Tip: take --print arg off the coffee command

Simple preview support?

Essentially, I have a build tool (Grunt) that does all my CoffeeScript compilation, so I don't actually need to have Better CoffeeScript doing the file compilation for me, however I would like to be able to "preview" the output in a window for inspection (much like CoffeeCompile does).

Is this kind of workflow available with Better CoffeeScript?

A little lag when writing comments and on save

I experience a little lag when writing comments like # something something

Maybe increase the delay to a second?

Also saving when refreshing or after a refresh (couldn't tell) sent a message that said the plugin may be unresponsive. Check out saving delays (i forgot how I wrote the method), if there isn't one put one.

Add approximate line number tracking

When working with a large Coffee Script, when you make changes on the bottom of the document, most likely you would want to view that portion of the compiled JS on the output.

st3 display javascript

Display javascript in the st3 branch gives you this error in console, dont know what to do about it :/

Thanks for making this project!

Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 543, in run_
    return self.run(edit, **args)
  File "/Users/andreas/Library/Application Support/Sublime Text 3/Packages/Better CoffeeScript/CoffeeScript.py", line 133, in run
    res = brew(args, Text.get(self.view))
  File "/Users/andreas/Library/Application Support/Sublime Text 3/Packages/Better CoffeeScript/CoffeeScript.py", line 42, in brew
    return run("coffee", args=args, source=source.encode('utf-8'))
  File "/Users/andreas/Library/Application Support/Sublime Text 3/Packages/Better CoffeeScript/CoffeeScript.py", line 31, in run
    proc = Popen(command, env=env, cwd=cwd, stdout=PIPE, stderr=PIPE)
  File "X/subprocess.py", line 818, in __init__
  File "X/subprocess.py", line 1344, in _execute_child
  File "X/subprocess.py", line 1344, in <listcomp>
  File "X/os.py", line 800, in fsencode
TypeError: expect bytes or str, not NoneType

ReWrite Wiki/Readme

The wiki pages are a mess, not to mention the outdated Readme... Fix those.

watchOnSave option

Investigate if that is really necessary. I know at some point I have added that for future expansion purposes... I don't think it is useful at all to have it lying there.

Unicode Decode Error

Add utf-8 encode/decode to prevent unicode decode errors. these occur when you have a symbol in the coffeescript and try to compile it.

`@` is not highlighted

Attributes and methods of a class are different,
I think it's better to highlight the @ to make it striking.

sublime 3.0 support

Would be nice with support for sublime text 3.0 for the context menus and keyboard shortcuts.

"Indentation: Reindent lines" command never deindent lines

I don't know if I am doing something wrong but I can't get the indentation to work correctly.

When I use the reindent command it never deindent any lines and when I tries to create a list of objects the autoindent always adds a new indentation level.

Does the indentation works for anyone else or am I doing something wrong?

class Demo
    constructor: ->
        alert("Foo")

    example: (data) ->
        alert("Bar")
        for row in array
            alert("Baz")

    @settings = [{test: 'a'},{
        test: 'b'
        }, {
            test: 'c'
            }, {
                test: 'd'
                }]

after Ctrl+Shift+P, "Reindent lines" it looks like this


class Demo
    constructor: ->
        alert("Foo")

        example: (data) ->
            alert("Bar")
            for row in array
                alert("Baz")

                @settings = [{test: 'a'},{
                    test: 'b'
                    }, {
                        test: 'c'
                        }, {
                            test: 'd'
                            }]

I am running a new Linux Mint 14 Nadia and my Sublime Text is version version 2.0.1, build 2217. I installed the package using the Package Control tool.

The installed coffeescript version is 1.6.1

Auto-indent after `else\n`

When pressing enter after while, for and if, the new line is indented one extra step automatically. However, that's not the case with else. I would like the same behavior there! (But not when else is followed by something on the same line, just like it works for if condition then doThat()).

'it' is colored

it-sublime
As on screenshot (itemdblclick), 'it' in the beginning of words is colored differently.

Selection and auto refresh

by default it compiles either the whole coffee file or the selection. However when you select somestring and hit { to put brackets around it or something; as it puts brackets around it and then selects {somestring}, it compiles that and outputs it.

Maybe disable selection compiling completely? We could use the "compile" command to compile a selection... To do this we must first close #3 so that "compile" command uses the same output view as the watch mode.

empty config

After installing the plugin there is this error at ST2 startup.

Error trying to parse settings: No data in ~/.config/sublime-text-2/Packages/User/CoffeeScript.sublime-settings:1:1

can be solved by puttin [] in CoffeeScript.sublime-settings.

save js file in current dir with default setting on compile command

Hi. It seems that plugin is not working as it should with default setting. It must generate js file on compile in current dir. Have solution:

replace CoffeeScript.py line 84:

args = ['-c', self.view.file_name()]

with

args = ['-c', os.path.split(self.view.file_name())[1]]

windows 7 x86, [email protected], sublime text 2.01.2217, sublime-better-coffeescript version 0.6.31 (2013-01-26)

Readme enhancements

  • create a to-do list
  • Define the st3 and st2 versions in a better manner so that people know there are two versions
  • Provide links to each other to make it easier to find how to install ST2
  • Add st2 to the package manager list (it should be possible by changing the zip file in package.json)
  • Edit st2 readme
  • close this issue

Change relativeDir settings

Hi. Would you like to change current model of relativeDir setting to next scheme:

"compileDir": false,                    // if compiled file's path not exist in compilePaths then use this rule
"compilePaths": {
    "/app1/coffee": "/app1/js",         // compile from /app1/coffee to /app1/js
    "/app2/coffee": "../js",            // compile form /app2/coffee to /app2/js
    "/app3/coffee": "/app1/js/app3-js"  // compile from /app/3/coffee to /app1/js/app3-js
}

Automatically 'watching' CoffeeScript files and generating JS files.. when mode is toggled off

Love the plugin! But on one of my machines, I can't seem to get the toggle watch mode to turn off. It keep generating JS files, which end up taking precedence in my rails asset pipeline :/

Here is the log output.

startup, version: 2217 osx x64 channel: stable
executable: /Applications/Sublime Text 2.app/Contents/MacOS/Sublime Text 2
working dir: /
packages path: /Users/kempair3/Library/Application Support/Sublime Text 2/Packages
settings path: /Users/kempair3/Library/Application Support/Sublime Text 2/Settings
PackageSetup not required
catalogue loaded
found 7 files for base name Default.sublime-keymap
found 1 files for base name Default.sublime-mousemap
found 4 files for base name Main.sublime-menu
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/BracketHighlighter/BracketHighlighter.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/BracketHighlighter/Elements.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/BracketHighlighter/bracket_plugin.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/CSS/css_completions.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/comment.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/copy_path.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/delete_word.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/detect_indentation.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/duplicate_line.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/echo.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/exec.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/fold.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/font.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/goto_line.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/indentation.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/kill_ring.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/mark.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/new_templates.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/open_file_settings.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/open_in_browser.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/paragraph.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/save_on_focus_lost.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/scroll.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/set_unsaved_view_name.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/side_bar.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/sort.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/swap_line.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/switch_file.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/transform.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/transpose.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Default/trim_trailing_white_space.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Diff/diff.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/HTML/encode_html_entities.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/HTML/html_completions.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/JS2Coffee/JS2Coffee.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/Package Control/Package Control.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/SCSS/scss_completions.py
Reloading plugin /Users/kempair3/Library/Application Support/Sublime Text 2/Packages/sublime-better-coffeescript/CoffeeScript.py
plugin init time: 0.137
loading bindings
loading pointer bindings
found 1 files for base name Default.sublime-theme
theme loaded
app ready
pre session restore time: 0.273326
using gamma: 1 (err: 0)
wrote startup cache, added files: 7 orphaned files: 0 total files: 106 cache hits: 99
startup time: 0.409295 (package setup was not run)
loaded 1112 snippets
Package Control: No updated packages
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_profile_shared.haml with encoding UTF-8
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_profile_shared.haml with encoding UTF-8
Compiling on save...
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_profile_shared.haml with encoding UTF-8
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_profile_shared.haml with encoding UTF-8
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_profile_shared.haml with encoding UTF-8
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_profile_shared.haml with encoding UTF-8
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_template_scoped_add_to_collection.haml with encoding UTF-8
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_profile_shared.haml with encoding UTF-8
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_template_scoped_add_to_collection.haml with encoding UTF-8
Compiling on save...
Writing file /Users/kempair3/GitHub/HumanCloud/app/views/dashboard/templates/angular/_hiiro_template_scoped_add_to_collection.haml with encoding UTF-8
Compiling on save...
Writing file /Users/kempair3/GitHub/HumanCloud/app/assets/javascripts/angular/directives/scoped_add_to_collection.js.coffee with encoding UTF-8
Compiling on save...

Also, a quick image of my other plugins, in case there is some conflict.
scoped_add_to_collection js js HumanCloud

At first, I thought I was leaving the 'watch mode' on. But when I go to 'toggle it', it actually turns it on. Also, and deleted the JS files and then closed sublime and re-opened it, and upon opening the coffee files, the JS files appear again.

I have also confirmed that it's this plugin, because the issue immediately disappears upon uninstallation.

Hope that helps! Keep up the great work.

Feature request: better lint support

What do you think about add better lint support?
Tools:

  • coffee -l
  • coffeelint

Also I think it is possible to add jshint support (with back to coffee report).

not installing

I am trying to install with package controll but it didn't work. it says it was successful, but it was not

Change filenames

Finally branch out from CoffeeScript.

Name files as Better_CoffeeScript

@ (this) doesn't get highlighted

You might know that @ (at) is a shorthand for this in CoffeeScript. It doesn't get highlighted in Sublime Text 2.0.2, SBC 0.7.0.

Also, you might want to make sure that @ can be highlighted without anything after it (i.e. highlight both @ and @foo).

General Future Features

  • Generate User settings if doesn't exist
  • Make error display on somewhere else when using watchmode

compileOnSave

I have added ability to automatically compile all .coffee files on save. It would be nice if you could add this. I dont speak python, so I have no idea if this code is right - although it works and helps me a lot!

In package settings:

{ "compileOnSave": true }

In code, prepend to beggining of on_post_save:

def on_post_save ( self, view):
    compileOnSave = settings.get('compileOnSave', False)
    import os.path
    ext = os.path.splitext(view.file_name())[1]
    if compileOnSave and ext=='.coffee':
        args = ['-c', view.file_name()]
        no_wrapper = settings.get('noWrapper', True)
        if no_wrapper:
            args = ['-b'] + args
        result = run("coffee", args=args)
        if result['okay'] is True:
            status = 'Coffee Succeeded '+view.file_name()
        else:
            status = 'Coffee FAILED: '+result['err'].splitlines()[0]
        later = lambda: sublime.status_message(status); print status
        sublime.set_timeout(later, 300)
    # ..rest of the code..

Btw, you may also want to add " +result['err'].splitlines()[0] " to status message after compilation in CompileCommand fails, so that people can instantly see what's wrong.

Set input/output directory

It whould be very handy to allow users setting the --output and --compiler options of the coffee-script compiler.

Currently, the compiled js file is generated in the coffee file parent folder.
Having a src/ folder for coffee script and a lib/ folder for compiled js is a common project layout.

Thanks a lot !

'coffee' is not recognized as an internal or external command,

I know this is not something directly related with this package but anyway I'm new to Sublime Text so any help will be great. Looks like the app can't locate to the correct dir to run the command and it probably should be fixed through the Environment Variables. I just don't know what location should I point to?
Looking for coffee.bat or .exe and can't find one.

Windows 7
Sublime Text 2

how to support TypeScript

First, thanks for all your hard work on this - both a timesaver and also learning tool.

Second, how hard would it be to port it over to TypeScript? Would you be able to give me some pointers on how to get started?

Need a way of telling if output is open or closed

The option for compile_output_on_save works for now, but I want it to be smarter. I want it to update the panel when the panel is seen, if it's hidden it shouldn't spend any precious cpu to update it.

Check the .sublime-project file

Is there any way to create custom preferences inside the .sublime-project settings object?
I would like something like that:

{
    "folders":
    [
        {
            "path": "/Users/etc...",
            "folder_exclude_patterns": [ "node_modules" ]
        }
    ],
    "settings":
    {
        "sublime-better-coffeescript":
        {
            "compileOnSave": false
        }
    }
}

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.