A Sublime Text plugin to select a default syntax dialect

Overview

Default Syntax Chooser

This Sublime Text 4 plugin provides the set_default_syntax_dialect command.

This command manipulates a syntax file (e.g.: SQL.sublime-syntax) to make it point to a desired dialect (e.g.: MySQL.sublime-syntax). As a result the dialect is used whenever the default syntax's scope (e.g.: source.sql) is addressed. This way it is possible to specify the syntax to use in embedded code blocks.

Syntax definitions may embed others to highlight certain parts of a document with that external language. Very popular examples are:

  1. HTML embeds CSS and JavaScript.
  2. Markdown embeds many other syntaxes to highlight fenced code blocks
  3. Ruby/PHP embed various syntaxes (e.g.: SQL, XML, ...) to highlight HEREDOCs

They do so by embedding scopes (e.g.: embed: scope:source.sql).

But what if such a syntax has several dialects while the embedding syntax doesn't have any solution to distinguish them?

Ruby/PHP only know about "SQL" syntax. But SQL may be used as synonym for MySQL, PostgresSQL, SQLight or T-SQL.

Usage

A command for the target syntax is to be added to Default.sublime-commands

[
    {
        "caption": "Set Syntax Dialect: SQL",
        "command": "assign_default_syntax_dialect",
        "args": {
            "syntax_file": "Packages/SQL/SQL.sublime-syntax"
        }
    }
]

The target syntax should be an alias and must be extended from a dialect.

%YAML 1.2
---
name: SQL
scope: source.sql
version: 2

extends: Packages/SQL/MySQL.sublime-syntax

file_extensions:
  - sql
  - ddl
  - dml

first_line_match: |-
  (?xi:
    ^ \\s* -- .*? -\\*- .*? \\bsql\\b .*? -\\*-  # editorconfig
  )
You might also like...
NetBox plugin that stores configuration diffs and checks templates compliance
NetBox plugin that stores configuration diffs and checks templates compliance

Config Officer - NetBox plugin NetBox plugin that deals with Cisco device configuration (collects running config from Cisco devices, indicates config

NetBox plugin for BGP related objects documentation
NetBox plugin for BGP related objects documentation

Netbox BGP Plugin Netbox plugin for BGP related objects documentation. Compatibility This plugin in compatible with NetBox 2.10 and later. Installatio

Poetry plugin to export the dependencies to various formats

Poetry export plugin This package is a plugin that allows the export of locked packages to various formats. Note: For now, only the requirements.txt f

Crystal Smp plugin for show scoreboards

MCDR-CrystalScoreboards Crystal plugin for show scoreboards | Only 1.12 Usage !!s : Plugin help message !!s hide : Hide scoreboard !!s show : Show Sco

Netbox Dns is a netbox plugin for managing zone, nameserver and record inventory.
Netbox Dns is a netbox plugin for managing zone, nameserver and record inventory.

Netbox DNS Netbox Dns is a netbox plugin for managing zone, nameserver and record inventory. Features Manage zones (domains) you have. Manage nameserv

AiiDA plugin for the HyperQueue metascheduler.

aiida-hyperqueue WARNING: This plugin is still in heavy development. Expect bugs to pop up and the API to change. AiiDA plugin for the HyperQueue meta

Autolookup GUI Plugin for Plover
Autolookup GUI Plugin for Plover

Word Tray for Plover Word Tray is a GUI plugin that automatically looks up efficient outlines for words that start with the current input, much like a

Plover jyutping - Plover plugin for Jyutping input

Plover plugin for Jyutping Installation Navigate to the repo directory: cd plove

A Sublime Text package that allows a user to view all the available core/plugin commands for Sublime Text and Sublime Merge, along with their documentation/source.
A Sublime Text package that allows a user to view all the available core/plugin commands for Sublime Text and Sublime Merge, along with their documentation/source.

CommandsBrowser A Sublime Text package that allows a user to view all the available core/plugin commands for Sublime Text and Sublime Merge, along wit

Anaconda turns your Sublime Text 3 in a full featured Python development IDE including autocompletion, code linting, IDE features, autopep8 formating, McCabe complexity checker Vagrant and Docker support for Sublime Text 3 using Jedi, PyFlakes, pep8, MyPy, PyLint, pep257 and McCabe that will never freeze your Sublime Text 3
Context-free grammar to Sublime-syntax file

Generate a sublime-syntax file from a non-left-recursive, follow-determined, context-free grammar

mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

mitm6 is a pentesting tool that exploits the default configuration of Windows to take over the default DNS server.

A Sublime Text plugin that displays inline images for single-line comments formatted like `// ![](example.png)`.
A Sublime Text plugin that displays inline images for single-line comments formatted like `// ![](example.png)`.

Inline Images Sometimes ASCII art is not enough. Sometimes an image says more than a thousand words. This Sublime Text plugin can display images inlin

a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)
a plugin for py.test that changes the default look and feel of py.test (e.g. progressbar, show tests that fail instantly)

pytest-sugar pytest-sugar is a plugin for pytest that shows failures and errors instantly and shows a progress bar. Requirements You will need the fol

My Sublime Text theme
My Sublime Text theme

rsms sublime text theme Install: cd path/to/your/sublime/packages git clone https://github.com/rsms/sublime-theme.git rsms-theme You'll also need the

Sublime Text 2/3 style auto completion for ST4

Hippie Autocompletion Sublime Text 2/3 style auto completion for ST4: cycle through words, do not show popup. Simply hit Tab to insert completion, hit

Python 3 patcher for Sublime Text v4107-4114 Windows x64
Python 3 patcher for Sublime Text v4107-4114 Windows x64

sublime-text-4-patcher Python 3 patcher for Sublime Text v4107-4114 Windows x64 Credits for signatures and patching logic goes to https://github.com/l

Basic Clojure REPL for Sublime Text

Basic Clojure REPL for Sublime Text Goals: Decomplected: just REPL, nothing more Zero dependencies: works directly with pREPL Compact: Display code ev

openBrowsser is a Sublime Text plug-in, which allows you to add a keyboard shortcut, to directly access a website from a selection.

openBrowsser is a Sublime Text plug-in, which allows you to add a keyboard shortcut, to directly access a website from a selection. Instal

Owner
null
Show Rubygems description and annotate your code right from Sublime Text.

Gem Description for Sublime Text Show Rubygems description and annotate your code. Just mouse over your Gemfile's gem definitions to show the popup. s

Nando Vieira 2 Dec 19, 2022
This repo provides a package to automatically select a random seed based on ancient Chinese Xuanxue

?? Random Luck Deep learning is acturally the alchemy. This repo provides a package to automatically select a random seed based on ancient Chinese Xua

Tong Zhu(朱桐) 33 Jan 3, 2023
Lightweight, configurable Sphinx theme. Now the Sphinx default!

What is Alabaster? Alabaster is a visually (c)lean, responsive, configurable theme for the Sphinx documentation system. It is Python 2+3 compatible. I

Jeff Forcier 670 Dec 19, 2022
Python syntax highlighted Markdown doctest.

phmdoctest 1.3.0 Introduction Python syntax highlighted Markdown doctest Command line program and Python library to test Python syntax highlighted cod

Mark Taylor 16 Aug 9, 2022
An MkDocs plugin to export content pages as PDF files

MkDocs PDF Export Plugin An MkDocs plugin to export content pages as PDF files The pdf-export plugin will export all markdown pages in your MkDocs rep

Terry Zhao 266 Dec 13, 2022
An MkDocs plugin that simplifies configuring page titles and their order

MkDocs Awesome Pages Plugin An MkDocs plugin that simplifies configuring page titles and their order The awesome-pages plugin allows you to customize

Lukas Geiter 282 Dec 28, 2022
MkDocs plugin for setting revision date from git per markdown file

mkdocs-git-revision-date-plugin MkDocs plugin that displays the last revision date of the current page of the documentation based on Git. The revision

Terry Zhao 48 Jan 6, 2023
MkDocs Plugin allowing your visitors to *File > Print > Save as PDF* the entire site.

mkdocs-print-site-plugin MkDocs plugin that adds a page to your site combining all pages, allowing your site visitors to File > Print > Save as PDF th

Tim Vink 67 Jan 4, 2023
Ultimaker Cura 2 Mooraker Upload Plugin

Klipper & Cura - Cura2MoonrakerPlugin Allows you to upload Gcode directly from Cura to your Klipper-based 3D printer (Fluidd, Mainsailos etc.) using t

null 214 Jan 3, 2023
Zero configuration Airflow plugin that let you manage your DAG files.

simple-dag-editor SimpleDagEditor is a zero configuration plugin for Apache Airflow. It provides a file managing interface that points to your dag_fol

null 30 Jul 20, 2022