Comments (17)
I'm suffering from this as well.
Is there an estimate when this can be fixed?
from coffee-script-tmbundle.
Fix it yourself! It’s not too hard to learn how TM foldings work. For instance, the Python pattern is currently:
{ foldingIndentedBlockStart = '^\s*(class|def|for|while|if|elif|else|with|try|finally|except)\b.*:\s*(#.*)?$'; }
from coffee-script-tmbundle.
Well, try as I might, I cannot get it to work. Whenever I have a -> in the regex it just fails to match anything.
It almost feels as if it is canceling out with some other rule from somewhere else. Maybe you can reproduce this and report a bug to TextMate from this - I'm just puzzled.
from coffee-script-tmbundle.
Reporting as a TM bug would make sense then… After all, the same bundle worked in TM v1, I’m fairly sure.
On Mar 15, 2012, at 1:25 PM, dwt wrote:
Well, try as I might, I cannot get it to work. Whenever I have a -> in the regex it just fails to match anything.
It almost feels as if it is canceling out with some other rule from somewhere else. Maybe you can reproduce this and report a bug to TextMate from this - I'm just puzzled.
Reply to this email directly or view it on GitHub:
#87 (comment)
from coffee-script-tmbundle.
Edit: Hmm. I’m getting some real weirdness around -> as well. Am asking Allan Odgaard about it. [...]
Unfortunately, I don’t have time today to do more debugging of the CoffeeScript grammar, or to rewrite it to better follow typical TM grammar conventions. I’ll try to follow this up sometime in the next few days though.
from coffee-script-tmbundle.
Okay, @alanhogan @dwt the issue is that the grammar has foldings embedded (this is the way things were done in TM1). You have to go find the CoffeeScript.tmLanguage file on disk (an XML plist), and remove the foldingStartMarker
and foldingStopMarker
key-value pairs.
from coffee-script-tmbundle.
Okay, to mostly hit all the cases I’ve seen – and it seems to be working great – I deleted those two keys (i.e. foldingStartMarker
and foldingStopMarker
) from the language grammar itself and from any settings files, and added the following settings file:
{ foldingIndentedBlockStart = '(?x)
\b class \b | # class definition
[=-]> \s* (\#.*)? $ # line-ending function arrow
';
}
Scoped to source.coffee -(source.coffee string)
. [It’s not clear to me whether it’s desirable to fold inside block comments or not.] This won’t deal with the edge case where the word class
occurs inside a string that ends before the end of the line, or inside a comment (false positives), but those edge cases are really hard to catch without either tremendously complicating the rule or else getting false negatives, since arbitrary expressions can go inside the thing that gets assigned to a class, as in, to take an extreme example:
Baz = wrapper class a.b(c..., new (class extends Bar) '#', y: ->)[1] extends Foo
(Though admittedly, the current language grammar doesn’t bother to handle most tricky edge cases, resulting in fairly frequent wrong/missing scopes. Still, we might as well do the best we reasonably can in the folding rule, and we can fix the rest of the grammar some other day.)
from coffee-script-tmbundle.
Is this something that would get backported for TM1? Or is it a TM2-specific change?
from coffee-script-tmbundle.
The indented block foldings are TM2 specific.
from coffee-script-tmbundle.
Uhm, but that means that you can't have one bundle that works with tm1 and tm2?
I would consider that a bug, the tm2 settings should override the tm1 settings so they can coexist in one bundle allowing backwards compatibility.
If necessary Allan can add another setting that tells tm2 to override that other key and then deprecate it once tm2 is out and final.
from coffee-script-tmbundle.
That’s silly. TM1 is on the way out, and all the bundles can trivially be updated. The language grammar system, the scoping rules, and many other aspects of the app have been completely rewritten with new and better features. Once people actually start taking advantage of those, the resulting bundles will not function the same in TM1. The community hasn’t really stepped up to the plate yet to adopt all the neat new features, but it’s only a matter of time.
If you want a legacy TM1 bundle, there’s nothing wrong with keeping that one around separately someplace.
from coffee-script-tmbundle.
Well, then how do I install separate bundles for tm1 and 2 again?
from coffee-script-tmbundle.
Is there already a branch with the changes outlined above that I can test? I'll be working with coffee script quite a bit today.
from coffee-script-tmbundle.
@dwt see http://blog.macromates.com/2011/locating-bundles/
As for a branch w/ the changes above, my fork of the bundle does this, and also has improved compile/run commands.
https://github.com/jrus/coffee-script-tmbundle/
Note that I haven’t really been keeping up with jeremy’s fork, planning at some point to just rewrite the language grammar and fix up the commands &c. to be more "textmate-ish"... best laid plans and all that.
from coffee-script-tmbundle.
Am 22.03.2012 um 04:03 schrieb Jacob Rus:
Got it, thanks!
Martin
from coffee-script-tmbundle.
@jashkenas Now that TM2 is really moving again, after its OpenSourcing, can we get this in maybe? Or have a separate TM2 branch in this Repo on which this can go in?
from coffee-script-tmbundle.
+1, this is still an issue.
from coffee-script-tmbundle.
Related Issues (20)
- console.log showing up in function browser dropdown
- Syntax highlighting broken for division operator; thinks a regex has started. HOT 2
- H1, H2, H3 Snippets Lack UUID
- Wrong indent on subsequent wrapped lines in Sublime Text 2 HOT 3
- Functions named after keywords are not highlighted correctly
- Literate file markdown folding
- Pull #137 removes CoffeeScript highlighting. HOT 4
- CoffeeScript (Literate) is in bundle list but not CoffeeScript
- Incorrect Syntax Highlighting (regex string)
- a = 1/4 oranges everything afterwards HOT 2
- Building CoffeeScript in Sublime Text on Win 7
- Highlight error when regular expression contains hashes
- [grammar] Variable name in assignment includes the space before the equal sign HOT 2
- Snippets inside literate files HOT 1
- Improper highlighting of multi-line function definitions HOT 2
- License? HOT 1
- Parsing bug with slashes (/) inside brackets ([]) HOT 2
- Issue with CoffeeScript block comment syntax on Github viewer
- env: node: No such file or directory
- Unable to install bundle on OSX 10.13.1 (17B1003)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coffee-script-tmbundle.