我的目标是使用text.html
语法扩展text.html.django
语法,因此(例如)当我处理非Django html文件时,不显示仅Django的自动填充功能。与source.python
和source.python.django
相同。
Djaniero package就是这样做的,使用PackageResourceViewer,我复制了两个语法文件并将它们保存到我的用户目录中(两者都在下面)。
它不起作用,我想知道是不是因为,当安装Djaniero时,这些语法列在一个类别中:
但是当我卸载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 :(得分:0)
事实证明,“用户”类别已自动创建。我只是没注意到它。