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

Commit1aab49c

Browse files
committed
saner launching of editor windows
1 parentf17682a commit1aab49c

File tree

3 files changed

+27
-28
lines changed

3 files changed

+27
-28
lines changed

‎src/actions/setupActions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const setupActions = async (workspaceRoot: vscode.WorkspaceFolder, {commands, co
5858
// await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
5959
// // there are times when initialization leave the panel behind any files opened
6060
// // ensure the panel is redrawn on the right side first
61-
// // webview.createOrShow(vscode.ViewColumn.Two)
61+
// // webview.createOrShow()
6262
// } catch (error) {
6363
// console.log(`Failed to open file ${filePath}`, error)
6464
// }

‎src/editor/ReactWebView.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class ReactWebView {
3535
this.extensionPath=extensionPath
3636

3737
// Create and show a new webview panel
38-
this.panel=this.createWebviewPanel(vscode.ViewColumn.Two)
38+
this.panel=this.createWebviewPanel()
3939

4040
// Set the webview initial html content
4141
this.render()
@@ -46,22 +46,23 @@ class ReactWebView {
4646

4747

4848
// update panel on changes
49-
constupdateWindows=()=>{
50-
vscode.commands.executeCommand('coderoad.open_webview')
51-
}
49+
//const updateWindows = () => {
50+
//vscode.commands.executeCommand('coderoad.open_webview')
51+
//}
5252

53-
// prevents new panels from going on top of coderoad panel
53+
////prevents new panels from going on top of coderoad panel
5454
vscode.window.onDidChangeActiveTextEditor((textEditor?:vscode.TextEditor)=>{
55-
//console.log('onDidChangeActiveTextEditor')
56-
//console.log(textEditor)
57-
if(!textEditor||textEditor.viewColumn!==vscode.ViewColumn.Two){
58-
updateWindows()
59-
}
55+
console.log('onDidChangeActiveTextEditor')
56+
console.log(textEditor)
57+
//if (!textEditor || textEditor.viewColumn !== vscode.ViewColumn.Two) {
58+
//updateWindows()
59+
//}
6060
})
61-
// // prevents moving coderoad panel on top of left panel
61+
// ////prevents moving coderoad panel on top of left panel
6262
vscode.window.onDidChangeVisibleTextEditors((textEditor:vscode.TextEditor[])=>{
63-
// console.log('onDidChangeVisibleTextEditors')
64-
updateWindows()
63+
console.log('onDidChangeVisibleTextEditors')
64+
console.log(textEditor)
65+
// updateWindows()
6566
})
6667

6768
// TODO: prevent window from moving to the left when no windows remain on rights
@@ -81,13 +82,18 @@ class ReactWebView {
8182
this.send=this.channel.send
8283
}
8384

84-
publiccreateOrShow(column:number):void{
85+
publiccreateOrShow():void{
86+
// reset layout
87+
vscode.commands.executeCommand('vscode.setEditorLayout',{
88+
orientation:0,
89+
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
90+
})
8591
// If we already have a panel, show it.
8692
// Otherwise, create a new panel.
8793
if(this.panel&&this.panel.webview){
88-
this.panel.reveal(column)
94+
this.panel.reveal(vscode.ViewColumn.Two)
8995
}else{
90-
this.panel=this.createWebviewPanel(column)
96+
this.panel=this.createWebviewPanel()
9197
}
9298
}
9399

@@ -98,7 +104,7 @@ class ReactWebView {
98104
Promise.all(this.disposables.map((x)=>x.dispose()))
99105
}
100106

101-
privatecreateWebviewPanel=(column:number):vscode.WebviewPanel=>{
107+
privatecreateWebviewPanel=():vscode.WebviewPanel=>{
102108
constviewType='CodeRoad'
103109
consttitle='CodeRoad'
104110
constconfig={
@@ -109,7 +115,7 @@ class ReactWebView {
109115
// prevents destroying the window when it is in the background
110116
retainContextWhenHidden:true,
111117
}
112-
returnvscode.window.createWebviewPanel(viewType,title,column,config)
118+
returnvscode.window.createWebviewPanel(viewType,title,vscode.ViewColumn.Two,config)
113119
}
114120

115121
privaterender=async():Promise<void>=>{

‎src/editor/commands.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,9 @@ export const createCommands = ({extensionPath, workspaceState, workspaceRoot}: C
4747
})
4848
},
4949
// open React webview
50-
[COMMANDS.OPEN_WEBVIEW]:(column:number=vscode.ViewColumn.Two)=>{
50+
[COMMANDS.OPEN_WEBVIEW]:()=>{
5151
// setup 1x1 horizontal layout
52-
53-
// reset layout
54-
vscode.commands.executeCommand('vscode.setEditorLayout',{
55-
orientation:0,
56-
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
57-
})
58-
59-
webview.createOrShow(column)
52+
webview.createOrShow()
6053
},
6154
[COMMANDS.SET_CURRENT_STEP]:({stepId}:{stepId:string})=>{
6255
// NOTE: as async, may sometimes be inaccurate

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp