2014-09-27 81 views
-1

我的目標是使用text.html.django語法擴展text.html語法,因此(例如)在處理非Django html文件時,不會顯示僅限Django的自動補全。與source.pythonsource.python.django一樣的東西。如何製作子語法?似乎需要語法「類別」

Djaniero package不只是這一點,並使用PackageResourceViewer,我複製這兩個語法文件並將其保存到我的用戶目錄(兩者都是下文)。

它不工作,我不知道是否是因爲安裝時Djaniero中,這些語法在一個類別中列出:

screenshot

但是,當我卸載Djaniero,我的語法不顯示在同一個清單中。在Djaniero資源文件中,我沒有發現任何明顯的如何使這個類別。

如何創建此語法類別?或者如果那不是問題,我錯過了什麼?

謝謝。


C:\Users\jeffy\AppData\Roaming\Sublime Text 3\Packages\User\syntax_definitions\Python Django.tmLanguage

<?xml version="1.0" encoding="UTF-8"?> 
<!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>fileTypes</key> 
    <array> 
     <string>py</string> 
    </array> 
    <key>foldingStartMarker</key> 
    <string>^\s*(def|class)\s+([.a-zA-Z0-9_ b]+)\s*(\((.*)\))?\s*:|\{\s*$|\(\s*$|\[\s*$</string> 
    <key>foldingStopMarker</key> 
    <string>^\s*$|^\s*\}|^\s*\]|^\s*\)</string> 
    <key>keyEquivalent</key> 
    <string>^~P</string> 
    <key>name</key> 
    <string>Python Django</string> 
    <key>patterns</key> 
    <array> 
     <dict> 
     <key>match</key> 
     <string>(meta|models)\.(Admin|AutoField|BigIntegerField|BooleanField|CharField|CommaSeparatedIntegerField|DateField|DateTimeField|DecimalField|EmailField|FileField|FilePathField|FloatField|ForeignKey|ImageField|IntegerField|IPAddressField|ManyToManyField|NullBooleanField|OneToOneField|PhoneNumberField|PositiveIntegerField|PositiveSmallIntegerField|SlugField|SmallIntegerField|TextField|TimeField|URLField|USStateField|XMLField)\b</string> 
     <key>name</key> 
     <string>support.type.django.model</string> 
     </dict> 
     <dict> 
     <key>match</key> 
     <string>django(\.[a-z]+){1,} </string> 
     <key>name</key> 
     <string>support.other.django.module</string> 
     </dict> 
     <dict> 
     <key>match</key> 
     <string>(ABSOLUTE_URL_OVERRIDES|ADMIN_FOR|ADMIN_MEDIA_PREFIX|ADMINS|ALLOWED_HOSTS|ALLOWED_INCLUDE_ROOTS|APPEND_SLASH|AUTHENTICATION_BACKENDS|AUTH_USER_MODEL|AUTH_PROFILE_MODULE|CACHE_BACKEND|CACHE_MIDDLEWARE_ALIAS|CACHE_MIDDLEWARE_ANONYMOUS_ONLY|CACHE_MIDDLEWARE_KEY_PREFIX|CACHE_MIDDLEWARE_SECONDS|CSRF_COOKIE_DOMAIN|CSRF_COOKIE_NAME|CSRF_COOKIE_PATH|CSRF_COOKIE_SECURE|CSRF_FAILURE_VIEW|DATABASES|DATABASE_ENGINE|DATABASE_HOST|DATABASE_NAME|DATABASE_OPTIONS|DATABASE_PASSWORD|DATABASE_PORT|DATABASE_USER|DATABASE_ROUTERS|DATE_FORMAT|DATE_INPUT_FORMATS|DATETIME_FORMAT|DATETIME_INPUT_FORMATS|DEBUG|DEBUG_PROPAGATE_EXCEPTIONS|DECIMAL_SEPARATOR|DEFAULT_CHARSET|DEFAULT_CONTENT_TYPE|DEFAULT_EXCEPTION_REPORTER_FILTER|DEFAULT_FILE_STORAGE|DEFAULT_FROM_EMAIL|DEFAULT_TABLESPACE|DEFAULT_INDEX_TABLESPACE|DISALLOWED_USER_AGENTS|EMAIL_BACKEND|EMAIL_FILE_PATH|EMAIL_HOST_PASSWORD|EMAIL_HOST_USER|EMAIL_HOST|EMAIL_PORT|EMAIL_SUBJECT_PREFIX|EMAIL_USE_TLS|FILE_CHARSET|FILE_UPLOAD_HANDLERS|FILE_UPLOAD_MAX_MEMORY_SIZE|FILE_UPLOAD_PERMISSIONS|FILE_UPLOAD_TEMP_DIR|FIRST_DAY_OF_WEEK|FIXTURE_DIRS|FORCE_SCRIPT_NAME|FORMAT_MODULE_PATH|IGNORABLE_404_ENDS|IGNORABLE_404_STARTS|IGNORABLE_404_URLS|INSTALLED_APPS|INTERNAL_IPS|JING_PATH|LANGUAGE_CODE|LANGUAGE_COOKIE_NAME|LANGUAGES|LOCALE_PATHS|LOGGING|LOGGING_CONFIG|LOGIN_REDIRECT_URL|LOGIN_URL|LOGOUT_URL|MANAGERS|MEDIA_ROOT|MEDIA_URL|MESSAGE_LEVEL|MESSAGE_STORAGE|MESSAGE_TAGS|MIDDLEWARE_CLASSES|MONTH_DAY_FORMAT|NUMBER_GROUPING|PASSWORD_HASHERS|PASSWORD_RESET_TIMEOUT_DAYS|PREPEND_WWW|PROFANITIES_LIST|RESTRUCTUREDTEXT_FILTER_SETTINGS|ROOT_URLCONF|SECRET_KEY|SECURE_PROXY_SSL_HEADER|SEND_BROKEN_LINK_EMAILS|SERIALIZATION_MODULES|SERVER_EMAIL|SESSION_ENGINE|SESSION_CACHE_ALIAS|SESSION_COOKIE_AGE|SESSION_COOKIE_DOMAIN|SESSION_COOKIE_HTTPONLY|SESSION_COOKIE_NAME|SESSION_COOKIE_PATH|SESSION_COOKIE_SECURE|SESSION_ENGINE|SESSION_EXPIRE_AT_BROWSER_CLOSE|SESSION_FILE_PATH|SESSION_SAVE_EVERY_REQUEST|SHORT_DATE_FORMAT|SHORT_DATETIME_FORMAT|SIGNING_BACKEND|SITE_ID|STATIC_ROOT|STATIC_URL|STATICFILES_DIRS|STATICFILES_FINDERS|STATICFILES_STORAGE|TEMPLATE_CONTEXT_PROCESSORS|TEMPLATE_DEBUG|TEMPLATE_DIRS|TEMPLATE_LOADERS|TEMPLATE_STRING_IF_INVALID|TEST_DATABASE_CHARSET|TEST_DATABASE_COLLATION|TEST_DATABASE_NAME|TEST_RUNNER|THOUSAND_SEPARATOR|TIME_FORMAT|TIME_INPUT_FORMATS|TIME_ZONE|TRANSACTIONS_MANAGED|URL_VALIDATOR_USER_AGENT|USE_ETAGS|USE_I18N|USE_L10N|USE_THOUSAND_SEPARATOR|USE_TZ|USE_X_FORWARDED_HOST|WSGI_APPLICATION|YEAR_MONTH_FORMAT|X_FRAME_OPTIONS)\b</string> 
     <key>name</key> 
     <string>variable.other.django.settings</string> 
     </dict> 
     <dict> 
     <key>match</key> 
     <string>(get_list_or_404|get_object_or_404|load_and_render|loader|render_to_response|render)\b</string> 
     <key>name</key> 
     <string>support.function.django.view</string> 
     </dict> 
     <dict> 
     <key>match</key> 
     <string>[a-z_]+\.get_(object|list|iterator|count|values|values_iterator|in_bulk)\b</string> 
     <key>name</key> 
     <string>support.function.django.model</string> 
     </dict> 
     <dict> 
     <key>include</key> 
     <string>source.python</string> 
     </dict> 
    </array> 
    <key>scopeName</key> 
    <string>source.python.django</string> 
    <key>uuid</key> 
    <string>5326D56C-6F76-4758-8DB7-D818527919AC</string> 
</dict> 
</plist> 

C:\Users\jeffy\AppData\Roaming\Sublime Text 3\Packages\User\syntax_definitions\HTML (Django).tmLanguage

這個文件是巨大的。這裏是a dpaste

回答

0

原來一個「用戶」類別是自動創建的。我只是沒有注意到它。

screenshot