Skip to content

Commit

Permalink
🎉 Add extension
Browse files Browse the repository at this point in the history
  • Loading branch information
trickypr committed May 2, 2021
1 parent 5bdc959 commit 72c6654
Show file tree
Hide file tree
Showing 10 changed files with 289 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ dist

# TernJS port file
.tern-port

*.vsix
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
4 changes: 4 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "meml" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# vscode
The VSCode extention for meml
# Fushra meml

Meml syntax highlighting in vscode.
30 changes: 30 additions & 0 deletions language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "//"
// symbols used for start and end a block comment. Remove this entry if your language does not support block comments
// "blockComment": [ "/*", "*/" ]
},
// symbols used as brackets
"brackets": [
//["{", "}"],
//["[", "]"],
["(", ")"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
//["{", "}"],
//["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
//["{", "}"],
//["[", "]"],
["(", ")"],
["\"", "\""],
["'", "'"]
]
}
26 changes: 26 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "meml",
"displayName": "MEML",
"description": "MEML support for VSCode",
"publisher": "Fushra",
"version": "0.0.1",
"engines": {
"vscode": "^1.55.0"
},
"categories": [
"Programming Languages"
],
"contributes": {
"languages": [{
"id": "meml",
"aliases": ["MEML", "meml"],
"extensions": [".meml"],
"configuration": "./language-configuration.json"
}],
"grammars": [{
"language": "meml",
"scopeName": "source.meml",
"path": "./syntaxes/meml.tmLanguage"
}]
}
}
147 changes: 147 additions & 0 deletions syntaxes/meml.tmLanguage
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?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" >
<!-- Generated via Iro -->
<dict>
<key>fileTypes</key>
<array>
<string>meml</string>
</array>
<key>name</key>
<string>meml</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#main</string>
</dict>
</array>
<key>scopeName</key>
<string>source.meml</string>
<key>uuid</key>
<string></string>
<key>repository</key>
<dict>
<key>main</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(import|from|export)</string>
<key>name</key>
<string>keyword.meml</string>
</dict>
<dict>
<key>match</key>
<string>(component)</string>
<key>name</key>
<string>punctuation.definition.meml</string>
</dict>
<dict>
<key>match</key>
<string>((?&lt;=\(\s*)\w*(?=.*))</string>
<key>name</key>
<string>entity.name.tag.meml</string>
</dict>
<dict>
<key>match</key>
<string>((?&lt;=\(component\ )\w*)</string>
<key>name</key>
<string>variable.other.constant.meml</string>
</dict>
<dict>
<key>match</key>
<string>((?&lt;=\()\w*(, \w*)*(?=\)))</string>
<key>name</key>
<string>variable.other.constant.meml</string>
</dict>
<dict>
<key>match</key>
<string>(\+|-|(?&lt;!/)(/)(?!/)|\*|=)</string>
<key>name</key>
<string>punctuation.meml</string>
</dict>
<dict>
<key>match</key>
<string>(\(|\))</string>
<key>name</key>
<string>punctuation.definition.tag.meml</string>
</dict>
<dict>
<key>match</key>
<string>((\w*)(?==))</string>
<key>name</key>
<string>variable.meml</string>
</dict>
<dict>
<key>match</key>
<string>(//.*)</string>
<key>name</key>
<string>comment.meml</string>
</dict>
<dict>
<key>begin</key>
<string>(&quot;)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.meml</string>
</dict>
</dict>
<key>contentName</key>
<string>string.meml</string>
<key>end</key>
<string>(&quot;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.meml</string>
</dict>
</dict>
</dict>
<dict>
<key>begin</key>
<string>(&apos;)</string>
<key>beginCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.meml</string>
</dict>
</dict>
<key>contentName</key>
<string>string.meml</string>
<key>end</key>
<string>(&apos;)</string>
<key>endCaptures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.meml</string>
</dict>
</dict>
</dict>
</array>
</dict>
<key>main__1</key>
<dict>
<key>patterns</key>
<array>
</array>
</dict>
<key>main__2</key>
<dict>
<key>patterns</key>
<array>
</array>
</dict>
</dict>
</dict>
</plist>
22 changes: 22 additions & 0 deletions test.meml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(import (nav) from "./nav.meml")

// Lets define a sample component
(component helloComponent (name)
(p "Hello " name ". This comes from a component!")
)
// The rest of the file
(
head
(title "Hello World!")
)
// This is a comment
(
body
(nav)
(p "Basic website made with MEML!")
(p "1 + 2 = " 1 + 2)
(p "BODMAS: " 5 - 5 * 5 + 5)
(helloComponent name="TrickyPR")
)

(export (helloComponent))
29 changes: 29 additions & 0 deletions vsc-extension-quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Welcome to your VS Code Extension

## What's in the folder

* This folder contains all of the files necessary for your extension.
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
* `syntaxes/meml.tmLanguage` - this is the Text mate grammar file that is used for tokenization.
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.

## Get up and running straight away

* Make sure the language configuration settings in `language-configuration.json` are accurate.
* Press `F5` to open a new window with your extension loaded.
* Create a new file with a file name suffix matching your language.
* Verify that syntax highlighting works and that the language configuration settings are working.

## Make changes

* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.

## Add more language features

* To add features such as intellisense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs

## Install your extension

* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

0 comments on commit 72c6654

Please sign in to comment.