-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add generator for example VS Code extension #155
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// The following code is based on | ||
// https://github.com/microsoft/vscode-extension-samples/blob/7b9a0a8c4c631e393862c3e767c7be26bb2233b2/.base-sample/src/extension.ts | ||
// which was published under MIT License (https://github.com/microsoft/vscode-extension-samples/blob/main/LICENSE) | ||
// For more information see https://code.visualstudio.com/api | ||
|
||
// The module 'vscode' contains the VS Code extensibility API | ||
// Import the module and reference it with the alias vscode in your code below | ||
import * as vscode from 'vscode'; | ||
|
||
// this method is called when your extension is activated | ||
// your extension is activated the very first time the command is executed | ||
|
||
/** | ||
* @param {vscode.ExtensionContext} context | ||
*/ | ||
function activate(context: vscode.ExtensionContext) { | ||
// Use the console to output diagnostic information (console.log) and errors (console.error) | ||
// This line of code will only be executed once when your extension is activated | ||
console.log('Congratulations, your extension "<%= params.extensionName %>" is now active!'); | ||
|
||
// The command has been defined in the package.json file | ||
// Now provide the implementation of the command with registerCommand | ||
// The commandId parameter must match the command field in package.json | ||
let disposable = vscode.commands.registerCommand('<%= params.extensionName %>.helloWorld', () => { | ||
// The code you place here will be executed every time your command is executed | ||
|
||
// Display a message box to the user | ||
vscode.window.showInformationMessage('Hello World from a VS Code extension!'); | ||
}); | ||
|
||
context.subscriptions.push(disposable); | ||
} | ||
|
||
// this method is called when your extension is deactivated | ||
function deactivate() {} | ||
|
||
// eslint-disable-next-line no-undef | ||
module.exports = { | ||
activate, | ||
deactivate | ||
} | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.vsix | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: newline. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "<%= params.extensionName %>", | ||
"displayName": "Hello World (VS Code extension)", | ||
"engines": { | ||
"vscode": "^1.32.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we targetting such an old vscode version, should it not at least match our currently supported api version |
||
}, | ||
"version": "<%= params.version %>",<% | ||
if (params.description) { %> | ||
"description": "<%= params.description %>", | ||
<%} %><% | ||
if (params.author) { %> | ||
"author": "<%= params.author %>", | ||
<% } %><% | ||
if (params.license) { %> | ||
"license": "<%= params.license %>", | ||
<% } %><% | ||
if (params.githubURL) { %> | ||
"repository": { | ||
"type": "git", | ||
"url": "<%= params.githubURL %>.git" | ||
}, | ||
"bugs": { | ||
"url": "<%= params.githubURL %>/issues" | ||
}, | ||
"homepage": "<%= params.githubURL %>",<% } %> | ||
"categories": [ | ||
"Other" | ||
], | ||
"activationEvents": [ | ||
"onCommand:<%= params.extensionName %>.helloWorld" | ||
], | ||
"main": "./lib/extension.js", | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "<%= params.extensionName %>.helloWorld", | ||
"title": "Hello World (VS Code extension)" | ||
} | ||
] | ||
}, | ||
"scripts": { | ||
"compile": "tsc -p ./", | ||
"watch": "tsc -watch -p ./", | ||
"prepare": "yarn run clean && yarn run build && yarn symlink", | ||
"clean": "rimraf lib", | ||
"build": "yarn run compile", | ||
"symlink": "symlink-dir . ../plugins/<%= params.extensionName %>" | ||
}, | ||
"devDependencies": { | ||
"@types/vscode": "^1.32.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as |
||
"symlink-dir": "latest", | ||
"rimraf": "latest", | ||
"typescript": "latest" | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: newline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: newline.