Browse Source

working candidate

Karathan 6 years ago
commit
35e42b3daf

+ 3
- 0
.gitattributes View File

@@ -0,0 +1,3 @@
1
+# Set default behavior to automatically normalize line endings.
2
+* text=auto
3
+

+ 4
- 0
.gitignore View File

@@ -0,0 +1,4 @@
1
+out
2
+node_modules
3
+.vscode-test/
4
+*.vsix

+ 7
- 0
.vscode/extensions.json View File

@@ -0,0 +1,7 @@
1
+{
2
+	// See http://go.microsoft.com/fwlink/?LinkId=827846
3
+	// for the documentation about the extensions.json format
4
+	"recommendations": [
5
+		"eg2.tslint"
6
+	]
7
+}

+ 36
- 0
.vscode/launch.json View File

@@ -0,0 +1,36 @@
1
+// A launch configuration that compiles the extension and then opens it inside a new window
2
+// Use IntelliSense to learn about possible attributes.
3
+// Hover to view descriptions of existing attributes.
4
+// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+{
6
+	"version": "0.2.0",
7
+    "configurations": [
8
+        {
9
+            "name": "Extension",
10
+            "type": "extensionHost",
11
+            "request": "launch",
12
+            "runtimeExecutable": "${execPath}",
13
+            "args": [
14
+                "--extensionDevelopmentPath=${workspaceFolder}"
15
+            ],
16
+            "outFiles": [
17
+                "${workspaceFolder}/out/**/*.js"
18
+            ],
19
+            "preLaunchTask": "npm: watch"
20
+        },
21
+        {
22
+            "name": "Extension Tests",
23
+            "type": "extensionHost",
24
+            "request": "launch",
25
+            "runtimeExecutable": "${execPath}",
26
+            "args": [
27
+                "--extensionDevelopmentPath=${workspaceFolder}",
28
+                "--extensionTestsPath=${workspaceFolder}/out/test"
29
+            ],
30
+            "outFiles": [
31
+                "${workspaceFolder}/out/test/**/*.js"
32
+            ],
33
+            "preLaunchTask": "npm: watch"
34
+        }
35
+    ]
36
+}

+ 11
- 0
.vscode/settings.json View File

@@ -0,0 +1,11 @@
1
+// Place your settings in this file to overwrite default and user settings.
2
+{
3
+    "files.exclude": {
4
+        "out": false // set this to true to hide the "out" folder with the compiled JS files
5
+    },
6
+    "search.exclude": {
7
+        "out": true // set this to false to include "out" folder in search results
8
+    },
9
+    // Turn off tsc task auto detection since we have the necessary tasks as npm scripts
10
+    "typescript.tsc.autoDetect": "off"
11
+}

+ 20
- 0
.vscode/tasks.json View File

@@ -0,0 +1,20 @@
1
+// See https://go.microsoft.com/fwlink/?LinkId=733558
2
+// for the documentation about the tasks.json format
3
+{
4
+    "version": "2.0.0",
5
+    "tasks": [
6
+        {
7
+            "type": "npm",
8
+            "script": "watch",
9
+            "problemMatcher": "$tsc-watch",
10
+            "isBackground": true,
11
+            "presentation": {
12
+                "reveal": "never"
13
+            },
14
+            "group": {
15
+                "kind": "build",
16
+                "isDefault": true
17
+            }
18
+        }
19
+    ]
20
+}

+ 9
- 0
.vscodeignore View File

