Explorar o código

Changes folder structure: includes snippet file via manifest; improves code folding enables auto-indentation

slonon %!s(int64=3) %!d(string=hai) anos
pai
achega
c4305a1b1e

+ 17 - 7
extensions/README.md → README.md

@@ -2,16 +2,17 @@
 
 No known bugs:
 * Multiline comments work now
-
-
->[original source](https://git.catrenelle.com/Kevin_Smarts/glife/src/master/tools/syntax/VSCode/qsrc)
-
-
+* Codefolding improved
+* automatic indentation added
 ___
 
-Usage:
+General usage:
 * Copy qsrc folder to `%homepath%\.vscode\extensions`
 
+Snippet usage:
+* type `loop`, `for`, `foreach` or `jump` and hit [Enter] for the `Loop` code snippet
+* [Tab] through the variables to rename them
+___
 ### Customize formatting ###
 Modify settings.json (location: `%appdata%\Code\User\`)
 * Example content:
@@ -91,4 +92,13 @@ Modify settings.json (location: `%appdata%\Code\User\`)
         ]
     }
 }
-```
+```
+
+___
+Resources:
+> [original source](https://git.catrenelle.com/Kevin_Smarts/glife/src/master/tools/syntax/VSCode/qsrc)
+
+> Docs: [manifest file](https://code.visualstudio.com/api/references/extension-manifest),
+> [language config](https://code.visualstudio.com/api/language-extensions/language-configuration-guide),
+>[user snippets](https://code.visualstudio.com/docs/editor/userdefinedsnippets),
+>[regex quick ref](https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference)

+ 0 - 11
User/README.md

@@ -1,11 +0,0 @@
-## QSP code snippets for Visual Studio Code
-
-
-Usage:
-* Copy snippets folder to `%appdata%\Code\User\`
-* type `loop`, `for`, `foreach` or `jump` and hit [Enter] for the `Loop` code snippet
-* [Tab] through the variables to rename them
-
-___
-
->[docs](https://code.visualstudio.com/docs/editor/userdefinedsnippets)

+ 0 - 24
extensions/qsrc/language-configuration.json

@@ -1,24 +0,0 @@
-    {
-        // symbols used as brackets
-        "brackets": [
-            ["{", "}"],
-            ["[", "]"],
-            ["(", ")"]
-        ],
-        // symbols that are auto closed when typing
-        "autoClosingPairs": [
-            ["{", "}"],
-            ["[", "]"],
-            ["(", ")"],
-            ["\"", "\""],
-            ["'", "'"]
-        ],
-        // symbols that that can be used to surround a selection
-        "surroundingPairs": [
-            ["{", "}"],
-            ["[", "]"],
-            ["(", ")"],
-            ["\"", "\""],
-            ["'", "'"]
-        ]
-    }

+ 0 - 28
extensions/qsrc/package.json

@@ -1,28 +0,0 @@
-    {
-        "name": "qsrc",
-        "displayName": "qsrc",
-        "description": "QSP grammar",
-        "version": "0.2.1",
-        "publisher": "Xorgroth",
-        "engines": {
-            "vscode": "^1.28.0"
-        },
-        "categories": [
-            "Programming Languages"
-        ],
-        "contributes": {
-            "languages": [{
-                "id": "qsp",
-                "aliases": ["QSP", "qsp", "Qsp"],
-                "extensions": [".qsrc", ".qsp-txt", ".txt-qsp"],
-                "configuration": "./language-configuration.json"
-            }],
-            "grammars": [
-				{
-                "language": "qsp",
-                "scopeName": "source.qsp",
-                "path": "./syntaxes/QSP.tmLanguage.json"
-				}
-			]
-        }
-    }

+ 44 - 0
qsrc/language-configuration.json

@@ -0,0 +1,44 @@
+{
+    //NOTE: regex case-insensitive option 'i' results in an error
+    
+    // line and block comments
+    "comments": {
+        "lineComment": "!!",
+        "blockComment": ["!{", "!}"]
+    },
+    // symbols used as brackets
+    "brackets": [
+        ["{", "}"],
+        ["[", "]"],
+        ["(", ")"]
+    ],
+    // symbols that are auto closed when typing
+    "autoClosingPairs": [
+        { "open": "{", "close": "}" },
+        { "open": "[", "close": "]" },
+        { "open": "(", "close": ")" },
+        { "open": "'", "close": "'" },
+        { "open": "\"", "close": "\"", "notIn": ["string"] }
+    ],
+    // symbols that that can be used to surround a selection
+    "surroundingPairs": [
+        ["{", "}"],
+        ["[", "]"],
+        ["(", ")"],
+        ["\"", "\""],
+        ["'", "'"],
+        ["<<", ">>"]
+    ],
+    // code folding 
+    "folding": {
+        "markers": {
+            "start": "^\\s*([Aa][Cc][Tt]|[Ii][Ff])\\b\\s*.+\\s*[:]\\s*?$\\n?",
+            "end": "^\\s*[Ee][Nn][Dd]\\b"
+        }
+    },
+    // automatic indentation
+    "indentationRules": {
+        "increaseIndentPattern": "^\\s*([Aa][Cc][Tt]|[Ii][Ff])\\b\\s*.+\\s*[:]\\s*?$\\n?",
+        "decreaseIndentPattern": "^\\s*[Ee][Nn][Dd]\\b"
+    }
+}

+ 44 - 0
qsrc/package.json

@@ -0,0 +1,44 @@
+{
+    "name": "qsrc",
+    "displayName": "QSP Source File",
+    "description": "QSP grammar and snippet",
+    "version": "0.2.1",
+    "publisher": "Xorgroth",
+    "engines": {
+        "vscode": "^1.28.0"
+    },
+    "categories": [
+        "Programming Languages",
+        "Snippets"
+    ],
+    "keywords": [
+        "qsp", "quest soft player"
+    ],
+    "contributes": {
+        "languages": [
+            {
+                "id": "qsp",
+                "aliases": [
+                    "QSP", "qsp", "Qsp"
+                ],
+                "extensions": [
+                    ".qsrc", ".qsp-txt", ".txt-qsp"
+                ],
+                "configuration": "./language-configuration.json"
+            }
+        ],
+        "grammars": [
+            {
+                "language": "qsp",
+                "scopeName": "source.qsp",
+                "path": "./syntaxes/QSP.tmLanguage.json"
+            }
+        ],
+        "snippets": [
+            {
+              "language": "qsp",
+              "path": "./snippets/qsp.json"
+            }
+        ]
+    }
+}

+ 0 - 0
User/snippets/qsp.json → qsrc/snippets/qsp.json


+ 0 - 0
extensions/qsrc/syntaxes/QSP.tmLanguage.json → qsrc/syntaxes/QSP.tmLanguage.json