[TxMt] Re: Spell checking not working in text.html.php strings

Allan Odgaard mailinglist at textmate.org
Mon Sep 7 19:54:45 UTC 2015


On 7 Sep 2015, at 4:54, Quinn Comendant wrote:

> So the top item (the culprit) is "Spell Checking: Disable for Source", 
> which disables spellchecking (see screenshot). However, in the Source 
> bundle, there is also a setting for "Spell Checking: Enable for 
> Strings" (with a scope selector of `^ source string.quoted - 
> punctuation`) but it doesn't seem to be applying here, even though I'm 
> in a string.

It’s caused by the leading `^`. This means that `source` must be the 
root scope.

The reason can be found here: 
https://github.com/textmate/source.tmbundle/commit/e3c3e64fbe43f93e24a002e6aa052646525a1faa

   We enable spell checking for strings in the source scope which
   allows sensible spell checking. However inside of the text scope we
   want to not enable these when they appear in embedded source code
   (eg: PHP) as it is more common to want to have spell checking
   enabled in text files without getting it in the source portion.

Perhaps though, this was a mistake, as you’re the second person to be 
confused by the lack of spell checking in source strings, when the 
source is embedded in a text scope.

> Also attached is a screenshot of the scope for this string (I notice 
> "string.quoted.double.php" is not at the top of the stack of scopes, 
> which I would expect it to be).

The top of the stack is the root scope, i.e. the least specific. So it 
should be toward the bottom.

The attribute scopes are at the bottom, which makes them the most 
specific, which may seem unintuitive, but it’s because things bound to 
an attribute scope should generally trump everything. For example ⌘B 
is build when the project has a build file, even in an HTML file (when 
there is no selection), where ⌘B would normally insert a pair of 
`<strong>` tags.

> Can you recommend how to make "Spell Checking: Enable for Strings" 
> work for me?

You can make a new setting using `string.quoted.double.php` as scope 
selector and it will be more specific than the one that disables 
spelling (because the most specific part of the scope we match is longer 
than in the default setting).

Alternatively you can edit the _Source_ bundle and remove the leading 
`^`.

Though for the latter, I’ll ask Michael to make this change.


More information about the textmate mailing list