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

Commit493283c

Browse files
committed
fix open file not working - revert
1 parenta3c0fb0 commit493283c

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

‎src/actions/setupActions.ts

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ const commandErrorMessageFilter: ErrorMessageFilter = {
1717
}
1818
}
1919

20-
construnCommands=async(commands:string[],language:string)=>{
20+
21+
// TODO: pass command and command name down for filtering. Eg. JAVASCRIPT, 'npm install'
22+
construnCommands=async(commands:string[],language:string='JAVASCRIPT')=>{
2123
for(constcommandofcommands){
2224
const{stdout, stderr}=awaitnode.exec(command)
2325
if(stderr){
@@ -43,13 +45,28 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
4345
}
4446

4547
// run command
46-
48+
awaitrunCommands(commands)
4749

4850
// open files
4951
for(constfilePathoffiles){
5052
console.log(`OPEN_FILE${filePath}`)
5153
try{
52-
constabsoluteFilePath=join(workspaceRoot.uri.path,filePath)
54+
// TODO: figure out why this does not work
55+
// try {
56+
// const absoluteFilePath = join(workspaceRoot.uri.path, filePath)
57+
// const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
58+
// await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
59+
// // there are times when initialization leave the panel behind any files opened
60+
// // ensure the panel is redrawn on the right side first
61+
// // webview.createOrShow(vscode.ViewColumn.Two)
62+
// } catch (error) {
63+
// console.log(`Failed to open file ${filePath}`, error)
64+
// }
65+
constwr=vscode.workspace.rootPath
66+
if(!wr){
67+
thrownewError('No workspace root path')
68+
}
69+
constabsoluteFilePath=join(wr,filePath)
5370
constdoc=awaitvscode.workspace.openTextDocument(absoluteFilePath)
5471
awaitvscode.window.showTextDocument(doc,vscode.ViewColumn.One)
5572
// there are times when initialization leave the panel behind any files opened
@@ -61,4 +78,6 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
6178
}
6279
}
6380

64-
exportdefaultsetupActions
81+
exportdefaultsetupActions
82+
83+

‎src/services/git/gitAction.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
importnodefrom'../node'
2+
3+
interfaceGitAction{
4+
command:string
5+
onError?(stderr:string):any
6+
onSuccess?(stdout:string):any
7+
}
8+
9+
// handle common node.exec logic
10+
exportconstgitAction=async({command, onError, onSuccess}:GitAction)=>{
11+
const{stdout, stderr}=awaitnode.exec(command)
12+
if(onError&&stderr){
13+
returnonError(stderr)
14+
}elseif(onSuccess&&stdout){
15+
returnonSuccess(stdout)
16+
}
17+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp