Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
757006f4
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,发现更多精彩内容 >>
未验证
提交
757006f4
编写于
2月 20, 2020
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Pass the IUndoRedoService to the TextModel
上级
57b0cd28
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
35 addition
and
12 deletion
+35
-12
src/vs/editor/common/model/textModel.ts
src/vs/editor/common/model/textModel.ts
+10
-2
src/vs/editor/common/services/modelServiceImpl.ts
src/vs/editor/common/services/modelServiceImpl.ts
+6
-2
src/vs/editor/contrib/find/test/findModel.test.ts
src/vs/editor/contrib/find/test/findModel.test.ts
+2
-1
src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts
src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts
+2
-1
src/vs/editor/standalone/browser/standaloneServices.ts
src/vs/editor/standalone/browser/standaloneServices.ts
+5
-1
src/vs/editor/test/common/services/modelService.test.ts
src/vs/editor/test/common/services/modelService.test.ts
+2
-1
src/vs/workbench/test/browser/api/mainThreadDocumentsAndEditors.test.ts
...ch/test/browser/api/mainThreadDocumentsAndEditors.test.ts
+2
-1
src/vs/workbench/test/browser/api/mainThreadEditors.test.ts
src/vs/workbench/test/browser/api/mainThreadEditors.test.ts
+2
-1
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
...h/test/electron-browser/quickopen.perf.integrationTest.ts
+2
-1
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
.../test/electron-browser/textsearch.perf.integrationTest.ts
+2
-1
未找到文件。
src/vs/editor/common/model/textModel.ts
浏览文件 @
757006f4
...
...
@@ -36,6 +36,8 @@ import { TokensStore, MultilineTokens, countEOL, MultilineTokens2, TokensStore2
import
{
Color
}
from
'
vs/base/common/color
'
;
import
{
Constants
}
from
'
vs/base/common/uint
'
;
import
{
EditorTheme
}
from
'
vs/editor/common/view/viewContext
'
;
import
{
IUndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedo
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
function
createTextBufferBuilder
()
{
return
new
PieceTreeTextBufferBuilder
();
...
...
@@ -188,7 +190,7 @@ export class TextModel extends Disposable implements model.ITextModel {
};
public
static
createFromString
(
text
:
string
,
options
:
model
.
ITextModelCreationOptions
=
TextModel
.
DEFAULT_CREATION_OPTIONS
,
languageIdentifier
:
LanguageIdentifier
|
null
=
null
,
uri
:
URI
|
null
=
null
):
TextModel
{
return
new
TextModel
(
text
,
options
,
languageIdentifier
,
uri
);
return
new
TextModel
(
text
,
options
,
languageIdentifier
,
uri
,
new
UndoRedoService
()
);
}
public
static
resolveOptions
(
textBuffer
:
model
.
ITextBuffer
,
options
:
model
.
ITextModelCreationOptions
):
model
.
TextModelResolvedOptions
{
...
...
@@ -293,7 +295,13 @@ export class TextModel extends Disposable implements model.ITextModel {
private
readonly
_tokenization
:
TextModelTokenization
;
//#endregion
constructor
(
source
:
string
|
model
.
ITextBufferFactory
,
creationOptions
:
model
.
ITextModelCreationOptions
,
languageIdentifier
:
LanguageIdentifier
|
null
,
associatedResource
:
URI
|
null
=
null
)
{
constructor
(
source
:
string
|
model
.
ITextBufferFactory
,
creationOptions
:
model
.
ITextModelCreationOptions
,
languageIdentifier
:
LanguageIdentifier
|
null
,
associatedResource
:
URI
|
null
=
null
,
undoRedoService
:
IUndoRedoService
)
{
super
();
// Generate a new unique model id
...
...
src/vs/editor/common/services/modelServiceImpl.ts
浏览文件 @
757006f4
...
...
@@ -25,6 +25,7 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
import
{
SparseEncodedTokens
,
MultilineTokens2
}
from
'
vs/editor/common/model/tokensStore
'
;
import
{
IThemeService
}
from
'
vs/platform/theme/common/themeService
'
;
import
{
ILogService
,
LogLevel
}
from
'
vs/platform/log/common/log
'
;
import
{
IUndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedo
'
;
export
interface
IEditorSemanticHighlightingOptions
{
enabled
?:
boolean
;
...
...
@@ -103,6 +104,7 @@ export class ModelServiceImpl extends Disposable implements IModelService {
private
readonly
_configurationService
:
IConfigurationService
;
private
readonly
_configurationServiceSubscription
:
IDisposable
;
private
readonly
_resourcePropertiesService
:
ITextResourcePropertiesService
;
private
readonly
_undoRedoService
:
IUndoRedoService
;
private
readonly
_onModelAdded
:
Emitter
<
ITextModel
>
=
this
.
_register
(
new
Emitter
<
ITextModel
>
());
public
readonly
onModelAdded
:
Event
<
ITextModel
>
=
this
.
_onModelAdded
.
event
;
...
...
@@ -126,11 +128,13 @@ export class ModelServiceImpl extends Disposable implements IModelService {
@
IConfigurationService
configurationService
:
IConfigurationService
,
@
ITextResourcePropertiesService
resourcePropertiesService
:
ITextResourcePropertiesService
,
@
IThemeService
themeService
:
IThemeService
,
@
ILogService
logService
:
ILogService
@
ILogService
logService
:
ILogService
,
@
IUndoRedoService
undoRedoService
:
IUndoRedoService
)
{
super
();
this
.
_configurationService
=
configurationService
;
this
.
_resourcePropertiesService
=
resourcePropertiesService
;
this
.
_undoRedoService
=
undoRedoService
;
this
.
_models
=
{};
this
.
_modelCreationOptionsByLanguageAndResource
=
Object
.
create
(
null
);
...
...
@@ -272,7 +276,7 @@ export class ModelServiceImpl extends Disposable implements IModelService {
private
_createModelData
(
value
:
string
|
ITextBufferFactory
,
languageIdentifier
:
LanguageIdentifier
,
resource
:
URI
|
undefined
,
isForSimpleWidget
:
boolean
):
ModelData
{
// create & save the model
const
options
=
this
.
getCreationOptions
(
languageIdentifier
.
language
,
resource
,
isForSimpleWidget
);
const
model
:
TextModel
=
new
TextModel
(
value
,
options
,
languageIdentifier
,
resource
);
const
model
:
TextModel
=
new
TextModel
(
value
,
options
,
languageIdentifier
,
resource
,
this
.
_undoRedoService
);
const
modelId
=
MODEL_ID
(
model
.
uri
);
if
(
this
.
_models
[
modelId
])
{
...
...
src/vs/editor/contrib/find/test/findModel.test.ts
浏览文件 @
757006f4
...
...
@@ -15,6 +15,7 @@ import { TextModel } from 'vs/editor/common/model/textModel';
import
{
FindModelBoundToEditorModel
}
from
'
vs/editor/contrib/find/findModel
'
;
import
{
FindReplaceState
}
from
'
vs/editor/contrib/find/findState
'
;
import
{
withTestCodeEditor
}
from
'
vs/editor/test/browser/testCodeEditor
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
suite
(
'
FindModel
'
,
()
=>
{
...
...
@@ -44,7 +45,7 @@ suite('FindModel', () => {
const
factory
=
ptBuilder
.
finish
();
withTestCodeEditor
([],
{
model
:
new
TextModel
(
factory
,
TextModel
.
DEFAULT_CREATION_OPTIONS
,
null
,
null
)
model
:
new
TextModel
(
factory
,
TextModel
.
DEFAULT_CREATION_OPTIONS
,
null
,
null
,
new
UndoRedoService
()
)
},
(
editor
,
cursor
)
=>
callback
(
editor
as
unknown
as
IActiveCodeEditor
,
cursor
)
);
...
...
src/vs/editor/contrib/smartSelect/test/smartSelect.test.ts
浏览文件 @
757006f4
...
...
@@ -19,6 +19,7 @@ import { WordSelectionRangeProvider } from 'vs/editor/contrib/smartSelect/wordSe
import
{
TestTextResourcePropertiesService
}
from
'
vs/editor/test/common/services/modelService.test
'
;
import
{
TestThemeService
}
from
'
vs/platform/theme/test/common/testThemeService
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
class
MockJSMode
extends
MockMode
{
...
...
@@ -47,7 +48,7 @@ suite('SmartSelect', () => {
setup
(()
=>
{
const
configurationService
=
new
TestConfigurationService
();
modelService
=
new
ModelServiceImpl
(
configurationService
,
new
TestTextResourcePropertiesService
(
configurationService
),
new
TestThemeService
(),
new
NullLogService
());
modelService
=
new
ModelServiceImpl
(
configurationService
,
new
TestTextResourcePropertiesService
(
configurationService
),
new
TestThemeService
(),
new
NullLogService
()
,
new
UndoRedoService
()
);
mode
=
new
MockJSMode
();
});
...
...
src/vs/editor/standalone/browser/standaloneServices.ts
浏览文件 @
757006f4
...
...
@@ -50,6 +50,8 @@ import { getSingletonServiceDescriptors } from 'vs/platform/instantiation/common
import
{
AccessibilityService
}
from
'
vs/platform/accessibility/common/accessibilityService
'
;
import
{
IClipboardService
}
from
'
vs/platform/clipboard/common/clipboardService
'
;
import
{
BrowserClipboardService
}
from
'
vs/platform/clipboard/browser/clipboardService
'
;
import
{
IUndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedo
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
export
interface
IEditorOverrideServices
{
[
index
:
string
]:
any
;
...
...
@@ -150,7 +152,9 @@ export module StaticServices {
export
const
logService
=
define
(
ILogService
,
()
=>
new
NullLogService
());
export
const
modelService
=
define
(
IModelService
,
(
o
)
=>
new
ModelServiceImpl
(
configurationService
.
get
(
o
),
resourcePropertiesService
.
get
(
o
),
standaloneThemeService
.
get
(
o
),
logService
.
get
(
o
)));
export
const
undoRedoService
=
define
(
IUndoRedoService
,
()
=>
new
UndoRedoService
());
export
const
modelService
=
define
(
IModelService
,
(
o
)
=>
new
ModelServiceImpl
(
configurationService
.
get
(
o
),
resourcePropertiesService
.
get
(
o
),
standaloneThemeService
.
get
(
o
),
logService
.
get
(
o
),
undoRedoService
.
get
(
o
)));
export
const
markerDecorationsService
=
define
(
IMarkerDecorationsService
,
(
o
)
=>
new
MarkerDecorationsService
(
modelService
.
get
(
o
),
markerService
.
get
(
o
)));
...
...
src/vs/editor/test/common/services/modelService.test.ts
浏览文件 @
757006f4
...
...
@@ -18,6 +18,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import
{
TestConfigurationService
}
from
'
vs/platform/configuration/test/common/testConfigurationService
'
;
import
{
TestThemeService
}
from
'
vs/platform/theme/test/common/testThemeService
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
const
GENERATE_TESTS
=
false
;
...
...
@@ -29,7 +30,7 @@ suite('ModelService', () => {
configService
.
setUserConfiguration
(
'
files
'
,
{
'
eol
'
:
'
\n
'
});
configService
.
setUserConfiguration
(
'
files
'
,
{
'
eol
'
:
'
\r\n
'
},
URI
.
file
(
platform
.
isWindows
?
'
c:
\\
myroot
'
:
'
/myroot
'
));
modelService
=
new
ModelServiceImpl
(
configService
,
new
TestTextResourcePropertiesService
(
configService
),
new
TestThemeService
(),
new
NullLogService
());
modelService
=
new
ModelServiceImpl
(
configService
,
new
TestTextResourcePropertiesService
(
configService
),
new
TestThemeService
(),
new
NullLogService
()
,
new
UndoRedoService
()
);
});
teardown
(()
=>
{
...
...
src/vs/workbench/test/browser/api/mainThreadDocumentsAndEditors.test.ts
浏览文件 @
757006f4
...
...
@@ -22,6 +22,7 @@ import { IFileService } from 'vs/platform/files/common/files';
import
{
IPanelService
}
from
'
vs/workbench/services/panel/common/panelService
'
;
import
{
TestThemeService
}
from
'
vs/platform/theme/test/common/testThemeService
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
suite
(
'
MainThreadDocumentsAndEditors
'
,
()
=>
{
...
...
@@ -44,7 +45,7 @@ suite('MainThreadDocumentsAndEditors', () => {
deltas
.
length
=
0
;
const
configService
=
new
TestConfigurationService
();
configService
.
setUserConfiguration
(
'
editor
'
,
{
'
detectIndentation
'
:
false
});
modelService
=
new
ModelServiceImpl
(
configService
,
new
TestTextResourcePropertiesService
(
configService
),
new
TestThemeService
(),
new
NullLogService
());
modelService
=
new
ModelServiceImpl
(
configService
,
new
TestTextResourcePropertiesService
(
configService
),
new
TestThemeService
(),
new
NullLogService
()
,
new
UndoRedoService
()
);
codeEditorService
=
new
TestCodeEditorService
();
textFileService
=
new
class
extends
mock
<
ITextFileService
>
()
{
isDirty
()
{
return
false
;
}
...
...
src/vs/workbench/test/browser/api/mainThreadEditors.test.ts
浏览文件 @
757006f4
...
...
@@ -41,6 +41,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
import
{
IWorkbenchEnvironmentService
}
from
'
vs/workbench/services/environment/common/environmentService
'
;
import
{
ILabelService
}
from
'
vs/platform/label/common/label
'
;
import
{
IWorkingCopyFileService
}
from
'
vs/workbench/services/workingCopy/common/workingCopyFileService
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
suite
(
'
MainThreadEditors
'
,
()
=>
{
...
...
@@ -63,7 +64,7 @@ suite('MainThreadEditors', () => {
const
configService
=
new
TestConfigurationService
();
modelService
=
new
ModelServiceImpl
(
configService
,
new
TestTextResourcePropertiesService
(
configService
),
new
TestThemeService
(),
new
NullLogService
());
modelService
=
new
ModelServiceImpl
(
configService
,
new
TestTextResourcePropertiesService
(
configService
),
new
TestThemeService
(),
new
NullLogService
()
,
new
UndoRedoService
()
);
const
services
=
new
ServiceCollection
();
...
...
src/vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts
浏览文件 @
757006f4
...
...
@@ -33,6 +33,7 @@ import { TestEnvironmentService } from 'vs/workbench/test/electron-browser/workb
import
{
ClassifiedEvent
,
StrictPropertyCheck
,
GDPRClassification
}
from
'
vs/platform/telemetry/common/gdprTypings
'
;
import
{
TestThemeService
}
from
'
vs/platform/theme/test/common/testThemeService
'
;
import
{
NullLogService
}
from
'
vs/platform/log/common/log
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
namespace
Timer
{
export
interface
ITimerEvent
{
...
...
@@ -76,7 +77,7 @@ suite.skip('QuickOpen performance (integration)', () => {
[
ITelemetryService
,
telemetryService
],
[
IConfigurationService
,
configurationService
],
[
ITextResourcePropertiesService
,
textResourcePropertiesService
],
[
IModelService
,
new
ModelServiceImpl
(
configurationService
,
textResourcePropertiesService
,
new
TestThemeService
(),
new
NullLogService
())],
[
IModelService
,
new
ModelServiceImpl
(
configurationService
,
textResourcePropertiesService
,
new
TestThemeService
(),
new
NullLogService
()
,
new
UndoRedoService
()
)],
[
IWorkspaceContextService
,
new
TestContextService
(
testWorkspace
(
URI
.
file
(
testWorkspacePath
)))],
[
IEditorService
,
new
TestEditorService
()],
[
IEditorGroupsService
,
new
TestEditorGroupsService
()],
...
...
src/vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts
浏览文件 @
757006f4
...
...
@@ -36,6 +36,7 @@ import { NullLogService, ILogService } from 'vs/platform/log/common/log';
import
{
ITextResourcePropertiesService
}
from
'
vs/editor/common/services/textResourceConfigurationService
'
;
import
{
ClassifiedEvent
,
StrictPropertyCheck
,
GDPRClassification
}
from
'
vs/platform/telemetry/common/gdprTypings
'
;
import
{
TestThemeService
}
from
'
vs/platform/theme/test/common/testThemeService
'
;
import
{
UndoRedoService
}
from
'
vs/platform/undoRedo/common/undoRedoService
'
;
// declare var __dirname: string;
...
...
@@ -66,7 +67,7 @@ suite.skip('TextSearch performance (integration)', () => {
[
ITelemetryService
,
telemetryService
],
[
IConfigurationService
,
configurationService
],
[
ITextResourcePropertiesService
,
textResourcePropertiesService
],
[
IModelService
,
new
ModelServiceImpl
(
configurationService
,
textResourcePropertiesService
,
new
TestThemeService
(),
logService
)],
[
IModelService
,
new
ModelServiceImpl
(
configurationService
,
textResourcePropertiesService
,
new
TestThemeService
(),
logService
,
new
UndoRedoService
()
)],
[
IWorkspaceContextService
,
new
TestContextService
(
testWorkspace
(
URI
.
file
(
testWorkspacePath
)))],
[
IEditorService
,
new
TestEditorService
()],
[
IEditorGroupsService
,
new
TestEditorGroupsService
()],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录