Skip to content

Commit 759e033

Browse files
committed
init
0 parents  commit 759e033

15 files changed

+4926
-0
lines changed

.eslintrc.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"env": {
3+
"browser": false,
4+
"commonjs": true,
5+
"es6": true,
6+
"node": true,
7+
"mocha": true
8+
},
9+
"parserOptions": {
10+
"ecmaVersion": 2018,
11+
"ecmaFeatures": {
12+
"jsx": true
13+
},
14+
"sourceType": "module"
15+
},
16+
"rules": {
17+
"no-const-assign": "warn",
18+
"no-this-before-super": "warn",
19+
"no-undef": "warn",
20+
"no-unreachable": "warn",
21+
"no-unused-vars": "warn",
22+
"constructor-super": "warn",
23+
"valid-typeof": "warn"
24+
}
25+
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
.vscode-test/
3+
*.vsix

.vscode/extensions.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the extensions.json format
4+
"recommendations": [
5+
"dbaeumer.vscode-eslint"
6+
]
7+
}

.vscode/launch.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// A launch configuration that launches the extension 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": "Run Extension",
10+
"type": "extensionHost",
11+
"request": "launch",
12+
"args": [
13+
"--extensionDevelopmentPath=${workspaceFolder}"
14+
]
15+
},
16+
{
17+
"name": "Extension Tests",
18+
"type": "extensionHost",
19+
"request": "launch",
20+
"args": [
21+
"--extensionDevelopmentPath=${workspaceFolder}",
22+
"--extensionTestsPath=${workspaceFolder}/test/suite/index"
23+
]
24+
}
25+
]
26+
}

.vscodeignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.vscode/**
2+
.vscode-test/**
3+
test/**
4+
.gitignore
5+
.yarnrc
6+
vsc-extension-quickstart.md
7+
**/jsconfig.json
8+
**/*.map
9+
**/.eslintrc.json

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
3+
All notable changes to the "assembler" extension will be documented in this file.
4+
5+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6+
7+
## [Unreleased]
8+
9+
- Initial release

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# assembler README
2+
3+
This is the README for your extension "assembler". 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+
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, 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!**

extension.js

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
// The module 'vscode' contains the VS Code extensibility API
2+
// Import the module and reference it with the alias vscode in your code below
3+
const vscode = require('vscode');
4+
const { exec, execSync } = require('child_process');
5+
const fs = require('fs');
6+
const path = require('path');
7+
8+
9+
// This method is called when your extension is activated
10+
// Your extension is activated the very first time the command is executed
11+
12+
/**
13+
* @param {vscode.ExtensionContext} context
14+
*/
15+
16+
function activate(context) {
17+
18+
// Register the 'extension.runAssembly' command
19+
context.subscriptions.push(vscode.commands.registerCommand('extension.runAssembly', () => {
20+
// Call the 'extension.runAssembly' command when triggered
21+
vscode.commands.executeCommand('extension.runAssembly');
22+
}));
23+
24+
// Register the 'extension.installAssembleScript' command
25+
context.subscriptions.push(vscode.commands.registerCommand('extension.installAssembleScript', () => {
26+
// Call the 'extension.installAssembleScript' command when triggered
27+
vscode.commands.executeCommand('extension.installAssembleScript');
28+
}));
29+
30+
// Use the console to output diagnostic information (console.log) and errors (console.error)
31+
// This line of code will only be executed once when your extension is activated
32+
console.log('Congratulations, your extension "assembler" is now active!');
33+
34+
// The command has been defined in the package.json file
35+
// Now provide the implementation of the command with registerCommand
36+
// The commandId parameter must match the command field in package.json
37+
let disposable = vscode.commands.registerCommand('assembler.helloWorld', function () {
38+
// The code you place here will be executed every time your command is executed
39+
40+
// Display a message box to the user
41+
vscode.window.showInformationMessage('Running Assembly Code!');
42+
});
43+
44+
context.subscriptions.push(disposable);
45+
}
46+
47+
// Register a command to run the 'assemble' script on the currently open assembly file
48+
vscode.commands.registerCommand('extension.runAssembly', () => {
49+
// Get the active text editor
50+
const editor = vscode.window.activeTextEditor;
51+
52+
if (editor) {
53+
// Get the file path of the active assembly file
54+
const filePath = editor.document.fileName;
55+
56+
// Run the 'assemble' script with the assembly file as an argument
57+
exec(`./assemble ${filePath}`, (error, stdout, stderr) => {
58+
if (error) {
59+
vscode.window.showErrorMessage(`Error: ${error.message}`);
60+
return;
61+
}
62+
63+
// Display the output in the VSCode output channel
64+
vscode.window.createOutputChannel('Assembly Output').appendLine(stdout);
65+
vscode.window.createOutputChannel('Assembly Output').appendLine(stderr);
66+
});
67+
} else {
68+
vscode.window.showWarningMessage('No active text editor.');
69+
}
70+
});
71+
72+
// Function to copy the 'assemble' script to the runtime path and make it executable
73+
function installAssembleScript() {
74+
try {
75+
// Get the extension's installation path
76+
const extensionPath = vscode.extensions.getExtension('yourusername.vscode-assemble-extension').extensionPath;
77+
78+
// Define the source and destination paths for the 'assemble' script
79+
const sourcePath = path.join(extensionPath, 'scripts', 'assemble');
80+
const destinationPath = path.join(__dirname, 'assemble');
81+
82+
// Copy the 'assemble' script
83+
fs.copyFileSync(sourcePath, destinationPath);
84+
85+
// Make the 'assemble' script executable
86+
execSync(`chmod +x ${destinationPath}`);
87+
88+
vscode.window.showInformationMessage('Assemble script is now installed and executable.');
89+
} catch (error) {
90+
vscode.window.showErrorMessage(`Error: ${error.message}`);
91+
}
92+
}
93+
94+
// Register a command to install the 'assemble' script
95+
vscode.commands.registerCommand('extension.installAssembleScript', installAssembleScript);
96+
97+
// Rest of your extension code...
98+
99+
100+
// This method is called when your extension is deactivated
101+
function deactivate() { }
102+
103+
// exports.activate = activate;
104+
105+
module.exports = {
106+
activate,
107+
deactivate
108+
};

jsconfig.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "ES2020",
5+
"checkJs": true, /* Typecheck .js files. */
6+
"lib": [
7+
"ES2020"
8+
]
9+
},
10+
"exclude": [
11+
"node_modules"
12+
]
13+
}

0 commit comments

Comments
 (0)