Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b77b9af3
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b77b9af3
编写于
10月 11, 2018
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sqlite - first cut next storage adoption
上级
03222d20
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
120 addition
and
115 deletion
+120
-115
src/vs/editor/browser/config/configuration.ts
src/vs/editor/browser/config/configuration.ts
+5
-5
src/vs/editor/contrib/find/findController.ts
src/vs/editor/contrib/find/findController.ts
+15
-15
src/vs/editor/contrib/find/test/findController.test.ts
src/vs/editor/contrib/find/test/findController.test.ts
+20
-9
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
+10
-4
src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts
...r/contrib/parameterHints/test/parameterHintsModel.test.ts
+2
-2
src/vs/editor/contrib/referenceSearch/referencesController.ts
...vs/editor/contrib/referenceSearch/referencesController.ts
+4
-4
src/vs/editor/contrib/suggest/suggestMemory.ts
src/vs/editor/contrib/suggest/suggestMemory.ts
+4
-4
src/vs/editor/contrib/suggest/suggestWidget.ts
src/vs/editor/contrib/suggest/suggestWidget.ts
+6
-26
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
+2
-2
src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts
...lone/browser/referenceSearch/standaloneReferenceSearch.ts
+4
-4
src/vs/editor/standalone/browser/standaloneServices.ts
src/vs/editor/standalone/browser/standaloneServices.ts
+3
-0
src/vs/platform/storage2/electron-browser/nextStorage2Service.ts
...platform/storage2/electron-browser/nextStorage2Service.ts
+1
-1
src/vs/platform/telemetry/node/workbenchCommonProperties.ts
src/vs/platform/telemetry/node/workbenchCommonProperties.ts
+17
-12
src/vs/platform/telemetry/test/electron-browser/commonProperties.test.ts
.../telemetry/test/electron-browser/commonProperties.test.ts
+11
-10
src/vs/workbench/electron-browser/main.ts
src/vs/workbench/electron-browser/main.ts
+2
-2
src/vs/workbench/electron-browser/shell.ts
src/vs/workbench/electron-browser/shell.ts
+10
-11
src/vs/workbench/parts/codeEditor/electron-browser/workbenchReferenceSearch.ts
...s/codeEditor/electron-browser/workbenchReferenceSearch.ts
+4
-4
未找到文件。
src/vs/editor/browser/config/configuration.ts
浏览文件 @
b77b9af3
...
...
@@ -13,7 +13,7 @@ import { FontInfo, BareFontInfo } from 'vs/editor/common/config/fontInfo';
import
{
ElementSizeObserver
}
from
'
vs/editor/browser/config/elementSizeObserver
'
;
import
{
FastDomNode
}
from
'
vs/base/browser/fastDomNode
'
;
import
{
CharWidthRequest
,
CharWidthRequestType
,
readCharWidths
}
from
'
vs/editor/browser/config/charWidthReader
'
;
import
{
I
StorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
IEditorOptions
}
from
'
vs/editor/common/config/editorOptions
'
;
class
CSSBasedConfigurationCache
{
...
...
@@ -57,8 +57,8 @@ export function readFontInfo(bareFontInfo: BareFontInfo): FontInfo {
return
CSSBasedConfiguration
.
INSTANCE
.
readConfiguration
(
bareFontInfo
);
}
export
function
restoreFontInfo
(
storageService
:
IStorage
Service
):
void
{
let
strStoredFontInfo
=
storage
Service
.
get
(
'
editorFontInfo
'
,
StorageScope
.
GLOBAL
);
export
function
restoreFontInfo
(
nextStorage2Service
:
INextStorage2
Service
):
void
{
let
strStoredFontInfo
=
nextStorage2
Service
.
get
(
'
editorFontInfo
'
,
StorageScope
.
GLOBAL
);
if
(
typeof
strStoredFontInfo
!==
'
string
'
)
{
return
;
}
...
...
@@ -74,9 +74,9 @@ export function restoreFontInfo(storageService: IStorageService): void {
CSSBasedConfiguration
.
INSTANCE
.
restoreFontInfo
(
storedFontInfo
);
}
export
function
saveFontInfo
(
storageService
:
IStorage
Service
):
void
{
export
function
saveFontInfo
(
nextStorage2Service
:
INextStorage2
Service
):
void
{
let
knownFontInfo
=
CSSBasedConfiguration
.
INSTANCE
.
saveFontInfo
();
storageService
.
store
(
'
editorFontInfo
'
,
JSON
.
stringify
(
knownFontInfo
),
StorageScope
.
GLOBAL
);
nextStorage2Service
.
set
(
'
editorFontInfo
'
,
JSON
.
stringify
(
knownFontInfo
),
StorageScope
.
GLOBAL
);
}
export
interface
ISerializedFontInfo
{
...
...
src/vs/editor/contrib/find/findController.ts
浏览文件 @
b77b9af3
...
...
@@ -14,7 +14,7 @@ import { FIND_IDS, FindModelBoundToEditorModel, ToggleCaseSensitiveKeybinding, T
import
{
FindReplaceState
,
FindReplaceStateChangedEvent
,
INewFindReplaceState
}
from
'
vs/editor/contrib/find/findState
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
import
{
EditorContextKeys
}
from
'
vs/editor/common/editorContextKeys
'
;
import
{
I
StorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybinding
'
;
...
...
@@ -72,7 +72,7 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
protected
_state
:
FindReplaceState
;
protected
_updateHistoryDelayer
:
Delayer
<
void
>
;
private
_model
:
FindModelBoundToEditorModel
;
pr
otected
_storageService
:
IStorage
Service
;
pr
ivate
_nextStorage2Service
:
INextStorage2
Service
;
private
_clipboardService
:
IClipboardService
;
protected
readonly
_contextKeyService
:
IContextKeyService
;
...
...
@@ -83,14 +83,14 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
constructor
(
editor
:
ICodeEditor
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
I
StorageService
storageService
:
IStorage
Service
,
@
I
NextStorage2Service
nextStorage2Service
:
INextStorage2
Service
,
@
IClipboardService
clipboardService
:
IClipboardService
)
{
super
();
this
.
_editor
=
editor
;
this
.
_findWidgetVisible
=
CONTEXT_FIND_WIDGET_VISIBLE
.
bindTo
(
contextKeyService
);
this
.
_contextKeyService
=
contextKeyService
;
this
.
_
storageService
=
storage
Service
;
this
.
_
nextStorage2Service
=
nextStorage2
Service
;
this
.
_clipboardService
=
clipboardService
;
this
.
_updateHistoryDelayer
=
new
Delayer
<
void
>
(
500
);
...
...
@@ -107,9 +107,9 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
this
.
_state
.
change
({
searchScope
:
null
,
matchCase
:
this
.
_
storage
Service
.
getBoolean
(
'
editor.matchCase
'
,
StorageScope
.
WORKSPACE
,
false
),
wholeWord
:
this
.
_
storage
Service
.
getBoolean
(
'
editor.wholeWord
'
,
StorageScope
.
WORKSPACE
,
false
),
isRegex
:
this
.
_
storage
Service
.
getBoolean
(
'
editor.isRegex
'
,
StorageScope
.
WORKSPACE
,
false
)
matchCase
:
this
.
_
nextStorage2
Service
.
getBoolean
(
'
editor.matchCase
'
,
StorageScope
.
WORKSPACE
,
false
),
wholeWord
:
this
.
_
nextStorage2
Service
.
getBoolean
(
'
editor.wholeWord
'
,
StorageScope
.
WORKSPACE
,
false
),
isRegex
:
this
.
_
nextStorage2
Service
.
getBoolean
(
'
editor.isRegex
'
,
StorageScope
.
WORKSPACE
,
false
)
},
false
);
if
(
shouldRestartFind
)
{
...
...
@@ -159,21 +159,21 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
private
saveQueryState
(
e
:
FindReplaceStateChangedEvent
)
{
if
(
e
.
isRegex
)
{
this
.
_
storageService
.
store
(
'
editor.isRegex
'
,
this
.
_state
.
actualIsRegex
,
StorageScope
.
WORKSPACE
);
this
.
_
nextStorage2Service
.
set
(
'
editor.isRegex
'
,
this
.
_state
.
actualIsRegex
,
StorageScope
.
WORKSPACE
);
}
if
(
e
.
wholeWord
)
{
this
.
_
storageService
.
store
(
'
editor.wholeWord
'
,
this
.
_state
.
actualWholeWord
,
StorageScope
.
WORKSPACE
);
this
.
_
nextStorage2Service
.
set
(
'
editor.wholeWord
'
,
this
.
_state
.
actualWholeWord
,
StorageScope
.
WORKSPACE
);
}
if
(
e
.
matchCase
)
{
this
.
_
storageService
.
store
(
'
editor.matchCase
'
,
this
.
_state
.
actualMatchCase
,
StorageScope
.
WORKSPACE
);
this
.
_
nextStorage2Service
.
set
(
'
editor.matchCase
'
,
this
.
_state
.
actualMatchCase
,
StorageScope
.
WORKSPACE
);
}
}
private
loadQueryState
()
{
this
.
_state
.
change
({
matchCase
:
this
.
_
storage
Service
.
getBoolean
(
'
editor.matchCase
'
,
StorageScope
.
WORKSPACE
,
this
.
_state
.
matchCase
),
wholeWord
:
this
.
_
storage
Service
.
getBoolean
(
'
editor.wholeWord
'
,
StorageScope
.
WORKSPACE
,
this
.
_state
.
wholeWord
),
isRegex
:
this
.
_
storage
Service
.
getBoolean
(
'
editor.isRegex
'
,
StorageScope
.
WORKSPACE
,
this
.
_state
.
isRegex
)
matchCase
:
this
.
_
nextStorage2
Service
.
getBoolean
(
'
editor.matchCase
'
,
StorageScope
.
WORKSPACE
,
this
.
_state
.
matchCase
),
wholeWord
:
this
.
_
nextStorage2
Service
.
getBoolean
(
'
editor.wholeWord
'
,
StorageScope
.
WORKSPACE
,
this
.
_state
.
wholeWord
),
isRegex
:
this
.
_
nextStorage2
Service
.
getBoolean
(
'
editor.isRegex
'
,
StorageScope
.
WORKSPACE
,
this
.
_state
.
isRegex
)
},
false
);
}
...
...
@@ -366,10 +366,10 @@ export class FindController extends CommonFindController implements IFindControl
@
IContextKeyService
_contextKeyService
:
IContextKeyService
,
@
IKeybindingService
private
readonly
_keybindingService
:
IKeybindingService
,
@
IThemeService
private
readonly
_themeService
:
IThemeService
,
@
I
StorageService
storageService
:
IStorage
Service
,
@
I
NextStorage2Service
nextStorage2Service
:
INextStorage2
Service
,
@
optional
(
IClipboardService
)
clipboardService
:
IClipboardService
)
{
super
(
editor
,
_contextKeyService
,
storage
Service
,
clipboardService
);
super
(
editor
,
_contextKeyService
,
nextStorage2
Service
,
clipboardService
);
}
protected
_start
(
opts
:
IFindStartOptions
):
void
{
...
...
src/vs/editor/contrib/find/test/findController.test.ts
浏览文件 @
b77b9af3
...
...
@@ -14,7 +14,8 @@ import { CONTEXT_FIND_INPUT_FOCUSED } from 'vs/editor/contrib/find/findModel';
import
{
withTestCodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
IContextKeyService
,
IContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
INextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
Delayer
}
from
'
vs/base/common/async
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
...
...
@@ -30,10 +31,10 @@ export class TestFindController extends CommonFindController {
constructor
(
editor
:
ICodeEditor
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
I
StorageService
storageService
:
IStorage
Service
,
@
I
NextStorage2Service
nextStorage2Service
:
INextStorage2
Service
,
@
IClipboardService
clipboardService
:
IClipboardService
)
{
super
(
editor
,
contextKeyService
,
storage
Service
,
clipboardService
);
super
(
editor
,
contextKeyService
,
nextStorage2
Service
,
clipboardService
);
this
.
_findInputFocused
=
CONTEXT_FIND_INPUT_FOCUSED
.
bindTo
(
contextKeyService
);
this
.
_updateHistoryDelayer
=
new
Delayer
<
void
>
(
50
);
}
...
...
@@ -58,11 +59,16 @@ suite('FindController', () => {
let
queryState
:
{
[
key
:
string
]:
any
;
}
=
{};
let
clipboardState
=
''
;
let
serviceCollection
=
new
ServiceCollection
();
serviceCollection
.
set
(
IStorageService
,
{
serviceCollection
.
set
(
INextStorage2Service
,
{
_serviceBrand
:
undefined
,
onDidChangeStorage
:
Event
.
None
,
onWillClose
:
Event
.
None
,
get
:
(
key
:
string
)
=>
queryState
[
key
],
getBoolean
:
(
key
:
string
)
=>
!!
queryState
[
key
],
store
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
}
}
as
IStorageService
);
getInteger
:
(
key
:
string
)
=>
undefined
,
set
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
return
Promise
.
resolve
();
},
delete
:
(
key
)
=>
void
0
}
as
INextStorage2Service
);
if
(
platform
.
isMacintosh
)
{
serviceCollection
.
set
(
IClipboardService
,
<
any
>
{
...
...
@@ -428,11 +434,16 @@ suite('FindController query options persistence', () => {
queryState
[
'
editor.matchCase
'
]
=
false
;
queryState
[
'
editor.wholeWord
'
]
=
false
;
let
serviceCollection
=
new
ServiceCollection
();
serviceCollection
.
set
(
IStorageService
,
{
serviceCollection
.
set
(
INextStorage2Service
,
{
_serviceBrand
:
undefined
,
onDidChangeStorage
:
Event
.
None
,
onWillClose
:
Event
.
None
,
get
:
(
key
:
string
)
=>
queryState
[
key
],
getBoolean
:
(
key
:
string
)
=>
!!
queryState
[
key
],
store
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
}
}
as
IStorageService
);
getInteger
:
(
key
:
string
)
=>
undefined
,
set
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
return
Promise
.
resolve
();
},
delete
:
(
key
)
=>
void
0
}
as
INextStorage2Service
);
test
(
'
matchCase
'
,
()
=>
{
withTestCodeEditor
([
...
...
src/vs/editor/contrib/multicursor/test/multicursor.test.ts
浏览文件 @
b77b9af3
...
...
@@ -9,7 +9,8 @@ import { Range } from 'vs/editor/common/core/range';
import
{
InsertCursorAbove
,
InsertCursorBelow
,
MultiCursorSelectionController
,
SelectHighlightsAction
,
AddSelectionToNextFindMatchAction
}
from
'
vs/editor/contrib/multicursor/multicursor
'
;
import
{
Handler
}
from
'
vs/editor/common/editorCommon
'
;
import
{
EndOfLineSequence
}
from
'
vs/editor/common/model
'
;
import
{
IStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
INextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
Event
}
from
'
vs/base/common/event
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
CommonFindController
}
from
'
vs/editor/contrib/find/findController
'
;
...
...
@@ -58,11 +59,16 @@ function fromRange(rng: Range): number[] {
suite
(
'
Multicursor selection
'
,
()
=>
{
let
queryState
:
{
[
key
:
string
]:
any
;
}
=
{};
let
serviceCollection
=
new
ServiceCollection
();
serviceCollection
.
set
(
IStorageService
,
{
serviceCollection
.
set
(
INextStorage2Service
,
{
_serviceBrand
:
undefined
,
onDidChangeStorage
:
Event
.
None
,
onWillClose
:
Event
.
None
,
get
:
(
key
:
string
)
=>
queryState
[
key
],
getBoolean
:
(
key
:
string
)
=>
!!
queryState
[
key
],
store
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
}
}
as
IStorageService
);
getInteger
:
(
key
:
string
)
=>
undefined
,
set
:
(
key
:
string
,
value
:
any
)
=>
{
queryState
[
key
]
=
value
;
return
Promise
.
resolve
();
},
delete
:
(
key
)
=>
void
0
}
as
INextStorage2Service
);
test
(
'
issue #8817: Cursor position changes when you cancel multicursor
'
,
()
=>
{
withTestCodeEditor
([
...
...
src/vs/editor/contrib/parameterHints/test/parameterHintsModel.test.ts
浏览文件 @
b77b9af3
...
...
@@ -14,7 +14,7 @@ import { TextModel } from 'vs/editor/common/model/textModel';
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
createTestCodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
I
StorageService
,
NullStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
,
NullNextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
NullTelemetryService
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
ParameterHintsModel
}
from
'
../parameterHintsWidget
'
;
...
...
@@ -44,7 +44,7 @@ suite('ParameterHintsModel', () => {
model
:
textModel
,
serviceCollection
:
new
ServiceCollection
(
[
ITelemetryService
,
NullTelemetryService
],
[
I
StorageService
,
NullStorage
Service
]
[
I
NextStorage2Service
,
NullNextStorage2
Service
]
)
});
disposables
.
push
(
textModel
);
...
...
src/vs/editor/contrib/referenceSearch/referencesController.ts
浏览文件 @
b77b9af3
...
...
@@ -10,7 +10,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IContextKey
,
IContextKeyService
,
RawContextKey
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
I
StorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ReferencesModel
}
from
'
./referencesModel
'
;
...
...
@@ -52,7 +52,7 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
@
ICodeEditorService
private
readonly
_editorService
:
ICodeEditorService
,
@
INotificationService
private
readonly
_notificationService
:
INotificationService
,
@
IInstantiationService
private
readonly
_instantiationService
:
IInstantiationService
,
@
I
StorageService
private
readonly
_storageService
:
IStorage
Service
,
@
I
NextStorage2Service
private
readonly
_nextStorage2Service
:
INextStorage2
Service
,
@
IConfigurationService
private
readonly
_configurationService
:
IConfigurationService
,
)
{
this
.
_editor
=
editor
;
...
...
@@ -95,14 +95,14 @@ export abstract class ReferencesController implements editorCommon.IEditorContri
}
}));
const
storageKey
=
'
peekViewLayout
'
;
const
data
=
<
LayoutData
>
JSON
.
parse
(
this
.
_
storageService
.
get
(
storageKey
,
undefined
,
'
{}
'
));
const
data
=
<
LayoutData
>
JSON
.
parse
(
this
.
_
nextStorage2Service
.
get
(
storageKey
,
StorageScope
.
GLOBAL
,
'
{}
'
));
this
.
_widget
=
this
.
_instantiationService
.
createInstance
(
ReferenceWidget
,
this
.
_editor
,
this
.
_defaultTreeKeyboardSupport
,
data
);
this
.
_widget
.
setTitle
(
nls
.
localize
(
'
labelLoading
'
,
"
Loading...
"
));
this
.
_widget
.
show
(
range
);
this
.
_disposables
.
push
(
this
.
_widget
.
onDidClose
(()
=>
{
modelPromise
.
cancel
();
this
.
_
storageService
.
store
(
storageKey
,
JSON
.
stringify
(
this
.
_widget
.
layoutData
)
);
this
.
_
nextStorage2Service
.
set
(
storageKey
,
JSON
.
stringify
(
this
.
_widget
.
layoutData
),
StorageScope
.
GLOBAL
);
this
.
_widget
=
null
;
this
.
closeWidget
();
}));
...
...
src/vs/editor/contrib/suggest/suggestMemory.ts
浏览文件 @
b77b9af3
...
...
@@ -5,7 +5,7 @@
import
{
ICompletionItem
}
from
'
vs/editor/contrib/suggest/completionModel
'
;
import
{
LRUCache
,
TernarySearchTree
}
from
'
vs/base/common/map
'
;
import
{
I
StorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
ITextModel
}
from
'
vs/editor/common/model
'
;
import
{
IPosition
}
from
'
vs/editor/common/core/position
'
;
import
{
RunOnceScheduler
}
from
'
vs/base/common/async
'
;
...
...
@@ -205,7 +205,7 @@ export class SuggestMemories {
constructor
(
editor
:
ICodeEditor
,
@
I
StorageService
private
readonly
_storageService
:
IStorage
Service
,
@
I
NextStorage2Service
private
readonly
_nextStorage2Service
:
INextStorage2
Service
,
)
{
this
.
_persistSoon
=
new
RunOnceScheduler
(()
=>
this
.
_flush
(),
3000
);
this
.
_setMode
(
editor
.
getConfiguration
().
contribInfo
.
suggestSelection
);
...
...
@@ -224,7 +224,7 @@ export class SuggestMemories {
this
.
_strategy
=
mode
===
'
recentlyUsedByPrefix
'
?
new
PrefixMemory
()
:
mode
===
'
recentlyUsed
'
?
new
LRUMemory
()
:
new
NoMemory
();
try
{
const
raw
=
this
.
_
storage
Service
.
get
(
`
${
this
.
_storagePrefix
}
/
${
this
.
_mode
}
`
,
StorageScope
.
WORKSPACE
);
const
raw
=
this
.
_
nextStorage2
Service
.
get
(
`
${
this
.
_storagePrefix
}
/
${
this
.
_mode
}
`
,
StorageScope
.
WORKSPACE
);
if
(
raw
)
{
this
.
_strategy
.
fromJSON
(
JSON
.
parse
(
raw
));
}
...
...
@@ -244,6 +244,6 @@ export class SuggestMemories {
private
_flush
()
{
const
raw
=
JSON
.
stringify
(
this
.
_strategy
);
this
.
_
storageService
.
store
(
`
${
this
.
_storagePrefix
}
/
${
this
.
_mode
}
`
,
raw
,
StorageScope
.
WORKSPACE
);
this
.
_
nextStorage2Service
.
set
(
`
${
this
.
_storagePrefix
}
/
${
this
.
_mode
}
`
,
raw
,
StorageScope
.
WORKSPACE
);
}
}
src/vs/editor/contrib/suggest/suggestWidget.ts
浏览文件 @
b77b9af3
...
...
@@ -26,7 +26,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import
{
attachListStyler
}
from
'
vs/platform/theme/common/styler
'
;
import
{
IThemeService
,
ITheme
,
registerThemingParticipant
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
registerColor
,
editorWidgetBackground
,
listFocusBackground
,
activeContrastBorder
,
listHighlightForeground
,
editorForeground
,
editorWidgetBorder
,
focusBorder
,
textLinkForeground
,
textCodeBlockBackground
}
from
'
vs/platform/theme/common/colorRegistry
'
;
import
{
I
StorageService
,
StorageScope
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
MarkdownRenderer
}
from
'
vs/editor/contrib/markdown/markdownRenderer
'
;
import
{
IModeService
}
from
'
vs/editor/common/services/modeService
'
;
import
{
IOpenerService
}
from
'
vs/platform/opener/common/opener
'
;
...
...
@@ -397,13 +397,10 @@ export class SuggestWidget implements IContentWidget, IVirtualDelegate<ICompleti
private
readonly
maxWidgetWidth
=
660
;
private
readonly
listWidth
=
330
;
private
storageService
:
IStorage
Service
;
private
nextStorage2Service
:
INextStorage2
Service
;
private
detailsFocusBorderColor
:
string
;
private
detailsBorderColor
:
string
;
private
storageServiceAvailable
:
boolean
=
true
;
private
expandSuggestionDocs
:
boolean
=
false
;
private
firstFocusInCurrentList
:
boolean
=
false
;
constructor
(
...
...
@@ -411,7 +408,7 @@ export class SuggestWidget implements IContentWidget, IVirtualDelegate<ICompleti
@
ITelemetryService
private
telemetryService
:
ITelemetryService
,
@
IContextKeyService
contextKeyService
:
IContextKeyService
,
@
IThemeService
themeService
:
IThemeService
,
@
I
StorageService
storageService
:
IStorage
Service
,
@
I
NextStorage2Service
nextStorage2Service
:
INextStorage2
Service
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IModeService
modeService
:
IModeService
,
@
IOpenerService
openerService
:
IOpenerService
...
...
@@ -422,14 +419,7 @@ export class SuggestWidget implements IContentWidget, IVirtualDelegate<ICompleti
this
.
isAuto
=
false
;
this
.
focusedItem
=
null
;
this
.
storageService
=
storageService
;
if
(
this
.
expandDocsSettingFromStorage
()
===
undefined
)
{
this
.
storageService
.
store
(
'
expandSuggestionDocs
'
,
expandSuggestionDocsByDefault
,
StorageScope
.
GLOBAL
);
if
(
this
.
expandDocsSettingFromStorage
()
===
undefined
)
{
this
.
storageServiceAvailable
=
false
;
}
}
this
.
nextStorage2Service
=
nextStorage2Service
;
this
.
element
=
$
(
'
.editor-widget.suggest-widget
'
);
if
(
!
this
.
editor
.
getConfiguration
().
contribInfo
.
iconsInSuggestions
)
{
...
...
@@ -1053,22 +1043,12 @@ export class SuggestWidget implements IContentWidget, IVirtualDelegate<ICompleti
return
'
suggestion
'
;
}
// Monaco Editor does not have a storage service
private
expandDocsSettingFromStorage
():
boolean
{
if
(
this
.
storageServiceAvailable
)
{
return
this
.
storageService
.
getBoolean
(
'
expandSuggestionDocs
'
,
StorageScope
.
GLOBAL
);
}
else
{
return
this
.
expandSuggestionDocs
;
}
return
this
.
nextStorage2Service
.
getBoolean
(
'
expandSuggestionDocs
'
,
StorageScope
.
GLOBAL
,
expandSuggestionDocsByDefault
);
}
// Monaco Editor does not have a storage service
private
updateExpandDocsSetting
(
value
:
boolean
)
{
if
(
this
.
storageServiceAvailable
)
{
this
.
storageService
.
store
(
'
expandSuggestionDocs
'
,
value
,
StorageScope
.
GLOBAL
);
}
else
{
this
.
expandSuggestionDocs
=
value
;
}
this
.
nextStorage2Service
.
set
(
'
expandSuggestionDocs
'
,
value
,
StorageScope
.
GLOBAL
);
}
dispose
():
void
{
...
...
src/vs/editor/contrib/suggest/test/suggestModel.test.ts
浏览文件 @
b77b9af3
...
...
@@ -23,7 +23,7 @@ import { ISelectedSuggestion } from 'vs/editor/contrib/suggest/suggestWidget';
import
{
TestCodeEditor
,
createTestCodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
MockMode
}
from
'
vs/editor/test/common/mocks/mockMode
'
;
import
{
ServiceCollection
}
from
'
vs/platform/instantiation/common/serviceCollection
'
;
import
{
I
StorageService
,
NullStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
,
NullNextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
NullTelemetryService
}
from
'
vs/platform/telemetry/common/telemetryUtils
'
;
import
{
IEditorWorkerService
}
from
'
vs/editor/common/services/editorWorkerService
'
;
...
...
@@ -42,7 +42,7 @@ function createMockEditor(model: TextModel): TestCodeEditor {
model
:
model
,
serviceCollection
:
new
ServiceCollection
(
[
ITelemetryService
,
NullTelemetryService
],
[
I
StorageService
,
NullStorage
Service
]
[
I
NextStorage2Service
,
NullNextStorage2
Service
]
),
});
editor
.
registerAndInstantiateContribution
(
SnippetController2
);
...
...
src/vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch.ts
浏览文件 @
b77b9af3
...
...
@@ -7,7 +7,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
I
StorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
...
...
@@ -21,7 +21,7 @@ export class StandaloneReferencesController extends ReferencesController {
@
ICodeEditorService
editorService
:
ICodeEditorService
,
@
INotificationService
notificationService
:
INotificationService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
I
StorageService
storageService
:
IStorage
Service
,
@
I
NextStorage2Service
nextStorage2Service
:
INextStorage2
Service
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
)
{
super
(
...
...
@@ -31,8 +31,8 @@ export class StandaloneReferencesController extends ReferencesController {
editorService
,
notificationService
,
instantiationService
,
storage
Service
,
configurationService
,
nextStorage2
Service
,
configurationService
);
}
}
...
...
src/vs/editor/standalone/browser/standaloneServices.ts
浏览文件 @
b77b9af3
...
...
@@ -17,6 +17,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import
{
MarkerService
}
from
'
vs/platform/markers/common/markerService
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
IProgressService
}
from
'
vs/platform/progress/common/progress
'
;
import
{
INextStorage2Service
,
NullNextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
IStorageService
,
NullStorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IWorkspaceContextService
}
from
'
vs/platform/workspace/common/workspace
'
;
...
...
@@ -144,6 +145,8 @@ export module StaticServices {
export
const
progressService
=
define
(
IProgressService
,
()
=>
new
SimpleProgressService
());
export
const
nextStorage2Service
=
define
(
INextStorage2Service
,
()
=>
NullNextStorage2Service
);
export
const
storageService
=
define
(
IStorageService
,
()
=>
NullStorageService
);
export
const
logService
=
define
(
ILogService
,
()
=>
new
NullLogService
());
...
...
src/vs/platform/storage2/electron-browser/nextStorage2Service.ts
浏览文件 @
b77b9af3
...
...
@@ -94,7 +94,7 @@ export class NextStorage2Service extends Disposable implements INextStorage2Serv
}
}
export
class
NextDelegatingStorageService
extends
Disposable
implements
INextStorage2Service
{
export
class
NextDelegatingStorage
2
Service
extends
Disposable
implements
INextStorage2Service
{
_serviceBrand
:
any
;
private
_onDidChangeStorage
:
Emitter
<
IWorkspaceStorageChangeEvent
>
=
this
.
_register
(
new
Emitter
<
IWorkspaceStorageChangeEvent
>
());
...
...
src/vs/platform/telemetry/node/workbenchCommonProperties.ts
浏览文件 @
b77b9af3
...
...
@@ -5,37 +5,42 @@
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
*
as
uuid
from
'
vs/base/common/uuid
'
;
import
{
I
StorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
resolveCommonProperties
}
from
'
..
/node/commonProperties
'
;
import
{
I
NextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
resolveCommonProperties
}
from
'
vs/platform/telemetry
/node/commonProperties
'
;
export
function
resolveWorkbenchCommonProperties
(
storageService
:
IStorage
Service
,
commit
:
string
,
version
:
string
,
machineId
:
string
,
installSourcePath
:
string
):
TPromise
<
{
[
name
:
string
]:
string
}
>
{
export
function
resolveWorkbenchCommonProperties
(
nextStorage2Service
:
INextStorage2
Service
,
commit
:
string
,
version
:
string
,
machineId
:
string
,
installSourcePath
:
string
):
TPromise
<
{
[
name
:
string
]:
string
}
>
{
return
resolveCommonProperties
(
commit
,
version
,
machineId
,
installSourcePath
).
then
(
result
=>
{
// __GDPR__COMMON__ "common.version.shell" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result
[
'
common.version.shell
'
]
=
process
.
versions
&&
(
<
any
>
process
).
versions
[
'
electron
'
];
// __GDPR__COMMON__ "common.version.renderer" : { "classification": "SystemMetaData", "purpose": "PerformanceAndHealth" }
result
[
'
common.version.renderer
'
]
=
process
.
versions
&&
(
<
any
>
process
).
versions
[
'
chrome
'
];
const
lastSessionDate
=
storageService
.
get
(
'
telemetry.lastSessionDate
'
);
const
firstSessionDate
=
storageService
.
get
(
'
telemetry.firstSessionDate
'
)
||
new
Date
().
toUTCString
();
storageService
.
store
(
'
telemetry.firstSessionDate
'
,
firstSessionDate
);
storageService
.
store
(
'
telemetry.lastSessionDate
'
,
new
Date
().
toUTCString
());
const
lastSessionDate
=
nextStorage2Service
.
get
(
'
telemetry.lastSessionDate
'
,
StorageScope
.
GLOBAL
);
nextStorage2Service
.
set
(
'
telemetry.lastSessionDate
'
,
new
Date
().
toUTCString
(),
StorageScope
.
GLOBAL
);
// __GDPR__COMMON__ "common.firstSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
common.firstSessionDate
'
]
=
firstSessionDate
;
result
[
'
common.firstSessionDate
'
]
=
getOrCreateFirstSessionDate
(
nextStorage2Service
)
;
// __GDPR__COMMON__ "common.lastSessionDate" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
common.lastSessionDate
'
]
=
lastSessionDate
;
// __GDPR__COMMON__ "common.isNewSession" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
common.isNewSession
'
]
=
!
lastSessionDate
?
'
1
'
:
'
0
'
;
// __GDPR__COMMON__ "common.instanceId" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
result
[
'
common.instanceId
'
]
=
getOrCreateInstanceId
(
storage
Service
);
result
[
'
common.instanceId
'
]
=
getOrCreateInstanceId
(
nextStorage2
Service
);
return
result
;
});
}
function
getOrCreateInstanceId
(
storageService
:
IStorage
Service
):
string
{
const
result
=
storageService
.
get
(
'
telemetry.instanceId
'
)
||
uuid
.
generateUuid
(
);
storageService
.
store
(
'
telemetry.instanceId
'
,
result
);
function
getOrCreateInstanceId
(
nextStorage2Service
:
INextStorage2
Service
):
string
{
const
result
=
nextStorage2Service
.
get
(
'
telemetry.instanceId
'
,
StorageScope
.
GLOBAL
,
uuid
.
generateUuid
()
);
nextStorage2Service
.
set
(
'
telemetry.instanceId
'
,
result
,
StorageScope
.
GLOBAL
);
return
result
;
}
function
getOrCreateFirstSessionDate
(
nextStorage2Service
:
INextStorage2Service
):
string
{
const
firstSessionDate
=
nextStorage2Service
.
get
(
'
telemetry.firstSessionDate
'
,
StorageScope
.
GLOBAL
,
new
Date
().
toUTCString
());
nextStorage2Service
.
set
(
'
telemetry.firstSessionDate
'
,
firstSessionDate
,
StorageScope
.
GLOBAL
);
return
firstSessionDate
;
}
\ No newline at end of file
src/vs/platform/telemetry/test/electron-browser/commonProperties.test.ts
浏览文件 @
b77b9af3
...
...
@@ -7,9 +7,10 @@ import * as path from 'path';
import
*
as
os
from
'
os
'
;
import
*
as
fs
from
'
fs
'
;
import
{
resolveWorkbenchCommonProperties
}
from
'
vs/platform/telemetry/node/workbenchCommonProperties
'
;
import
{
StorageService
,
InMemoryLocalStorage
}
from
'
vs/platform/storage/common/storageService
'
;
import
{
TestWorkspace
}
from
'
vs/platform/workspace/test/common/testWorkspace
'
;
import
{
getRandomTestPath
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
getRandomTestPath
,
TestEnvironmentService
}
from
'
vs/workbench/test/workbenchTestServices
'
;
import
{
INextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
NextStorage2Service
}
from
'
vs/platform/storage2/electron-browser/nextStorage2Service
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
del
}
from
'
vs/base/node/extfs
'
;
import
{
mkdirp
}
from
'
vs/base/node/pfs
'
;
import
{
timeout
}
from
'
vs/base/common/async
'
;
...
...
@@ -20,10 +21,10 @@ suite('Telemetry - common properties', function () {
const
commit
:
string
=
void
0
;
const
version
:
string
=
void
0
;
let
storageService
:
Storage
Service
;
let
nestStorage2Service
:
INextStorage2
Service
;
setup
(()
=>
{
storageService
=
new
StorageService
(
new
InMemoryLocalStorage
(),
null
,
TestWorkspace
.
id
);
nestStorage2Service
=
new
NextStorage2Service
(
'
:memory:
'
,
new
NullLogService
(),
TestEnvironmentService
);
});
teardown
(
done
=>
{
...
...
@@ -33,7 +34,7 @@ suite('Telemetry - common properties', function () {
test
(
'
default
'
,
async
function
()
{
await
mkdirp
(
parentDir
);
fs
.
writeFileSync
(
installSource
,
'
my.install.source
'
);
const
props
=
await
resolveWorkbenchCommonProperties
(
storage
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
const
props
=
await
resolveWorkbenchCommonProperties
(
nestStorage2
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
assert
.
ok
(
'
commitHash
'
in
props
);
assert
.
ok
(
'
sessionID
'
in
props
);
assert
.
ok
(
'
timestamp
'
in
props
);
...
...
@@ -54,22 +55,22 @@ suite('Telemetry - common properties', function () {
assert
.
ok
(
'
common.instanceId
'
in
props
,
'
instanceId
'
);
assert
.
ok
(
'
common.machineId
'
in
props
,
'
machineId
'
);
fs
.
unlinkSync
(
installSource
);
const
props_1
=
await
resolveWorkbenchCommonProperties
(
storage
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
const
props_1
=
await
resolveWorkbenchCommonProperties
(
nestStorage2
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
assert
.
ok
(
!
(
'
common.source
'
in
props_1
));
});
test
(
'
lastSessionDate when aviablale
'
,
async
function
()
{
storageService
.
store
(
'
telemetry.lastSessionDate
'
,
new
Date
().
toUTCString
()
);
nestStorage2Service
.
set
(
'
telemetry.lastSessionDate
'
,
new
Date
().
toUTCString
(),
StorageScope
.
GLOBAL
);
const
props
=
await
resolveWorkbenchCommonProperties
(
storage
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
const
props
=
await
resolveWorkbenchCommonProperties
(
nestStorage2
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
assert
.
ok
(
'
common.lastSessionDate
'
in
props
);
// conditional, see below
assert
.
ok
(
'
common.isNewSession
'
in
props
);
assert
.
equal
(
props
[
'
common.isNewSession
'
],
0
);
});
test
(
'
values chance on ask
'
,
async
function
()
{
const
props
=
await
resolveWorkbenchCommonProperties
(
storage
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
const
props
=
await
resolveWorkbenchCommonProperties
(
nestStorage2
Service
,
commit
,
version
,
'
someMachineId
'
,
installSource
);
let
value1
=
props
[
'
common.sequence
'
];
let
value2
=
props
[
'
common.sequence
'
];
assert
.
ok
(
value1
!==
value2
,
'
seq
'
);
...
...
src/vs/workbench/electron-browser/main.ts
浏览文件 @
b77b9af3
...
...
@@ -36,7 +36,7 @@ import { IWorkspacesService, ISingleFolderWorkspaceIdentifier } from 'vs/platfor
import
{
createSpdLogService
}
from
'
vs/platform/log/node/spdlogService
'
;
import
*
as
fs
from
'
fs
'
;
import
{
ConsoleLogService
,
MultiplexLogService
,
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
NextStorage2Service
,
NextDelegatingStorageService
}
from
'
vs/platform/storage2/electron-browser/nextStorage2Service
'
;
import
{
NextStorage2Service
,
NextDelegatingStorage
2
Service
}
from
'
vs/platform/storage2/electron-browser/nextStorage2Service
'
;
import
{
IssueChannelClient
}
from
'
vs/platform/issue/node/issueIpc
'
;
import
{
IIssueService
}
from
'
vs/platform/issue/common/issue
'
;
import
{
LogLevelSetterChannelClient
,
FollowerLogService
}
from
'
vs/platform/log/node/logIpc
'
;
...
...
@@ -104,7 +104,7 @@ function openWorkbench(configuration: IWindowConfiguration): Promise<void> {
]).
then
(
services
=>
{
const
workspaceService
=
services
[
0
];
const
storageService
=
createStorageService
(
workspaceService
,
environmentService
);
const
nextStorage2Service
=
new
NextDelegatingStorageService
(
services
[
1
],
storageService
,
logService
,
environmentService
);
const
nextStorage2Service
=
new
NextDelegatingStorage
2
Service
(
services
[
1
],
storageService
,
logService
,
environmentService
);
return
domContentLoaded
().
then
(()
=>
{
perf
.
mark
(
'
willStartWorkbench
'
);
...
...
src/vs/workbench/electron-browser/shell.ts
浏览文件 @
b77b9af3
...
...
@@ -75,7 +75,7 @@ import { IBroadcastService, BroadcastService } from 'vs/platform/broadcast/elect
import
{
HashService
}
from
'
vs/workbench/services/hash/node/hashService
'
;
import
{
IHashService
}
from
'
vs/workbench/services/hash/common/hashService
'
;
import
{
ILogService
}
from
'
vs/platform/log/common/log
'
;
import
{
INextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
INextStorage2Service
,
StorageScope
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
Event
,
Emitter
}
from
'
vs/base/common/event
'
;
import
{
WORKBENCH_BACKGROUND
}
from
'
vs/workbench/common/theme
'
;
import
{
stat
}
from
'
fs
'
;
...
...
@@ -170,8 +170,11 @@ export class WorkbenchShell extends Disposable {
const
[
instantiationService
,
serviceCollection
]
=
this
.
initServiceCollection
(
this
.
container
);
// Warm up font cache information before building up too many dom elements
restoreFontInfo
(
this
.
storage
Service
);
restoreFontInfo
(
this
.
nextStorage2
Service
);
readFontInfo
(
BareFontInfo
.
createFromRawSettings
(
this
.
configurationService
.
getValue
(
'
editor
'
),
browser
.
getZoomLevel
()));
this
.
_register
(
this
.
nextStorage2Service
.
onWillClose
(()
=>
{
saveFontInfo
(
this
.
nextStorage2Service
);
// Keep font info for next startup around
}));
// Workbench
this
.
workbench
=
this
.
createWorkbench
(
instantiationService
,
serviceCollection
,
this
.
container
);
...
...
@@ -286,17 +289,17 @@ export class WorkbenchShell extends Disposable {
}
perf
.
mark
(
'
willReadLocalStorage
'
);
const
readyToSend
=
this
.
storageService
.
getBoolean
(
'
localStorageMetricsReadyToSend2
'
);
const
readyToSend
=
this
.
nextStorage2Service
.
getBoolean
(
'
localStorageMetricsReadyToSend2
'
,
StorageScope
.
GLOBAL
);
perf
.
mark
(
'
didReadLocalStorage
'
);
if
(
!
readyToSend
)
{
this
.
storageService
.
store
(
'
localStorageMetricsReadyToSend2
'
,
true
);
this
.
nextStorage2Service
.
set
(
'
localStorageMetricsReadyToSend2
'
,
true
,
StorageScope
.
GLOBAL
);
return
;
// avoid logging localStorage metrics directly after the update, we prefer cold startup numbers
}
if
(
!
this
.
storageService
.
getBoolean
(
'
localStorageMetricsSent2
'
))
{
if
(
!
this
.
nextStorage2Service
.
getBoolean
(
'
localStorageMetricsSent2
'
,
StorageScope
.
GLOBAL
))
{
perf
.
mark
(
'
willWriteLocalStorage
'
);
this
.
storageService
.
store
(
'
localStorageMetricsSent2
'
,
true
);
this
.
nextStorage2Service
.
set
(
'
localStorageMetricsSent2
'
,
true
,
StorageScope
.
GLOBAL
);
perf
.
mark
(
'
didWriteLocalStorage
'
);
perf
.
mark
(
'
willStatLocalStorage
'
);
...
...
@@ -366,7 +369,7 @@ export class WorkbenchShell extends Disposable {
const
channel
=
getDelayedChannel
<
ITelemetryAppenderChannel
>
(
sharedProcess
.
then
(
c
=>
c
.
getChannel
(
'
telemetryAppender
'
)));
const
config
:
ITelemetryServiceConfig
=
{
appender
:
combinedAppender
(
new
TelemetryAppenderClient
(
channel
),
new
LogAppender
(
this
.
logService
)),
commonProperties
:
resolveWorkbenchCommonProperties
(
this
.
storage
Service
,
product
.
commit
,
pkg
.
version
,
this
.
configuration
.
machineId
,
this
.
environmentService
.
installSourcePath
),
commonProperties
:
resolveWorkbenchCommonProperties
(
this
.
nextStorage2
Service
,
product
.
commit
,
pkg
.
version
,
this
.
configuration
.
machineId
,
this
.
environmentService
.
installSourcePath
),
piiPaths
:
[
this
.
environmentService
.
appRoot
,
this
.
environmentService
.
extensionsPath
]
};
...
...
@@ -517,9 +520,6 @@ export class WorkbenchShell extends Disposable {
dispose
(
reason
=
ShutdownReason
.
QUIT
):
void
{
super
.
dispose
();
// Keep font info for next startup around
saveFontInfo
(
this
.
storageService
);
// Dispose Workbench
if
(
this
.
workbench
)
{
this
.
workbench
.
dispose
(
reason
);
...
...
@@ -529,7 +529,6 @@ export class WorkbenchShell extends Disposable {
}
}
registerThemingParticipant
((
theme
:
ITheme
,
collector
:
ICssStyleCollector
)
=>
{
// Foreground
...
...
src/vs/workbench/parts/codeEditor/electron-browser/workbenchReferenceSearch.ts
浏览文件 @
b77b9af3
...
...
@@ -6,7 +6,7 @@
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IContextKeyService
}
from
'
vs/platform/contextkey/common/contextkey
'
;
import
{
IConfigurationService
}
from
'
vs/platform/configuration/common/configuration
'
;
import
{
I
StorageService
}
from
'
vs/platform/storage/common/storage
'
;
import
{
I
NextStorage2Service
}
from
'
vs/platform/storage2/common/storage2
'
;
import
{
ICodeEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
registerEditorContribution
}
from
'
vs/editor/browser/editorExtensions
'
;
import
{
INotificationService
}
from
'
vs/platform/notification/common/notification
'
;
...
...
@@ -21,7 +21,7 @@ export class WorkbenchReferencesController extends ReferencesController {
@
ICodeEditorService
editorService
:
ICodeEditorService
,
@
INotificationService
notificationService
:
INotificationService
,
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
I
StorageService
storageService
:
IStorage
Service
,
@
I
NextStorage2Service
nextStorage2Service
:
INextStorage2
Service
,
@
IConfigurationService
configurationService
:
IConfigurationService
,
)
{
super
(
...
...
@@ -31,8 +31,8 @@ export class WorkbenchReferencesController extends ReferencesController {
editorService
,
notificationService
,
instantiationService
,
storage
Service
,
configurationService
,
nextStorage2
Service
,
configurationService
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录