# VSCode配置多行标签栏
修改
workbench.main.css
后,VSCode可能会警告VScode的完整性已损坏,请忽略该消息
VSCode打开多个文件时是在同一行滚动显示的,可以通过添加css样式的方法,修改tab栏样式。
# 方法一:修改workbench.main.css
- 打开文件
[VSCode 安装目录]/resources/app/out/vs/workbench/workbench.main.css
,添加如下css样式
/* 多行 */
.tabs-and-actions-container > .monaco-scrollable-element {
height: auto !important;
display: flex;
}
.tabs-and-actions-container > .monaco-scrollable-element > .tabs-container {
height: auto !important;
flex-wrap: wrap;
}
/* 设置最大高度 */
.tabs-container {
max-height: 100px !important;
overflow: auto !important;
}
/* 调整高度 */
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab {
height: 25px;
line-height: 25px;
padding-left: 4px;
font-size: 0.9em;
}
.monaco-workbench .part.editor>.content .editor-group-container>.title .tabs-container>.tab .tab-label {
line-height: 25px;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab .label-name {
font-size: inherit !important;
}
/* 调整侧边工具栏 */
.tabs-and-actions-container > .monaco-scrollable-element + div {
max-width: 200px;
height: auto !important;
display: flex;
flex-wrap: wrap;
overflow: auto!important;
background: #000;
}
.tabs-and-actions-container > .monaco-scrollable-element + div::-webkit-scrollbar {
width: 5px;
height: 8px;
background-color: #666; /* or add it to the track */
}
.tabs-and-actions-container > .monaco-scrollable-element + div::-webkit-scrollbar-thumb {
background: #333;
}
/* 面包屑修改
.monaco-breadcrumbs {
font-size:0.8em;
}
*/
/* 侧边栏测试代码
.tabs-and-actions-container > .monaco-scrollable-element + div > div {
height: 90%!important;
// background: #0000aa;
}
.tabs-and-actions-container > .monaco-scrollable-element + div > div > div{
background: #000066;
width: 80px;
height: 50px;
display: flex;
flex-wrap: wrap;
overflow: auto!important;
}
.tabs-and-actions-container > .monaco-scrollable-element + div > div > div div{
background: red;
}
.tabs-and-actions-container > .monaco-scrollable-element + div::-webkit-scrollbar {
display: none;
}
*/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
- 重新打开窗口:
cmd+shift+p
呼出命令框,输入reload
,点击Reload Window

# 方法二:自定义css文件
此方法测试未成功,自定义的css文件无法生效
安装vscode插件
Custom CSS and JS Loader
创建css文件,css样式同上
打开
setting.json
添加css文件配置:cmd+shift+p
呼出命令框,输入setting
,点击Open Settings(JSON)
,添加以下配置:
"vscode_custom_css.imports": [
"ile:///C:/vscode/custom.css"
],
"vscode_custom_css.policy": true,
1
2
3
4
2
3
4
按
cmd+shift+p
呼出命令框,输入Reload Custom CSS and JS
重新打开窗口
# 存在问题
标签栏多行每次开始换行时,标签栏高度有时不会调整到合适的高度,显示内容会折叠,处理方法:
- 拖动侧边栏,调整顶部标签栏高度,触发高度自动调整
- 需要点击收起/展开侧边栏,调整高度
- reload vscode