Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature/vscode commands#418

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 1 commit intofeature/hooksfromfeature/vscode-commands
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletionssrc/services/hooks/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,12 +4,14 @@ import loadCommits from './utils/loadCommits'
import loadWatchers from './utils/loadWatchers'
import openFiles from './utils/openFiles'
import runCommands from './utils/runCommands'
import runVSCodeCommands from './utils/runVSCodeCommands'
import { onError as telemetryOnError } from '../telemetry'
import { onRunTest } from '../../actions/onTest'

export const onInit = async (actions: TT.StepActions): Promise<void> => {
await loadCommits(actions.commits)
await runCommands(actions.commands)
await runVSCodeCommands(actions.vscodeCommands)
}

export const onLevelEnter = async (actions: TT.StepActions): Promise<void> => {
Expand All@@ -23,6 +25,7 @@ export const onSetupEnter = async (actions: TT.StepActions): Promise<void> => {
await openFiles(actions.files)
await loadWatchers(actions.watchers)
await runCommands(actions.commands)
await runVSCodeCommands(actions.vscodeCommands)
}

export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> => {
Expand All@@ -31,6 +34,7 @@ export const onSolutionEnter = async (actions: TT.StepActions): Promise<void> =>
await loadCommits(actions.commits)
await openFiles(actions.files)
await runCommands(actions.commands)
await runVSCodeCommands(actions.vscodeCommands)
await onRunTest()
}

Expand Down
2 changes: 1 addition & 1 deletionsrc/services/hooks/utils/runCommands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,7 +16,7 @@ const runCommands = async (commands: string[] = []): Promise<void> => {
result=awaitexec({ command})
console.log(result)
}catch(error){
console.error(`Test failed:${error.message}`)
console.error(`Command failed:${error.message}`)
send({type:'COMMAND_FAIL',payload:{process:{ ...process,status:'FAIL'}}})
return
}
Expand Down
26 changes: 26 additions & 0 deletionssrc/services/hooks/utils/runVSCodeCommands.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
import * as vscode from 'vscode'
import * as TT from 'typings/tutorial'

// what are VSCode commands?
// - https://code.visualstudio.com/api/references/vscode-api#commands
// a list of commands:
// - https://code.visualstudio.com/api/references/commands (note many take params)
// - https://code.visualstudio.com/docs/getstarted/keybindings (anything keybound is a command)

const runVSCodeCommands = async (commands: TT.VSCodeCommand[] = []): Promise<void> => {
if (!commands.length) {
return
}
for (const command of commands) {
if (typeof command === 'string') {
// string named commands
await vscode.commands.executeCommand(command)
} else if (Array.isArray(command)) {
// array commands with params
const [name, params] = command
await vscode.commands.executeCommand(name, params)
}
}
}

export default runVSCodeCommands
3 changes: 3 additions & 0 deletionstypings/tutorial.d.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,6 +61,7 @@ export type StepActions = {
files?:string[]
watchers?:string[]
filter?:string
vscodeCommands?:VSCodeCommand[]
}

exportinterfaceTestRunnerArgs{
Expand DownExpand Up@@ -88,3 +89,5 @@ export interface TutorialDependency {
exportinterfaceTutorialAppVersions{
vscode:string
}

exporttypeVSCodeCommand=string|[string,any]

[8]ページ先頭

©2009-2025 Movatter.jp