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

fix open file not working - revert#36

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 intomasterfromfix/git-reliability
Sep 28, 2019
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
27 changes: 23 additions & 4 deletionssrc/actions/setupActions.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,9 @@ const commandErrorMessageFilter: ErrorMessageFilter = {
}
}

const runCommands = async (commands: string[], language: string) => {

// TODO: pass command and command name down for filtering. Eg. JAVASCRIPT, 'npm install'
const runCommands = async (commands: string[], language: string = 'JAVASCRIPT') => {
for (const command of commands) {
const {stdout, stderr} = await node.exec(command)
if (stderr) {
Expand All@@ -43,13 +45,28 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
}

// run command

await runCommands(commands)

// open files
for (const filePath of files) {
console.log(`OPEN_FILE ${filePath}`)
try {
const absoluteFilePath = join(workspaceRoot.uri.path, filePath)
// TODO: figure out why this does not work
// try {
// const absoluteFilePath = join(workspaceRoot.uri.path, filePath)
// const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
// await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
// // there are times when initialization leave the panel behind any files opened
// // ensure the panel is redrawn on the right side first
// // webview.createOrShow(vscode.ViewColumn.Two)
// } catch (error) {
// console.log(`Failed to open file ${filePath}`, error)
// }
const wr = vscode.workspace.rootPath
if (!wr) {
throw new Error('No workspace root path')
}
const absoluteFilePath = join(wr, filePath)
const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
// there are times when initialization leave the panel behind any files opened
Expand All@@ -61,4 +78,6 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
}
}

export default setupActions
export default setupActions


17 changes: 17 additions & 0 deletionssrc/services/git/gitAction.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
import node from '../node'

interface GitAction {
command: string
onError?(stderr: string): any
onSuccess?(stdout: string): any
}

// handle common node.exec logic
export const gitAction = async ({command, onError, onSuccess}: GitAction) => {
const {stdout, stderr} = await node.exec(command)
if (onError && stderr) {
return onError(stderr)
} else if (onSuccess && stdout) {
return onSuccess(stdout)
}
}

[8]ページ先頭

©2009-2025 Movatter.jp