@@ -0,0 +1,9 @@
1
+.vscode/**
2
+.vscode-test/**
3
+out/test/**
4
+out/**/*.map
5
+src/**
6
+.gitignore
7
+tsconfig.json
8
+vsc-extension-quickstart.md
9
+tslint.json

+ 7
- 0
CHANGELOG.md View File

@@ -0,0 +1,7 @@
1
+# Change Log
2
+All notable changes to the "pokescript" extension will be documented in this file.
3
+
4
+Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
5
+
6
+## [Unreleased]
7
+- Initial release

+ 65
- 0
README.md View File

@@ -0,0 +1,65 @@
1
+# pokescript README
2
+
3
+This is the README for your extension "pokescript". After writing up a brief description, we recommend including the following sections.
4
+
5
+## Features
6
+
7
+Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
8
+
9
+For example if there is an image subfolder under your extension project workspace:
10
+
11
+\!\[feature X\]\(images/feature-x.png\)
12
+
13
+> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
14
+
15
+## Requirements
16
+
17
+If you have any requirements or dependencies, add a section describing those and how to install and configure them.
18
+
19
+## Extension Settings
20
+
21
+Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
22
+
23
+For example:
24
+
25
+This extension contributes the following settings:
26
+
27
+* `myExtension.enable`: enable/disable this extension
28
+* `myExtension.thing`: set to `blah` to do something
29
+
30
+## Known Issues
31
+
32
+Calling out known issues can help limit users opening duplicate issues against your extension.
33
+
34
+## Release Notes
35
+
36
+Users appreciate release notes as you update your extension.
37
+
38
+### 1.0.0
39
+
40
+Initial release of ...
41
+
42
+### 1.0.1
43
+
44
+Fixed issue #.
45
+
46
+### 1.1.0
47
+
48
+Added features X, Y, and Z.
49
+
50
+-----------------------------------------------------------------------------------------------------------
51
+
52
+## Working with Markdown
53
+
54
+**Note:** You can author your README using Visual Studio Code.  Here are some useful editor keyboard shortcuts:
55
+
56
+* Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux)
57
+* Toggle preview (`Shift+CMD+V` on macOS or `Shift+Ctrl+V` on Windows and Linux)
58
+* Press `Ctrl+Space` (Windows, Linux) or `Cmd+Space` (macOS) to see a list of Markdown snippets
59
+
60
+### For more information
61
+
62
+* [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
63
+* [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
64
+
65
+**Enjoy!**

+ 2255
- 0
package-lock.json
File diff suppressed because it is too large
View File


+ 53
- 0
package.json View File

@@ -0,0 +1,53 @@
1
+{
2
+    "name": "pokescript",
3
+    "displayName": "PokéScript",
4
+    "description": "PokéScript Language Support",
5
+    "version": "0.0.1",
6
+    "publisher": "SBird1337",
7
+    "engines": {
8
+        "vscode": "^1.25.0"
9
+    },
10
+    "categories": [
11
+        "Other"
12
+    ],
13
+    "activationEvents": [
14
+        "onCommand:extension.sayHello"
15
+    ],
16
+    "main": "./out/extension",
17
+    "contributes": {
18
+        "languages":[
19
+            {
20
+                "id": "pokescript",
21
+                "extensions": [".s", ".S", ".asm", ".rbc"],
22
+                "aliases": ["Pokéscript", "Pokescript", "pokescript"]
23
+            }
24
+        ],
25
+        "grammars":[
26
+            {
27
+                "language": "pokescript",
28
+                "scopeName": "source.arm.pokescript",
29
+                "path": "./syntaxes/pokescript.json"
30
+            }
31
+        ],
32
+        "commands": [
33
+            {
34
+                "command": "extension.sayHello",
35
+                "title": "Hello World"
36
+            }
37
+        ]
38
+    },
39
+    "scripts": {
40
+        "vscode:prepublish": "npm run compile",
41
+        "compile": "tsc -p ./",
42
+        "watch": "tsc -watch -p ./",
43
+        "postinstall": "node ./node_modules/vscode/bin/install",
44
+        "test": "npm run compile && node ./node_modules/vscode/bin/test"
45
+    },
46
+    "devDependencies": {
47
+        "typescript": "^2.6.1",
48
+        "vscode": "^1.1.6",
49
+        "tslint": "^5.8.0",
50
+        "@types/node": "^7.0.43",
51
+        "@types/mocha": "^2.2.42"
52
+    }
53
+}

+ 29
- 0
src/extension.ts View File

@@ -0,0 +1,29 @@
1
+'use strict';
2
+// The module 'vscode' contains the VS Code extensibility API
3
+// Import the module and reference it with the alias vscode in your code below
4
+import * as vscode from 'vscode';
5
+
6
+// this method is called when your extension is activated
7
+// your extension is activated the very first time the command is executed
8
+export function activate(context: vscode.ExtensionContext) {
9
+
10
+    // Use the console to output diagnostic information (console.log) and errors (console.error)
11
+    // This line of code will only be executed once when your extension is activated
12
+    console.log('Congratulations, your extension "pokescript" is now active!');
13
+
14
+    // The command has been defined in the package.json file
15
+    // Now provide the implementation of the command with  registerCommand
16
+    // The commandId parameter must match the command field in package.json
17
+    let disposable = vscode.commands.registerCommand('extension.sayHello', () => {
18
+        // The code you place here will be executed every time your command is executed
19
+
20
+        // Display a message box to the user
21
+        vscode.window.showInformationMessage('Hello World!');
22
+    });
23
+
24
+    context.subscriptions.push(disposable);
25
+}
26
+
27
+// this method is called when your extension is deactivated
28
+export function deactivate() {
29
+}

+ 22
- 0
src/test/extension.test.ts View File

@@ -0,0 +1,22 @@
1
+//
2
+// Note: This example test is leveraging the Mocha test framework.
3
+// Please refer to their documentation on https://mochajs.org/ for help.
4
+//
5
+
6
+// The module 'assert' provides assertion methods from node
7
+import * as assert from 'assert';
8
+
9
+// You can import and use all API from the 'vscode' module
10
+// as well as import your extension to test it
11
+// import * as vscode from 'vscode';
12
+// import * as myExtension from '../extension';
13
+
14
+// Defines a Mocha test suite to group tests of similar kind together
15
+suite("Extension Tests", function () {
16
+
17
+    // Defines a Mocha unit test
18
+    test("Something 1", function() {
19
+        assert.equal(-1, [1, 2, 3].indexOf(5));
20
+        assert.equal(-1, [1, 2, 3].indexOf(0));
21
+    });
22
+});

+ 22
- 0
src/test/index.ts View File

@@ -0,0 +1,22 @@
1
+//
2
+// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
3
+//
4
+// This file is providing the test runner to use when running extension tests.
5
+// By default the test runner in use is Mocha based.
6
+//
7
+// You can provide your own test runner if you want to override it by exporting
8
+// a function run(testRoot: string, clb: (error:Error) => void) that the extension
9
+// host can call to run the tests. The test runner is expected to use console.log
10
+// to report the results back to the caller. When the tests are finished, return
11
+// a possible error to the callback or null if none.
12
+
13
+import * as testRunner from 'vscode/lib/testrunner';
14
+
15
+// You can directly control Mocha options by uncommenting the following lines
16
+// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options for more info
17
+testRunner.configure({
18
+    ui: 'tdd', 		// the TDD UI is being used in extension.test.ts (suite, test, etc.)
19
+    useColors: true // colored output from test results
20
+});
21
+
22
+module.exports = testRunner;

+ 126
- 0
syntaxes/pokescript.json View File

@@ -0,0 +1,126 @@
1
+{
2
+    "scopeName": "source.arm.pokescript",
3
+    "name": "pokescript",
4
+    "fileTypes": [
5
+        ".s", ".S", ".asm", ".rbc"
6
+    ],
7
+    "patterns": [
8
+        {
9
+            "match": "([;@]|//).*$",
10
+            "name": "comment.arm"
11
+        },
12
+        {
13
+            "name": "comment.arm",
14
+            "begin": "\\/\\*",
15
+            "beginCaptures": {
16
+            "0": {
17
+                    "name": "comment.begin.arm"
18
+                }
19
+            },
20
+            "endCaptures": {
21
+            "0": {
22
+                "name": "comment.end.arm"
23
+                }
24
+            },
25
+            "end": "\\*\\/"
26
+        },
27
+        {
28
+            "match": "^\\s*\\.?\\w+:\\s*(?=$|;)",
29
+            "name": "routine.arm"
30
+        },
31
+        {
32
+            "name": "invalid.illegal.string.arm",
33
+            "match": "\"[^\"]+$"
34
+        },
35
+        {
36
+            "name": "string.quoted.arm",
37
+            "begin": "\"",
38
+            "end": "\""
39
+        },
40
+        {
41
+            "match": "\\'\\S\\'",
42
+            "name": "string.char.arm"
43
+        },
44
+        {
45
+            "match": "#?[0-9]+\\b",
46
+            "name": "constant.numeric.dec.arm"
47
+        },
48
+        {
49
+            "match": "#-?[a-zA-Z_][0-9a-zA-Z_]*\\b",
50
+            "name": "variable.named.arm"
51
+        },
52
+        {
53
+            "match": "#?-?(0x|&)[0-9a-fA-F_]+\\b",
54
+            "name": "constant.numeric.hex.arm"
55
+        },
56
+        {
57
+            "match": "\\b(?i)([rcp]([0-9]|1[0-5])|[xw]([0-9]|1[0-5]|2[0-5]|30)|wzr|xzr|wsp|fpsr|fpcr|a[1-4]|v[1-8]|sl|sb|fp|ip|sp|lr|(c|s)psr(_c)?|pc|[sd]3[0-1]|[sd][12][0-9]|[sd][0-9]|fpsid|fpscr|fpexc|q3[0-1]|q2[0-9]|q1[0-9]|q[0-9]|APSR_nzcv|sy)(?-i)(!|\\b)",
58
+            "name": "storage.other.register.arm"
59
+        },
60
+        {
61
+            "name": "storage.memaddress.arm",
62
+            "begin": "\\[",
63
+            "end": "\\]",
64
+            "patterns": [
65
+            {
66
+                "include": "$base"
67
+            }
68
+            ]
69
+        },
70
+        {
71
+            "name": "storage.stack.arm",
72
+            "begin": "\\{",
73
+            "end": "\\}\\^?",
74
+            "patterns": [
75
+            {
76
+                "include": "$base"
77
+            }
78
+            ]
79
+        },
80
+        {
81
+            "match": "\\b(?i)(v?(add|cvt|sub|mov|trn|cmp|div|qdmulh|mrs|mul|ld1|qadd|qshrun|st[1234]|addw|mull|mlal|rshrn|swp|qmovunand|m(rs|sr)|eor|sub|rsb|adc|sbc|rsc|and|tst|teq|cmp|cmn|orr|mov|bic|mvn|neg|lsr|lsl|ror|asr)s?|mul|mla|mull|smlabb|mov(w|t)|rev(8|16)?|pld|adr|adrl|vswp)(ne|eq|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|lt|le|gt|ge|al)?(?-i)\\b",
82
+            "name": "support.mnemonic.arithmetic.arm"
83
+        },
84
+        {
85
+            "match": "\\b(?i)(swi|svc|wfi|dmb|clrex|dsb|isb|v(ldr|str|push|pop)|push|pop|b(l|l?x|l?r)?|(i|e)?ret|(st|ld)(p|r(ex|s?(h|b)|d)?|m((f|e)(d|a)|(d|i)(b|a))?))(ne|eq|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|lt|le|gt|ge|al)?(?-i)\\b",
86
+            "name": "support.mnemonic.memory.arm"
87
+        },
88
+        {
89
+            "match": "\\b(?i)(def(b|w|s)|equ|align\\s.+\\.s)(?-i)\\b",
90
+            "name": "keyword.control.define.arm"
91
+        },
92
+        {
93
+            "name": "keyword.control.directive.arm",
94
+            "match": "\\.(?i)(globl|global|macro|endm|purgem|if|elseif|else|endif|section|text|data|bss|arm|align|balign|irp|rept|endr|req|unreq|error|short|func|endfunc|hidden|type|fpu|arch|code|altmacro|object_arch|word|int|string)(?-i)\\b"
95
+        },
96
+        {
97
+            "name": "keyword.other.preprocessor.arm",
98
+            "match": "^\\s*\\.?(define|defined|elif|else|if|ifdef|ifndef|line|include|get|pragma|undef|endif)\\b"
99
+        },
100
+        {
101
+            "match": "\\b\\=",
102
+            "name": "keyword.control.evaluation"
103
+        },
104
+        {
105
+            "match": "\\b(?i)(nop(ne|eq|cs|hs|cc|lo|mi|pl|vs|vc|hi|ls|lt|le|gt|ge|al)?)(?-i)\\b",
106
+            "name": "comment.nop.arm"
107
+        },
108
+        {
109
+            "match": "\\b(?i)(nop|nop1)(?-i)\\b",
110
+            "name": "comment.nop.arm.pokescript"
111
+        },
112
+        {
113
+            "match": "\\b(?i)(call|goto|gotoif|callif|callstd|killscript|loadpointer|writebytetooffset|setvar|addvar|subvar|copyvar|compare|comparevars|callasm|special|special2|waitstate|pause|setflag|clearflag|checkflag|resetvars|sound|checksound|fanfare|waitfanfare|playsong|playsong|songfadedefault|fadesong|fadeout|fadein|warp|warpmuted|warpwalk|walphole|warpteleport|setwarpplace|getplayerpos|countpokemon|additem|removeitem|checkitemroom|checkitem|checkitemtype|addpcitem|checkpcitem|applymovement|applymovementpos|waitmovement|waitmovementpos|hidesprite|hidespritepos|showsprite|showspritepos|movesprite|spriteinvisible|spriteinvisible|faceplayer|spriteface|trainerbattle|repeattrainerbattle|endtrainerbattle|endtrainerbattle2|checktrainerflag|settrainerflag|cleartrainerflag|movesprite2|moveoffscreen|spritebehave|waitmsg|preparemsg|closeonkeypress|lockall|lock|releaseall|release|waitkeypress|yesnobox|multichoice|multichoice2|multichoice3|showpokepic|hidepokepic|braille|givepokemon|giveegg|checkattack|bufferpokemon|bufferfirstpokemon|bufferpartypokemon|bufferitem|bufferattack|buffernumber|bufferstd|bufferstring|pokemart|pokemart3|random|givemoney|paymoney|checkmoney|showmoney|hidemoney|updatemoney|fadescreen|fadescreendelay|darken|lighten|doanimation|setanimation|checkanimation|sethealingplace|checkgender|cry|setmaptile|resetweather|setweather|doweather|spritelevelup|restorespritelevel|createsprite|spriteface2|setdooropened|setdoorclosed|doorchange|setdooropened2|setdoorclosed2|setwildbattle|dowildbattle|savincrementkey|waitcry|setworldmapflag|bufferitems)(?-i)\\b",
114
+            "name": "entity.name.function.arm.pokescript"
115
+        },
116
+
117
+        {
118
+            "match":"\\b(?i)(batchmaptilefromto||batchmaptiletofrom|sethiddenflags|seteffect|setecutscene|clearcutscene|pokemsg|beben|lookbattle|gymbattle|betweenbattle|scriptbattle|doublebattle|doublegymbattle|winlosebattle|spotscript|giveitem|giteitem2|wildbattle|wildbattle2|wildbattlemusic|customtrainerbattlemusic|colorflicker|mugmsg|mugrival|transparenzon|transparenzoff|battlescreen|cameramove|walkingscript|walingscripton|walkingscripton|writemusikon|writemusikoff|msgbox)(?-i)\\b",
119
+            "name": "keyword.other.preprocessor.arm.pokescript"
120
+        },
121
+        {
122
+            "match":"\\b(?i)(end|return)?(?-i)\\b",
123
+            "name": "keyword.control.arm.pokescript"
124
+        }
125
+    ]
126
+}

+ 23
- 0
tsconfig.json View File

@@ -0,0 +1,23 @@
1
+{
2
+    "compilerOptions": {
3
+        "module": "commonjs",
4
+        "target": "es6",
5
+        "outDir": "out",
6
+        "lib": [
7
+            "es6"
8
+        ],
9
+        "sourceMap": true,
10
+        "rootDir": "src",
11
+        /* Strict Type-Checking Option */
12
+        "strict": true,   /* enable all strict type-checking options */
13
+        /* Additional Checks */
14
+        "noUnusedLocals": true /* Report errors on unused locals. */
15
+        // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
16
+        // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
17
+        // "noUnusedParameters": true,  /* Report errors on unused parameters. */
18
+    },
19
+    "exclude": [
20
+        "node_modules",
21
+        ".vscode-test"
22
+    ]
23
+}

