Skip to content

Instantly share code, notes, and snippets.

@joshtynjala
Last active June 24, 2016 01:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshtynjala/3c8e03a467f7d96b53c47690471300ee to your computer and use it in GitHub Desktop.
Save joshtynjala/3c8e03a467f7d96b53c47690471300ee to your computer and use it in GitHub Desktop.
Visual Studio Code tasks.json for asjsc #NextGenAS
{
"version": "0.1.0",
"command": "asjsc",
"isShellCommand": true,
"args": ["src/Main.as"],
"showOutput": "always",
"problemMatcher":
{
"fileLocation": "absolute",
"pattern":
[
{
"regexp": "^(.*):(\\d+)$",
"file": 1,
"line": 2
},
{
"regexp": "^(.*)$",
"message": 1
}
]
}
}

Visual Studio Code tasks.json for asjsc

Runs asjsc from Apache FlexJS™ inside Visual Studio Code. Automatically detects compiler errors, including the line number, and displays them in the editor with your code.

To use, create .vscode/tasks.json in your project. Use Ctrl+Shift+B to run (or Cmd+Shift+B on Mac).

Command path

The command field assumes that asjsc is available globally. However, you may use an absolute path instead:

{
	"command": "/path/to/asjsc",
}

Hide console output

If you prefer not to show the console output, change the showOutput field, like this:

{
	"showOutput": "never",
}

To see errors when the console is hidden, click the icon in the status bar or press Ctrl+Shift+M (or Cmd+Shift+M on Mac).

Compiler arguments

Instead of editing the args field in tasks.json to add more command line arguments, you can add a configuration file in the same directory as your main class. If your main class is src/HelloWorld.as, create src/HelloWorld-config.xml. The compiler will automatically detect this file and use it. For example, if you wanted to add a libs directory to the library path, you could do it like this:

<?xml version="1.0"?> 
<flex-config>
	<compiler>
		<library-path>
			<path-element>../libs</path-element>
		</library-path>
	</compiler>
</flex-config>

Paths are relative to the configuration file, rather than the root of your project.


Want to see more helpful tips like this? Please become a patron and support the next generation of ActionScript development on the web -- without a plugin!

NextGen ActionScript by Josh Tynjala on Patreon.

Special thanks to the following sponsors for their generous support:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment