Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7549355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:55:52+00:00 2026-05-30T09:55:52+00:00

The way TextMate parses the current context – in a Javascript statement – is

  • 0

The way TextMate “parses” the current “context” – in a Javascript statement – is flawed. I love the editor… but I HATE having to be so manually-vigilant in my day-to-day bracket-matching.

See below – a scenario in which Textmate incorrectly “sees” the brackets in commented lines, and “matches them” with uncommented code!

wrong Context, dumbie!

Here is the code, if you have images turned off, or use Lynx, or something crazy, like that..

$('.parishilton').live( 'fartOn', function() {
    sexy = $('#thatshot').fadeOut('fast');
    /** $('shouldnt').matchThis(function(){ */
    //  $('or').thisOneEither(function(){
    }); //  Textmate thinks I should be here!
    }); //  Me too!
});     //  ONLY this one should "match".

This is made evident when using the built-in ⬆+⌘+B to highlight the current scope, as well as when passing through them with the insertion point – which “pops” the incorrectly matched (commented) brackets. (Impossible to screenshot, sorry)

Xcode does a better job of matching the context, and recognizing the syntax.. but I can tell – it too struggles with this. (Made evident by flaky folding, etc with such structures.) At least Xcode knows this is WRONG.. where as ™ will let you go on and on… Thinking all is well.. Even when your brackets are seriously f*%#@*d.

Is Javascript just hard for syntax analyzers to “know for sure” what is going on? Is there a “better” syntax for comments that I could be using? In the above example I’ve tried both C-style /** comment */, as well as // comment notations… but both seem to suffer the same shortcomings?

Or is this just a case of a poor implementation in TextMate? If so, is there a plist or something I can muck with to try and improve the state of affairs?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:55:54+00:00Added an answer on May 30, 2026 at 9:55 am
    • JavaScript can be hard to parse, indeed, specially when you use error-ridden callback-spaghetti code like in your sample. I seem to remember that TextMate’s parsing is regexp-based. If I’m correct that kind of system is not very smart or flexible. FYI Vim exhibits the same behaviour.

    • TextMate doesn’t do syntax-checking at all. It doesn’t run your code through a build process or some static analysis tool at each key press. That’s why it’s bad at spotting and showing mistakes. TextMate is not an IDE, it’s a text editor.

    • The corollary to the previous points is that you should – at least – run your code through jslint or jshint to spot mistakes. There’s a bundle for that called “JavaScript Tools” IIRC. Once you know where the problems are – according to your SA tool of choice – you can fix them without relying on TextMate’s limited syntax-checking abilities. This step (syntax checking) is a crucial part of any serious coding – however high or low your level of expertise is -, you may be able to automate it.

      That said, if you write a lot of code like that, jslint may not be enough for your needs. Here is a screenshot of your code in Vim after running jslint through syntastic:

      enter image description here

      Errors are spotted one at a time, here. Fixing your code is sure to be a long and boring process. It’s not always like that, of course, but it can – and does – happen.

      Syntax checking as never been and is not part of TextMate’s overall design.

      I don’t know what’s planned for TM2 (lost patience, switched to Vim). Maybe live syntax checking is in the pipe, maybe it isn’t. I don’t know and I don’t care.

    • An option, if you don’t like that part of TextMate’s design, would be to drop it and use an IDE like Eclipse or Komodo or NetBeans or WebStorm or Aptana… That range of programs typically run all kinds of background processes as you type specifically to prevent that kind of problem. Here is a screenshot of your code in Eclipse:

      Eclipse

      As you can see, Eclipse doesn’t match the bracket at the cursor with anything and it shows useful warnings where you have orphaned brackets and semicolons.

      $ideName is obviously not as sexy as TextMate but it’s definitely more powerful in that kind of scenario.

      Think about it.

    • A second option is to use TextMate’s own “Bundle Editor” to alter JavaScript’s syntax definition. And propose your changes to the ones in charge at Macromates.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my editor setup to be textmate but when I do a git
Is there any way to get MacVim to scroll more smoothly TextMate style? While
Is there a way to make TextMate automatically add a closing HTML tag when
Textmate - Is there a shortcut for selecting matching HTML tags or another way
In the Textmate code-editor I use the Escape-key, for word completion, alot. Is there
I am thoroughly in love with TextMate . I program everything in it, including
I've used Textmate for a couple of years, but for Objective-C I'm finding that
Is there a simple way to replace commas with tabs in Textmate, hopefully using
I'm not very good with regular expressions but in Textmate, I'm trying to clear
I love text mate, but sometimes I do miss some IDE features. One of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.