]> git.r.bdr.sh - rbdr/api-notation.vscode/commitdiff
Merge branch 'feature/rbdr-initial-development' into develop
authorBen Beltran <redacted>
Tue, 5 Feb 2019 21:32:01 +0000 (22:32 +0100)
committerBen Beltran <redacted>
Tue, 5 Feb 2019 21:32:01 +0000 (22:32 +0100)
.vscode/launch.json [new file with mode: 0644]
.vscodeignore [new file with mode: 0644]
CHANGELOG.md [new file with mode: 0644]
README.md
example-syntax.api [new file with mode: 0644]
language-configuration.json [new file with mode: 0644]
package.json [new file with mode: 0644]
syntaxes/api-notation.tmLanguage [new file with mode: 0644]
vsc-extension-quickstart.md [new file with mode: 0644]

diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644 (file)
index 0000000..7bc18a4
--- /dev/null
@@ -0,0 +1,18 @@
+// 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",
+            "runtimeExecutable": "${execPath}",
+            "args": [
+                "--extensionDevelopmentPath=${workspaceFolder}"
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/.vscodeignore b/.vscodeignore
new file mode 100644 (file)
index 0000000..f369b5e
--- /dev/null
@@ -0,0 +1,4 @@
+.vscode/**
+.vscode-test/**
+.gitignore
+vsc-extension-quickstart.md
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644 (file)
index 0000000..b8ca50c
--- /dev/null
@@ -0,0 +1,8 @@
+# Change Log
+All notable changes to the "api-notation" extension will be documented in this file.
+
+Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
+
+## [Unreleased]
+- Import from https://gitlab.com/rbdr/api-notation.tmLanguage
+- Add VSCode publishing info
index 99d085729726cbd5c45756c5f84ae0f33e60f717..55e00b407b82d7983ffc80afe8495e859c643d14 100644 (file)
--- a/README.md
+++ b/README.md
@@ -1,3 +1,70 @@
-# API Notation for VSCode
+# API Notation Syntax for Atom
 
-Syntax Highlight Plugin for VSCode
\ No newline at end of file
+This is a grammar for api notation, a simple notation I've been using for
+annotating module APIs in specs and other documents.
+
+## Installing
+
+### From Command Line
+
+`code --install-extension rbdr.api-notation`
+
+### From GUI
+
+#### Open the Extension Manager from Palette Manager
+
+1. Press `⌘⇧P` on OSX or `⌃⇧P` on Windows/Linux to open the palette manager
+2. Look for `Install Ext4ensions
+
+#### Open the Package Manager from Preferences
+
+1. Go to `Code -> Preferences -> Extensions` menu item
+
+#### Install it
+
+1. Search for `api-notation` in the search bar
+2. Click Install
+
+
+## Usage
+
+Open a `.api` file, or set it as your syntax.
+
+## API Notation Reference
+
+The most recent reference as of now is in this [gist][api-reference], so
+check that to be sure. But here's a reproduction of the notation.
+
+```
+NameOfClass.WithPossibleNamespace
+   + class property
+   - instance property
+  ~> listened events (socket)
+  +> listened events (class/module)
+  -> listened events (instance)
+  <~ dispatched events (socket)
+  <+ dispatched events(class/module)
+  <- dispatched events (instance)
+  :: class method
+   # instance method
+
+Other symbols
+  => returns
+->() callback return
+[xx] optional
+<xx> data type
+
+Recommended order: class first, then sockets, then instance. Internally:
+Properties, events, methods.
+
+// Anything after two forward slashes is a comment
+```
+
+## How does it look like?
+
+Like this.
+
+![Like this.][api-example]
+
+[api-reference]: https://gist.github.com/rbdr/4694c46fcec131468e34
+[api-example]: https://i.imgur.com/63TyFMe.png
diff --git a/example-syntax.api b/example-syntax.api
new file mode 100644 (file)
index 0000000..8c52870
--- /dev/null
@@ -0,0 +1,19 @@
+HypotheticalModule <IModuleInterface>
+  +staticProperty <String>
+  +anotherStaticProperty <Boolean>
+  ::toggleAnotherStaticProperty()
+  ::setStaticProperty(newValue <String>)
+  -instanceProperty <Number>
+  -anotherInstanceProperty <String>
+  #instanceMethodSync([optionalParameter]<Boolean>) => resultOfCall <String>
+  #instanceMethodAsync(someValue <Number>, [callback] <Function>) ->(error <String|null>, result <Number|null>)
+
+
+// Comment
+EventHypotheticalClass
+  +>AnotherClass<+staticEventToListen(eventData <PredefinedObject>) // More Comments
+  <+staticEventDispatched(someData <SomeData>)
+  ~>listenedSocketEvent(eventData <SomeObject>)
+  <~dispatchedSocketEvent(eventData <BlaBla>)
+  ->AnotherClass<-instanceEventToListen(eventData <Object>)
+  <-instanceEventDispatched(specificDataType <DefinedObject>)
diff --git a/language-configuration.json b/language-configuration.json
new file mode 100644 (file)
index 0000000..aa25710
--- /dev/null
@@ -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 that can be used to surround a selection
+    "surroundingPairs": [
+        ["{", "}"],
+        ["[", "]"],
+        ["(", ")"],
+        ["\"", "\""],
+        ["'", "'"]
+    ]
+}
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644 (file)
index 0000000..44e125e
--- /dev/null
@@ -0,0 +1,39 @@
+{
+    "name": "api-notation",
+    "displayName": "API Notation",
+    "description": "Syntax Highlighting for API notation",
+    "publisher": "rbdr",
+    "version": "0.2.1",
+    "engines": {
+        "vscode": "^1.30.0"
+    },
+    "categories": [
+        "Programming Languages"
+    ],
+    "repository": {
+        "type": "git",
+        "url": "https://gitlab.com/rbdr/api-notation.vscode.git"
+    },
+    "contributes": {
+        "languages": [
+            {
+                "id": "api-notation",
+                "aliases": [
+                    "API Notation",
+                    "api-notation"
+                ],
+                "extensions": [
+                    ".api"
+                ],
+                "configuration": "./language-configuration.json"
+            }
+        ],
+        "grammars": [
+            {
+                "language": "api-notation",
+                "scopeName": "source.api-notation",
+                "path": "./syntaxes/api-notation.tmLanguage"
+            }
+        ]
+    }
+}
diff --git a/syntaxes/api-notation.tmLanguage b/syntaxes/api-notation.tmLanguage
new file mode 100644 (file)
index 0000000..e546929
--- /dev/null
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>fileTypes</key>
+       <array>
+               <string>api</string>
+       </array>
+       <key>name</key>
+       <string>API Notation</string>
+       <key>patterns</key>
+       <array>
+               <dict>
+                       <key>begin</key>
+                       <string>([a-zA-Z0-9_.]+)</string>
+                       <key>end</key>
+                       <string>\n</string>
+                       <key>name</key>
+                       <string>constant.language</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#dataTypes</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#comment</string>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>begin</key>
+                       <string>^//.*</string>
+                       <key>end</key>
+                       <string>\n</string>
+                       <key>name</key>
+                       <string>comment.line</string>
+               </dict>
+               <dict>
+                       <key>begin</key>
+                       <string>[ \t]+</string>
+                       <key>end</key>
+                       <string>\n</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#apiMember</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#parameterList</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#dataTypes</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#operators</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#parameters</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#comment</string>
+                               </dict>
+                       </array>
+               </dict>
+               <dict>
+                       <key>begin</key>
+                       <string>^.</string>
+                       <key>end</key>
+                       <string>\n</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#comment</string>
+                               </dict>
+                       </array>
+               </dict>
+       </array>
+       <key>repository</key>
+       <dict>
+               <key>apiMember</key>
+               <dict>
+                       <key>captures</key>
+                       <dict>
+                               <key>1</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>keyword.control</string>
+                               </dict>
+                               <key>2</key>
+                               <dict>
+                                       <key>name</key>
+                                       <string>variable.language</string>
+                               </dict>
+                       </dict>
+                       <key>match</key>
+                       <string>((?:&lt;\+)|(?:&lt;\~)|(?:&lt;\-)|(?:\+&gt;)|(?:\~&gt;)|(?:\-&gt;)|\-|\+|(?:::)|#)([a-zA-z0-9_]+)</string>
+               </dict>
+               <key>comment</key>
+               <dict>
+                       <key>match</key>
+                       <string>[ \t]*//[ \t]*.*</string>
+                       <key>name</key>
+                       <string>comment.line</string>
+               </dict>
+               <key>dataType</key>
+               <dict>
+                       <key>match</key>
+                       <string>[a-zA-Z0-9_.]+</string>
+                       <key>name</key>
+                       <string>support.function</string>
+               </dict>
+               <key>dataTypes</key>
+               <dict>
+                       <key>begin</key>
+                       <string>\&lt;</string>
+                       <key>end</key>
+                       <string>\&gt;</string>
+                       <key>name</key>
+                       <string>keyword.operator</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#dataType</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#separators</string>
+                               </dict>
+                       </array>
+               </dict>
+               <key>operators</key>
+               <dict>
+                       <key>match</key>
+                       <string>(?:\-&gt;)|(?:\=&gt;)</string>
+                       <key>name</key>
+                       <string>keyword.control</string>
+               </dict>
+               <key>optionalParameter</key>
+               <dict>
+                       <key>match</key>
+                       <string>[a-zA-Z0-9_.]+</string>
+                       <key>name</key>
+                       <string>comment.line</string>
+               </dict>
+               <key>optionalParameters</key>
+               <dict>
+                       <key>begin</key>
+                       <string>\[</string>
+                       <key>end</key>
+                       <string>\]</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#optionalParameter</string>
+                               </dict>
+                       </array>
+               </dict>
+               <key>parameterList</key>
+               <dict>
+                       <key>begin</key>
+                       <string>\(</string>
+                       <key>end</key>
+                       <string>\)</string>
+                       <key>name</key>
+                       <string>keyword.operator</string>
+                       <key>patterns</key>
+                       <array>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#parameters</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#optionalParameters</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#dataTypes</string>
+                               </dict>
+                               <dict>
+                                       <key>include</key>
+                                       <string>#separators</string>
+                               </dict>
+                       </array>
+               </dict>
+               <key>parameters</key>
+               <dict>
+                       <key>match</key>
+                       <string>[a-zA-Z0-9_.]+</string>
+                       <key>name</key>
+                       <string>string.other</string>
+               </dict>
+               <key>separators</key>
+               <dict>
+                       <key>match</key>
+                       <string>\||,</string>
+                       <key>name</key>
+                       <string>comment.line</string>
+               </dict>
+       </dict>
+       <key>scopeName</key>
+       <string>source.api-notation</string>
+       <key>uuid</key>
+       <string>fc8dc5cf-b7aa-4b64-a665-80e8dc1b2553</string>
+</dict>
+</plist>
diff --git a/vsc-extension-quickstart.md b/vsc-extension-quickstart.md
new file mode 100644 (file)
index 0000000..06a7355
--- /dev/null
@@ -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/api-notation.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.