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

Commitd5d15de

Browse files
committed
fix layout overlap issue
1 parent9f23466 commitd5d15de

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

‎package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
"command":"coderoad.start",
3737
"title":"Start",
3838
"category":"CodeRoad"
39-
},
40-
{
41-
"command":"coderoad.set_layout",
42-
"title":"Set Layout",
43-
"category":"CodeRoad"
4439
}
4540
]
4641
},

‎src/editor/commands/index.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const COMMANDS = {
1818
RUN_TEST:'coderoad.run_test',
1919
TEST_PASS:'coderoad.test_pass',
2020
TEST_FAIL:'coderoad.test_fail',
21-
SET_LAYOUT:'coderoad.set_layout',
2221
}
2322

2423
interfaceCreateCommandProps{
@@ -29,13 +28,21 @@ interface CreateCommandProps {
2928
position:any
3029
}
3130

31+
constresetLayout=()=>{
32+
vscode.commands.executeCommand('vscode.setEditorLayout',{
33+
orientation:0,
34+
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
35+
})
36+
}
37+
3238
exportconstcreateCommands=({ context, machine, storage, git, position}:CreateCommandProps)=>{
3339
// React panel webview
3440
letwebview:any
3541

3642
return{
3743
// initialize
3844
[COMMANDS.START]:()=>{
45+
3946
letwebviewState:'INITIALIZING'|'RESTARTING'
4047
if(!webview){
4148
webviewState='INITIALIZING'
@@ -64,10 +71,7 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
6471
// open React webview
6572
[COMMANDS.OPEN_WEBVIEW]:(column:number=vscode.ViewColumn.Two)=>{
6673
// setup 1x1 horizontal layout
67-
vscode.commands.executeCommand('vscode.setEditorLayout',{
68-
orientation:0,
69-
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
70-
})
74+
resetLayout()
7175
constcallback=()=>{
7276
machine.send('WEBVIEW_INITIALIZED')
7377
}
@@ -118,6 +122,9 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
118122
constabsoluteFilePath=join(workspaceRoot,relativeFilePath)
119123
constdoc=awaitvscode.workspace.openTextDocument(absoluteFilePath)
120124
awaitvscode.window.showTextDocument(doc,vscode.ViewColumn.One)
125+
// there are times when intialization leave the panel behind any files opened
126+
// ensure the panel is redrawn on the right side first
127+
webview.createOrShow(vscode.ViewColumn.Two)
121128
}catch(error){
122129
console.log(`Failed to open file${relativeFilePath}`,error)
123130
}
@@ -145,12 +152,5 @@ export const createCommands = ({ context, machine, storage, git, position }: Cre
145152
[COMMANDS.TEST_FAIL]:()=>{
146153
vscode.window.showWarningMessage('FAIL')
147154
},
148-
[COMMANDS.SET_LAYOUT]:()=>{
149-
console.log('setLayout')
150-
vscode.commands.executeCommand('vscode.setEditorLayout',{
151-
orientation:0,
152-
groups:[{groups:[{}],size:0.6},{groups:[{}],size:0.4}],
153-
})
154-
},
155155
}
156156
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp