Home Download Buy Blog Forum Support

Modifying shellVariable values

Modifying shellVariable values

Postby gcarver on Thu Sep 06, 2012 11:32 pm

using view.meta_info("shellVariables", apoint) will get a list of name/value pairs
I have created a custom TM_CLASS variable I use in snippets to fill in the namespace on a C++ method such as with

file "Packages/C++/Class (C++).tmPreferences":
Code: Select all
<?xml version="1.0" ?><!DOCTYPE plist  PUBLIC '-//Apple Computer//DTD PLIST 1.0//EN'  'http://www.apple.com/DTDs/PropertyList-1.0.dtd'><plist version="1.0">
  <dict>
    <key>name</key>
    <string>ClassName</string>
    <key>scope</key>
    <string>source.c, source.c++, source.objc, source.objc++</string>
    <key>settings</key>
    <dict>
       <key>shellVariables</key>
       <array>
          <dict>
             <key>name</key>
             <string>TM_CLASS</string>
             <key>value</key>
             <string>MyClassName</string>
          </dict>
       </array>
    </dict>
    <key>uuid</key>
     <string>38DBCCE5-2005-410C-B7D7-013097751AC9</string>
  </dict>
</plist>


The snippet:
void $TM_Class::MyMethod()

will expand to:

void MyClassName::MyMethod()

The meta_info is read only however and to change the value of TM_CLASS I need to xmlwrite a "C++/Class (C++).tmPreferences" file with the new class name set for the value of the TM_CLASS entry.
This seams a little wasteful to me. If we had a way of setting the values in the "shellVariables" meta info it would shorten the process.
For me a non-persistent value is fine but I understand for a complete feature you would probably want to save the changes and that complicates things a bit.
Anyway I thought I would bring this feature request up just in case.

Thanks,
Guy Carver
gcarver
 
Posts: 5
Joined: Thu Aug 30, 2012 3:37 am

Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Majestic-12 [Bot] and 6 guests