Home Download Buy Blog Forum Support

Ignoring syntax highlighting for scope

Ignoring syntax highlighting for scope

Postby DemonixFox on Fri May 30, 2014 4:33 pm

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

Code: Select all
        <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.
DemonixFox
 
Posts: 4
Joined: Fri May 30, 2014 4:28 pm

Re: Ignoring syntax highlighting for scope

Postby FichteFoll on Tue Jun 03, 2014 9:27 pm

What syntax are you working with? Can you provide a sample snippet?
FichteFoll
 
Posts: 408
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: Ignoring syntax highlighting for scope

Postby DemonixFox on Tue Jun 03, 2014 10:15 pm

Its a completely custom one, but here is a larger snippet of it
Code: Select all
<?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>
DemonixFox
 
Posts: 4
Joined: Fri May 30, 2014 4:28 pm

Re: Ignoring syntax highlighting for scope

Postby DemonixFox on Thu Jun 12, 2014 12:28 am

bumping for please?
DemonixFox
 
Posts: 4
Joined: Fri May 30, 2014 4:28 pm


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests