Open topher515 opened 12 years ago
This is also happening to me.
For me, at least, it looks like $project_path
is not being set correctly in all cases. It seems this is an issue with Sublime.
Does this fix it? I don't know why that would fix it but apparently it works.
I did try removing and reinstalling the package. That fixed the "Error parsing plist xml" issue. But I am still unable to run the build system. I am seeing a "Cakefile not found" error similar to Topher515's.
It is assumed that your .sublime-project
file will be in your project's base directory. It is also assumed that the Cakefile
will be there too. This is because of a limitation with build systems that means I am unable to determine your project's actual directory - the one added via Project » Add Folder(s) to Project - see the docs.
Currently the build system is using $project_path
which means, the directory containing the .sublime-project
file.
If I don't specify a working directory for the build system, then Sublime will default to the directory containing the file that is focused when you run the build system. The problem with that is it will also look for the Cakefile
in the same place.
So you need to put your .sublime-project
in your project directory along with your Cakefile
. If you don't want it in source control then you can add it to your .gitignore
.
Does this solve the issue?
I added an empty Cakefile
and .sublime-project
at my project's root. That helped a little. Now I get the following message when I run the build:
No such task: sbuild
To see a list of all tasks/options, run "cake"
I've never had a Cakefile
or a .sublime-project
in my project directory tree until now.
It occurs to me now that I've probably been using this plugin incorrectly. The build system is meant to be used with a Cakefile. I just naively used the build system without knowing anything about cake.
What the build did before recently is created a .js
file in the same folder as the .coffee
file I had highlighted. This was not useful as a build system, but it did provide feedback about any syntax errors.
I will read up on cake and add a meaningful Cakefile to my project.
For those of us who were using this plugin without a Cakefile, is it possible to restore this default behavior?
That's all the build system does - it runs a Cake task which you would define in your Cakefile
as such:
task 'sbuild', ->
doStuff()
andThings()
Typically this is where you would say concatenate your files, minify them, or whatever else building your project entails... which could be a myriad of things which is why it is done this way.
I was fairly certain there was also a Compile File command that would compile the current file to CoffeeScript but it appears I was wrong about that. I'm guessing the reason no one has complained about it yet is because everyone uses the coffee
command line utility to compile their files, presumably with the --watch
option.
For the moment, you can use alt+shift+d
and then save the generated javascript file manually. I will add the missing Compile File command now, literally the package will be updated in 10-20 minutes.
If you're interested, in an upcoming update you will be able to just use watch integration.
Windows decided to hard crash so that took a little longer than expected. You can now use alt+shift+c
to compile the current file.
Pinging @topher515.
@deweller By the way, alt+shift+s
will run a syntax check and display the status in the status bar.
Well would you look at that! It turns out that alt-shift-s
is exactly what I wanted and I didn't even know it.
I would probably be amazed at the treasure trove of helpful information I might find if I read the documentation.
Thanks for your help on this.
Indeed, GitHub shows the documentation right there at the forefront for a reason. :smile:
@Xavura, thanks for addressing this so quickly!
When I use alt-shift-s
command it compiles the current CoffeeScript file into a new file which I then need to save as .js
file.
The behavior which I originally used out-of-the-box was: cmd-b
compiles the current CoffeeScript file into a Javascript file of the same name (but with a .js
extension of course) and silently saves (w/ overwrite) in the background.
With the latest commit (fb04af1976), the cmd-b
command continues to error with Error("Cakefile not found in " + (process.cwd()))
.
Is there a way to get this behavior back? I realize that having a proper cakefile
is great in many cases but I also have several projects which simply dont warrant the complexity.
You want alt±shift+c
(c for compile).
Regarding ctrl+b
, that's a shortcut for F7
and that does this.
Regarding your error, I think I know what the problem may be. I'll look into it, you're on Windows right?
Regarding the cmd+B
error--no, actually I'm running OS X 10.7.
Regarding the alt-shift-c
--Great, that's actually exactly what I was hoping for.
Good to hear and I see the problem now, I'll fix it in the next update.
Great! Thanks!
My install didn't seem to be broken as mentioned in the original post, however the symbol list wasn't indenting properly and it was displaying unnecessary symbols (console, Object, etc). When I installed the files directly from https://github.com/jashkenas/coffee-script-tmbundle it worked (once I moved around some files from their subdirectories).
The problem can also be fixed if I install your plugin and then copy the "Symbol List*.tmPreferences" files from the "preferences" folder from jashkenas's repo straight into your plugin folder. Perhaps Sublime Text 2 added the need for these Symbol List files in the latest build? Looks like maybe you need to include them in your plugin?
Thanks for your work on this plugin.
It would still be very nice to use cmd-B without a cakefile, as it works with Less. It would be cool to simply remember one shortcut. Is there any easy way to achieve this?
i modified CoffeeScript.sublime-build
{
// "path": "$HOME/bin:/usr/local/bin:$PATH",
"cmd": ["coffeelint -f ~/.coffeelint --nocolor -q $file"],
"file_regex": "([^\\s]+\\.coffee)$",
"line_regex": "#(\\d+):(.*)$",
"selector": "source.coffee, source.litcoffee, source.coffee.md",
"shell": true,
"osx": {
"path": "~/:/usr/local/share/npm/bin:/usr/local/bin:/opt/local/bin"
}
}
be careful with your path!
default ~/.coffeelint
{
"no_tabs" : {
"level" : "error"
},
"no_trailing_whitespace" : {
"level" : "error"
},
"max_line_length" : {
"value": 80,
"level" : "error"
},
"camel_case_classes" : {
"level" : "error"
},
"indentation" : {
"value" : 2,
"level" : "error"
},
"no_implicit_braces" : {
"level" : "ignore"
},
"no_trailing_semicolons" : {
"level" : "error"
},
"no_plusplus" : {
"level" : "ignore"
},
"no_throwing_strings" : {
"level" : "error"
},
"cyclomatic_complexity" : {
"value" : 11,
"level" : "ignore"
},
"line_endings" : {
"value" : "unix",
"level" : "ignore"
},
"no_implicit_parens" : {
"level" : "ignore"
},
"no_stand_alone_at" : {
"level": "ignore"
}
}
Attempts to build any Coffeescript file using the Sublime Text build system results in the following error: