Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Language Server and New Language Support: Drash Markup Language, a VSCode plugin for Drash's template engine

Notifications You must be signed in to change notification settings

ebebbington/drash-markup-language

Repository files navigation

Drash Markup Language Logo

Drash Markup Language

Drash Markup Language, a VSCode plugin for [Drash's](https://drash.land/drash) [template engine](https://drash.land/drash/tutorials/template-engine)


Drash Markup Language (dml) provides new language support and a LSP for .dml files. .dml files are just like .html files, but provide a better user experience when using Drash's templatee engine, by:

  • Highlighting template code and tags

  • Providing diagnostics for incorrect or invalid usage of the template code

  • Supports autocompletion and highlights for HTML by default

Quick Start

  1. [Install the extnesion for VSCode](link to the plugin)

  2. Enable HTML support

Create a .vscode/settings.json:

{
    "files.associations": {
        "*.dml": "html"
    }
}
  1. Create a Drash resource and server:
import { Drash } from "https://deno.land/x/drash@<lastest_version>/mod.ts";

class Resource extends Drash.Http.Resource {
    static paths = ["/"];

    public GET () {
        this.response = this.response.render("/index.dml", {
            username: "Drash Markup Language",
            runtimes: ["Node", "Deno"]
        });
        return this.response
    }
}

const server = new Drash.Http.Server({
    resources: [Resource],
    views_path: "./views",
    template_engine: true
});

server.run({
    hostname: "localhost",
    port: 1337
});
  1. Create a index.dml file and start writing markup, using Drash's template engine syntax:
// views/index.dml
<body>
  <p><% username %></p>
  <ul>
  <%
    for (const runtime in runtimes) {
        <li><% runtime %></li>
    }
  %>
</body>

Features

  • Highlighting template code and tags

SCREENSHOT/ANIMATION

  • Providing diagnostics for incorrect or invalid usage of the template code

SCREENSHOT/ANIMATION

  • Supports autocompletion and highlights for HTML by default

SCREENSHOT/ANIMATION

Extension Settings

Include if your extension adds any VS Code settings through the contributes.configuration extension point.

For example:

This extension contributes the following settings:

  • myExtension.enable: enable/disable this extension
  • myExtension.thing: set to blah to do something

Acknowledgments

  • @SRNV - Rudy helped a lot on the Language Support side, answering any queries, helping solve problems found, and just getting it up andd running. Huge thanks.
  • @crooske - Eric had the idea of creating a template engine, and to create full support for using it, such as turning it into a new language, and creating the idea of IDE extensions/plugins.

About

Language Server and New Language Support: Drash Markup Language, a VSCode plugin for Drash's template engine

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project