+ 15
- 0
tslint.json View File

@@ -0,0 +1,15 @@
1
+{
2
+	"rules": {
3
+		"no-string-throw": true,
4
+		"no-unused-expression": true,
5
+		"no-duplicate-variable": true,
6
+		"curly": true,
7
+		"class-name": true,
8
+		"semicolon": [
9
+			true,
10
+			"always"
11
+		],
12
+		"triple-equals": true
13
+	},
14
+	"defaultSeverity": "warning"
15
+}

+ 33
- 0
vsc-extension-quickstart.md View File

@@ -0,0 +1,33 @@
1
+# Welcome to your VS Code Extension
2
+
3
+## What's in the folder
4
+* This folder contains all of the files necessary for your extension.
5
+* `package.json` - this is the manifest file in which you declare your extension and command.
6
+The sample plugin registers a command and defines its title and command name. With this information
7
+VS Code can show the command in the command palette. It doesn’t yet need to load the plugin.
8
+* `src/extension.ts` - this is the main file where you will provide the implementation of your command.
9
+The file exports one function, `activate`, which is called the very first time your extension is
10
+activated (in this case by executing the command). Inside the `activate` function we call `registerCommand`.
11
+We pass the function containing the implementation of the command as the second parameter to
12
+`registerCommand`.
13
+
14
+## Get up and running straight away
15
+* Press `F5` to open a new window with your extension loaded.
16
+* Run your command from the command palette by pressing (`Ctrl+Shift+P` or `Cmd+Shift+P` on Mac) and typing `Hello World`.
17
+* Set breakpoints in your code inside `src/extension.ts` to debug your extension.
18
+* Find output from your extension in the debug console.
19
+
20
+## Make changes
21
+* You can relaunch the extension from the debug toolbar after changing code in `src/extension.ts`.
22
+* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
23
+
24
+## Explore the API
25
+* You can open the full set of our API when you open the file `node_modules/vscode/vscode.d.ts`.
26
+
27
+## Run tests
28
+* Open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`.
29
+* Press `F5` to run the tests in a new window with your extension loaded.
30
+* See the output of the test result in the debug console.
31
+* Make changes to `test/extension.test.ts` or create new test files inside the `test` folder.
32
+    * By convention, the test runner will only consider files matching the name pattern `**.test.ts`.
33
+    * You can create folders inside the `test` folder to structure your tests any way you want.