-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ebee584
commit 15afb42
Showing
17 changed files
with
498 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,9 @@ dist | |
*.sass.ts | ||
|
||
# Visual Studio Code | ||
.vscode | ||
.vscode/** | ||
!.vscode/launch.json | ||
!.vscode/tasks.json | ||
|
||
# Heft | ||
.heft |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "build", | ||
"path": "apps/vscode-extension/", | ||
"group": "build", | ||
"problemMatcher": [], | ||
"label": "npm: build - apps/vscode-extension", | ||
"detail": "heft build --clean" | ||
}, | ||
{ | ||
"type": "npm", | ||
"script": "build:watch", | ||
"path": "apps/vscode-extension/", | ||
"group": "build", | ||
"isBackground": true, | ||
"presentation": { | ||
"reveal": "never", | ||
}, | ||
"problemMatcher": [ | ||
{ | ||
"owner": "heft", | ||
"fileLocation": ["relative", "${workspaceFolder}"], | ||
"background": { | ||
"activeOnStart": true, | ||
"beginsPattern": "File change detected\\. Starting incremental compilation\\.\\.\\.", | ||
"endsPattern": "Found\\s+\\d+\\s+errors\\. Watching for file changes\\." | ||
}, | ||
"pattern": { | ||
"regexp": "^(Error):\\s+(.*):(\\d+):(\\d+)\\s+-\\s+(.*)$", | ||
"file": 2, | ||
"line": 3, | ||
"column": 4, | ||
"severity": 1, | ||
"message": 5, | ||
} | ||
} | ||
], | ||
"label": "npm: build:watch - apps/vscode-extension", | ||
"detail": "heft build --watch" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// This is a workaround for https://github.com/eslint/eslint/issues/3458 | ||
require('@rushstack/eslint-config/patch/modern-module-resolution'); | ||
|
||
module.exports = { | ||
ignorePatterns: ['out', 'dist', '**/*.d.ts'], | ||
extends: [ | ||
'@rushstack/eslint-config/profile/node-trusted-tool', | ||
'@rushstack/eslint-config/mixins/friendly-locals' | ||
], | ||
parserOptions: { tsconfigRootDir: __dirname } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
out | ||
dist | ||
node_modules | ||
.vscode-test/ | ||
*.vsix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
src/** | ||
config/** | ||
.gitignore | ||
.yarnrc | ||
vsc-extension-quickstart.md | ||
**/tsconfig.json | ||
**/.eslintrc.json | ||
**/*.map | ||
**/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"projectOutputFolderNames": ["dist", "out"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "rushstack-vscode-extension", | ||
"displayName": "RushStack", | ||
"version": "0.0.0", | ||
"description": "Visual Studio Extension for RushStack", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/microsoft/rushstack.git", | ||
"directory": "apps/vscode-extension" | ||
}, | ||
"license": "MIT", | ||
"author": "Cheng Liu<[email protected]>", | ||
"main": "./out/extension.js", | ||
"scripts": { | ||
"build": "heft build --clean", | ||
"build:watch": "heft build --watch", | ||
"pretest": "npm run build", | ||
"test": "node ./out/test/runTest.js" | ||
}, | ||
"contributes": { | ||
"commands": [ | ||
{ | ||
"command": "rushstack.helloWorld", | ||
"title": "Hello World" | ||
} | ||
] | ||
}, | ||
"activationEvents": [ | ||
"onCommand:rushstack.helloWorld" | ||
], | ||
"devDependencies": { | ||
"@rushstack/eslint-config": "workspace:*", | ||
"@rushstack/heft": "workspace:*", | ||
"@rushstack/heft-node-rig": "workspace:*", | ||
"@types/glob": "7.1.1", | ||
"@types/heft-jest": "1.0.1", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "12.20.24", | ||
"@types/vscode": "^1.63.0", | ||
"@typescript-eslint/eslint-plugin": "~5.6.0", | ||
"@typescript-eslint/parser": "~5.6.0", | ||
"@vscode/test-electron": "^1.6.2", | ||
"eslint": "~8.3.0", | ||
"glob": "~7.0.5", | ||
"mocha": "^9.1.3", | ||
"typescript": "^4.4.4" | ||
}, | ||
"engines": { | ||
"vscode": "^1.63.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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 | ||
export function activate(context: vscode.ExtensionContext): void { | ||
// 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 "vscode-hello-world" 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 | ||
const disposable: vscode.Disposable = vscode.commands.registerCommand('rushstack.helloWorld', async () => { | ||
// The code you place here will be executed every time your command is executed | ||
// Display a message box to the user | ||
await vscode.window.showInformationMessage('Hello World from RushStack!'); | ||
}); | ||
|
||
context.subscriptions.push(disposable); | ||
} | ||
|
||
// this method is called when your extension is deactivated | ||
export function deactivate(): void {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as path from 'path'; | ||
|
||
import { runTests } from '@vscode/test-electron'; | ||
|
||
async function main(): Promise<void> { | ||
try { | ||
// The folder containing the Extension Manifest package.json | ||
// Passed to `--extensionDevelopmentPath` | ||
const extensionDevelopmentPath: string = path.resolve(__dirname, '../../'); | ||
|
||
// The path to test runner | ||
// Passed to --extensionTestsPath | ||
const extensionTestsPath: string = path.resolve(__dirname, './suite/index'); | ||
|
||
// Download VS Code, unzip it and run the integration test | ||
await runTests({ extensionDevelopmentPath, extensionTestsPath }); | ||
} catch (err) { | ||
console.error('Failed to run tests'); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as assert from 'assert'; | ||
|
||
// You can import and use all API from the 'vscode' module | ||
// as well as import your extension to test it | ||
import * as vscode from 'vscode'; | ||
// import * as myExtension from '../../extension'; | ||
|
||
suite('Extension Test Suite', () => { | ||
// eslint-disable-next-line @typescript-eslint/no-floating-promises | ||
vscode.window.showInformationMessage('Start all tests.'); | ||
|
||
test('Sample test', () => { | ||
assert.strictEqual(-1, [1, 2, 3].indexOf(5)); | ||
assert.strictEqual(-1, [1, 2, 3].indexOf(0)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import * as path from 'path'; | ||
import Mocha from 'mocha'; | ||
import glob from 'glob'; | ||
|
||
export function run(): Promise<void> { | ||
// Create the mocha test | ||
const mocha: Mocha = new Mocha({ | ||
ui: 'tdd', | ||
color: true | ||
}); | ||
|
||
const testsRoot: string = path.resolve(__dirname, '..'); | ||
|
||
return new Promise((resolve, reject) => { | ||
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => { | ||
if (err) { | ||
return reject(err); | ||
} | ||
|
||
// Add files to the test suite | ||
files.forEach((f) => mocha.addFile(path.resolve(testsRoot, f))); | ||
|
||
try { | ||
// Run the mocha test | ||
mocha.run((failures) => { | ||
if (failures > 0) { | ||
reject(new Error(`${failures} tests failed.`)); | ||
} else { | ||
resolve(); | ||
} | ||
}); | ||
} catch (err) { | ||
console.error(err); | ||
reject(err); | ||
} | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./node_modules/@rushstack/heft-node-rig/profiles/default/tsconfig-base.json", | ||
"compilerOptions": { | ||
"outDir": "out", | ||
"types": ["mocha", "node"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.