Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
6187c667
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6187c667
编写于
10月 15, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sqlite - reduce pressure on storage
上级
d68c05c3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
36 addition
and
20 deletion
+36
-20
src/vs/editor/contrib/suggest/suggestMemory.ts
src/vs/editor/contrib/suggest/suggestMemory.ts
+3
-7
src/vs/workbench/browser/layout.ts
src/vs/workbench/browser/layout.ts
+32
-12
src/vs/workbench/parts/splash/electron-browser/partsSplash.contribution.ts
...parts/splash/electron-browser/partsSplash.contribution.ts
+1
-1
未找到文件。
src/vs/editor/contrib/suggest/suggestMemory.ts
浏览文件 @
6187c667
...
...
@@ -8,7 +8,6 @@ import { LRUCache, TernarySearchTree } from 'vs/base/common/map';
import
{
IStorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
import
{
CompletionItemKind
,
completionKindFromLegacyString
}
from
'
vs/editor/common/modes
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
Disposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -200,7 +199,6 @@ export class SuggestMemories extends Disposable {
private
_mode
:
MemMode
;
private
_strategy
:
Memory
;
private
readonly
_persistSoon
:
RunOnceScheduler
;
constructor
(
editor
:
ICodeEditor
,
...
...
@@ -208,10 +206,9 @@ export class SuggestMemories extends Disposable {
)
{
super
();
this
.
_persistSoon
=
this
.
_register
(
new
RunOnceScheduler
(()
=>
this
.
_flush
(),
3000
));
this
.
_setMode
(
editor
.
getConfiguration
().
contribInfo
.
suggestSelection
);
this
.
_register
(
editor
.
onDidChangeConfiguration
(
e
=>
e
.
contribInfo
&&
this
.
_setMode
(
editor
.
getConfiguration
().
contribInfo
.
suggestSelection
)));
this
.
_register
(
_storageService
.
onWillClose
(()
=>
this
.
_
flush
()));
this
.
_register
(
_storageService
.
onWillClose
(()
=>
this
.
_
saveState
()));
}
private
_setMode
(
mode
:
MemMode
):
void
{
...
...
@@ -233,15 +230,14 @@ export class SuggestMemories extends Disposable {
memorize
(
model
:
ITextModel
,
pos
:
IPosition
,
item
:
ICompletionItem
):
void
{
this
.
_strategy
.
memorize
(
model
,
pos
,
item
);
this
.
_persistSoon
.
schedule
();
}
select
(
model
:
ITextModel
,
pos
:
IPosition
,
items
:
ICompletionItem
[]):
number
{
return
this
.
_strategy
.
select
(
model
,
pos
,
items
);
}
private
_
flush
()
{
private
_
saveState
()
{
const
raw
=
JSON
.
stringify
(
this
.
_strategy
);
this
.
_storageService
.
store
(
`
${
this
.
_storagePrefix
}
/
${
this
.
_mode
}
`
,
raw
,
StorageScope
.
WORKSPACE
);
this
.
_storageService
.
store
(
`
${
this
.
_storagePrefix
}
/
${
this
.
_mode
}
`
,
raw
,
StorageScope
.
WORKSPACE
);
//
}
}
src/vs/workbench/browser/layout.ts
浏览文件 @
6187c667
...
...
@@ -25,6 +25,7 @@ import { SidebarPart } from 'vs/workbench/browser/parts/sidebar/sidebarPart';
import
{
PanelPart
}
from
'
vs/workbench/browser/parts/panel/panelPart
'
;
import
{
StatusbarPart
}
from
'
vs/workbench/browser/parts/statusbar/statusbarPart
'
;
import
{
getZoomFactor
}
from
'
vs/base/browser/browser
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
const
TITLE_BAR_HEIGHT
=
isMacintosh
?
22
:
30
;
const
STATUS_BAR_HEIGHT
=
22
;
...
...
@@ -67,6 +68,8 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
private
_panelHeight
:
number
;
private
_panelWidth
:
number
;
private
saveStateScheduler
:
RunOnceScheduler
;
constructor
(
private
parent
:
HTMLElement
,
private
workbenchContainer
:
HTMLElement
,
...
...
@@ -99,6 +102,9 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
this
.
sashXTwo
=
new
Sash
(
this
.
workbenchContainer
,
this
);
this
.
sashY
=
new
Sash
(
this
.
workbenchContainer
,
this
,
{
orientation
:
Orientation
.
HORIZONTAL
});
// State scheduler
this
.
saveStateScheduler
=
new
RunOnceScheduler
(()
=>
this
.
saveState
(),
1000
);
this
.
registerListeners
();
}
...
...
@@ -115,6 +121,10 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
private
registerListeners
():
void
{
this
.
_register
(
this
.
themeService
.
onThemeChange
(
_
=>
this
.
layout
()));
this
.
_register
(
this
.
parts
.
editor
.
onDidSizeConstraintsChange
(()
=>
this
.
onDidEditorSizeConstraintsChange
()));
this
.
_register
(
this
.
storageService
.
onWillClose
(()
=>
{
this
.
saveStateScheduler
.
dispose
();
this
.
saveState
();
}));
this
.
registerSashListeners
();
}
...
...
@@ -372,20 +382,21 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
}));
this
.
_register
(
this
.
sashXOne
.
onDidEnd
(()
=>
{
this
.
s
torageService
.
store
(
WorkbenchLayout
.
sashXOneWidthSettingsKey
,
this
.
sidebarWidth
,
StorageScope
.
GLOBAL
);
this
.
s
aveStateScheduler
.
schedule
(
);
}));
this
.
_register
(
this
.
sashY
.
onDidEnd
(()
=>
{
this
.
s
torageService
.
store
(
WorkbenchLayout
.
sashYHeightSettingsKey
,
this
.
panelHeight
,
StorageScope
.
GLOBAL
);
this
.
s
aveStateScheduler
.
schedule
(
);
}));
this
.
_register
(
this
.
sashXTwo
.
onDidEnd
(()
=>
{
this
.
s
torageService
.
store
(
WorkbenchLayout
.
sashXTwoWidthSettingsKey
,
this
.
panelWidth
,
StorageScope
.
GLOBAL
);
this
.
s
aveStateScheduler
.
schedule
(
);
}));
this
.
_register
(
this
.
sashY
.
onDidReset
(()
=>
{
this
.
panelHeight
=
this
.
sidebarHeight
*
DEFAULT_PANEL_SIZE_COEFFICIENT
;
this
.
storageService
.
store
(
WorkbenchLayout
.
sashYHeightSettingsKey
,
this
.
panelHeight
,
StorageScope
.
GLOBAL
);
this
.
saveStateScheduler
.
schedule
();
this
.
layout
();
}));
...
...
@@ -394,20 +405,22 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
let
activeViewlet
=
this
.
viewletService
.
getActiveViewlet
();
let
optimalWidth
=
activeViewlet
&&
activeViewlet
.
getOptimalWidth
();
this
.
sidebarWidth
=
Math
.
max
(
optimalWidth
,
DEFAULT_SIDEBAR_PART_WIDTH
);
this
.
storageService
.
store
(
WorkbenchLayout
.
sashXOneWidthSettingsKey
,
this
.
sidebarWidth
,
StorageScope
.
GLOBAL
);
this
.
saveStateScheduler
.
schedule
();
this
.
partService
.
setSideBarHidden
(
false
).
then
(()
=>
this
.
layout
());
}));
this
.
_register
(
this
.
sashXTwo
.
onDidReset
(()
=>
{
this
.
panelWidth
=
(
this
.
workbenchSize
.
width
-
this
.
sidebarWidth
-
this
.
activitybarWidth
)
*
DEFAULT_PANEL_SIZE_COEFFICIENT
;
this
.
storageService
.
store
(
WorkbenchLayout
.
sashXTwoWidthSettingsKey
,
this
.
panelWidth
,
StorageScope
.
GLOBAL
);
this
.
saveStateScheduler
.
schedule
();
this
.
layout
();
}));
}
layout
(
options
?:
ILayoutOptions
):
void
{
layout
(
options
?:
ILayoutOptions
):
void
{
//
this
.
workbenchSize
=
getClientArea
(
this
.
parent
);
const
isActivityBarHidden
=
!
this
.
partService
.
isVisible
(
Parts
.
ACTIVITYBAR_PART
);
...
...
@@ -476,8 +489,6 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
}
}
this
.
storageService
.
store
(
WorkbenchLayout
.
panelSizeBeforeMaximizedKey
,
this
.
panelSizeBeforeMaximized
,
StorageScope
.
GLOBAL
);
const
panelDimension
=
new
Dimension
(
panelWidth
,
panelHeight
);
// Editor
...
...
@@ -532,16 +543,13 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
if
(
!
isSidebarHidden
)
{
this
.
sidebarWidth
=
sidebarSize
.
width
;
this
.
storageService
.
store
(
WorkbenchLayout
.
sashXOneWidthSettingsKey
,
this
.
sidebarWidth
,
StorageScope
.
GLOBAL
);
}
if
(
!
isPanelHidden
)
{
if
(
panelPosition
===
Position
.
BOTTOM
)
{
this
.
panelHeight
=
panelDimension
.
height
;
this
.
storageService
.
store
(
WorkbenchLayout
.
sashYHeightSettingsKey
,
this
.
panelHeight
,
StorageScope
.
GLOBAL
);
}
else
{
this
.
panelWidth
=
panelDimension
.
width
;
this
.
storageService
.
store
(
WorkbenchLayout
.
sashXTwoWidthSettingsKey
,
this
.
panelWidth
,
StorageScope
.
GLOBAL
);
}
}
...
...
@@ -647,6 +655,9 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
// Propagate to Context View
this
.
contextViewService
.
layout
();
// Schedule save state
this
.
saveStateScheduler
.
schedule
();
}
getVerticalSashTop
(
sash
:
Sash
):
number
{
...
...
@@ -748,4 +759,13 @@ export class WorkbenchLayout extends Disposable implements IVerticalSashLayoutPr
this
.
layout
();
}
}
private
saveState
():
void
{
this
.
storageService
.
store
(
WorkbenchLayout
.
sashXOneWidthSettingsKey
,
this
.
sidebarWidth
,
StorageScope
.
GLOBAL
);
this
.
storageService
.
store
(
WorkbenchLayout
.
sashYHeightSettingsKey
,
this
.
panelHeight
,
StorageScope
.
GLOBAL
);
this
.
storageService
.
store
(
WorkbenchLayout
.
sashXTwoWidthSettingsKey
,
this
.
panelWidth
,
StorageScope
.
GLOBAL
);
this
.
storageService
.
store
(
WorkbenchLayout
.
panelSizeBeforeMaximizedKey
,
this
.
panelSizeBeforeMaximized
,
StorageScope
.
GLOBAL
);
}
}
src/vs/workbench/parts/splash/electron-browser/partsSplash.contribution.ts
浏览文件 @
6187c667
...
...
@@ -41,7 +41,7 @@ class PartsSplash {
debounceEvent
(
anyEvent
<
any
>
(
onDidChangeFullscreen
,
_partService
.
onEditorLayout
),
()
=>
{
},
15
0
)(
this
.
_savePartsSplash
,
this
,
this
.
_disposables
);
),
()
=>
{
},
80
0
)(
this
.
_savePartsSplash
,
this
,
this
.
_disposables
);
}
dispose
():
void
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录