Sublime Forum

Ignoring syntax highlighting for scope

#1

I have created my own tmlanguage file, everything in it works fine, but there is a plugin that I am trying to write that copies the text in the current scope using the the view.extract_scope(region) command, which will be used as a keyboard shortcut to copy command definitions in this syntax. This works great when I add

        <dict>
      <key>begin</key>
      <string>: </string>
      <key>end</key>
      <string>;</string>
      <key>name</key>
      <string>Macro.Def</string>
    </dict>    

to my patterns array, but it removes all syntax highlighting for anything within that scope. I do also have it using the foldingstartmarker and foldingstopmarker for code folding, even though it says that those are not currently supported, it has worked for me since ST2. I guess what I am really looking for is how to add an extra scope to a region without messing with the color scheme for the area.

0 Likes

#2

What syntax are you working with? Can you provide a sample snippet?

0 Likes

#3

Its a completely custom one, but here is a larger snippet of it

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>fileTypes</key>
  <array>
    <string>uc</string>
    <string>ucp</string>
  </array>
  
  <key>foldingStartMarker</key>
  <string>: </string>
  <key>foldingStopMarker</key>
  <string>;</string>
  <key>name</key>
  <string>myLang</string>
  <key>patterns</key>
  <array>
    <!-- comments -->
    <dict>
      <key>begin</key>
      <string>\/\*</string>
      <key>beginCaptures</key>
      <dict>
        <key>0</key>
        <dict>
          <key>name</key>
          <string>comment.block</string>
        </dict>
      </dict>
      <key>end</key>
      <string>\*\/</string>
      <key>endCaptures</key>
      <dict>
        <key>0</key>
        <dict>
          <key>name</key>
          <string>comment.block</string>
        </dict>
      </dict>
      <key>name</key>
      <string>comment.block</string>
    </dict>
    <dict>
      <key>comment</key>
      <string>ANSI line comment</string>
      <key>match</key>
      <string>(?&lt;=^|\s)(` .*$)</string>
      <key>name</key>
      <string>comment.line.backslash.myLang</string>
    </dict>
    <!-- strings -->
    <dict>
      <key>match</key>
      <string>"" "</string>
      <key>name</key>
      <string>string.quoted</string>
    </dict>
    <dict>
      <key>match</key>
      <string>" "</string>
      <key>name</key>
      <string>string.quoted</string>
    </dict>
    <dict>
      <key>begin</key>
      <string>"" </string>
      <key>beginCaptures</key>
      <dict>
        <key>0</key>
        <dict>
          <key>name</key>
          <string>punctuation.definition.string.begin.c</string>
        </dict>
      </dict>
      <key>end</key>
      <string>^\\]"</string>
      <key>endCaptures</key>
      <dict>
        <key>0</key>
        <dict>
          <key>name</key>
          <string>punctuation.definition.string.end.c</string>
        </dict>
      </dict>
      <key>name</key>
      <string>string.quoted.double.c</string>
      <key>patterns</key>
      <array>
        <dict>
          <key>include</key>
          <string>#string_escaped_char</string>
        </dict>
        <dict>
          <key>include</key>
          <string>#string_placeholder</string>
        </dict>
      </array>
    </dict>
</array>
  <key>scopeName</key>
  <string>source.myLang</string>
  </dict>
</plist>
0 Likes

#4

bumping for please?

0 Likes