Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
f322baeb
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,发现更多精彩内容 >>
提交
f322baeb
编写于
2月 07, 2018
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use URI for ExtHostDocumentsShape methods
上级
5b1d34e4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
18 deletion
+26
-18
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
+6
-6
src/vs/workbench/api/node/extHost.protocol.ts
src/vs/workbench/api/node/extHost.protocol.ts
+4
-4
src/vs/workbench/api/node/extHostDocuments.ts
src/vs/workbench/api/node/extHostDocuments.ts
+14
-6
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
...ectron-browser/api/extHostDocumentSaveParticipant.test.ts
+2
-2
未找到文件。
src/vs/workbench/api/electron-browser/mainThreadDocuments.ts
浏览文件 @
f322baeb
...
@@ -104,17 +104,17 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
...
@@ -104,17 +104,17 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
this
.
_toDispose
.
push
(
textFileService
.
models
.
onModelSaved
(
e
=>
{
this
.
_toDispose
.
push
(
textFileService
.
models
.
onModelSaved
(
e
=>
{
if
(
this
.
_shouldHandleFileEvent
(
e
))
{
if
(
this
.
_shouldHandleFileEvent
(
e
))
{
this
.
_proxy
.
$acceptModelSaved
(
e
.
resource
.
toString
()
);
this
.
_proxy
.
$acceptModelSaved
(
e
.
resource
);
}
}
}));
}));
this
.
_toDispose
.
push
(
textFileService
.
models
.
onModelReverted
(
e
=>
{
this
.
_toDispose
.
push
(
textFileService
.
models
.
onModelReverted
(
e
=>
{
if
(
this
.
_shouldHandleFileEvent
(
e
))
{
if
(
this
.
_shouldHandleFileEvent
(
e
))
{
this
.
_proxy
.
$acceptDirtyStateChanged
(
e
.
resource
.
toString
()
,
false
);
this
.
_proxy
.
$acceptDirtyStateChanged
(
e
.
resource
,
false
);
}
}
}));
}));
this
.
_toDispose
.
push
(
textFileService
.
models
.
onModelDirty
(
e
=>
{
this
.
_toDispose
.
push
(
textFileService
.
models
.
onModelDirty
(
e
=>
{
if
(
this
.
_shouldHandleFileEvent
(
e
))
{
if
(
this
.
_shouldHandleFileEvent
(
e
))
{
this
.
_proxy
.
$acceptDirtyStateChanged
(
e
.
resource
.
toString
()
,
true
);
this
.
_proxy
.
$acceptDirtyStateChanged
(
e
.
resource
,
true
);
}
}
}));
}));
...
@@ -143,7 +143,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
...
@@ -143,7 +143,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
let
modelUrl
=
model
.
uri
;
let
modelUrl
=
model
.
uri
;
this
.
_modelIsSynced
[
modelUrl
.
toString
()]
=
true
;
this
.
_modelIsSynced
[
modelUrl
.
toString
()]
=
true
;
this
.
_modelToDisposeMap
[
modelUrl
.
toString
()]
=
model
.
onDidChangeContent
((
e
)
=>
{
this
.
_modelToDisposeMap
[
modelUrl
.
toString
()]
=
model
.
onDidChangeContent
((
e
)
=>
{
this
.
_proxy
.
$acceptModelChanged
(
modelUrl
.
toString
()
,
e
,
this
.
_textFileService
.
isDirty
(
modelUrl
));
this
.
_proxy
.
$acceptModelChanged
(
modelUrl
,
e
,
this
.
_textFileService
.
isDirty
(
modelUrl
));
});
});
}
}
...
@@ -153,7 +153,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
...
@@ -153,7 +153,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
if
(
!
this
.
_modelIsSynced
[
modelUrl
.
toString
()])
{
if
(
!
this
.
_modelIsSynced
[
modelUrl
.
toString
()])
{
return
;
return
;
}
}
this
.
_proxy
.
$acceptModelModeChanged
(
model
.
uri
.
toString
()
,
oldModeId
,
model
.
getLanguageIdentifier
().
language
);
this
.
_proxy
.
$acceptModelModeChanged
(
model
.
uri
,
oldModeId
,
model
.
getLanguageIdentifier
().
language
);
}
}
private
_onModelRemoved
(
modelUrl
:
URI
):
void
{
private
_onModelRemoved
(
modelUrl
:
URI
):
void
{
...
@@ -227,7 +227,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
...
@@ -227,7 +227,7 @@ export class MainThreadDocuments implements MainThreadDocumentsShape {
throw
new
Error
(
`expected URI
${
resource
.
toString
()}
to have come to LIFE`
);
throw
new
Error
(
`expected URI
${
resource
.
toString
()}
to have come to LIFE`
);
}
}
this
.
_proxy
.
$acceptDirtyStateChanged
(
resource
.
toString
()
,
true
);
// mark as dirty
this
.
_proxy
.
$acceptDirtyStateChanged
(
resource
,
true
);
// mark as dirty
return
resource
;
return
resource
;
});
});
...
...
src/vs/workbench/api/node/extHost.protocol.ts
浏览文件 @
f322baeb
...
@@ -479,10 +479,10 @@ export interface IModelAddedData {
...
@@ -479,10 +479,10 @@ export interface IModelAddedData {
isDirty
:
boolean
;
isDirty
:
boolean
;
}
}
export
interface
ExtHostDocumentsShape
{
export
interface
ExtHostDocumentsShape
{
$acceptModelModeChanged
(
strURL
:
string
,
oldModeId
:
string
,
newModeId
:
string
):
void
;
$acceptModelModeChanged
(
strURL
:
UriComponents
,
oldModeId
:
string
,
newModeId
:
string
):
void
;
$acceptModelSaved
(
strURL
:
string
):
void
;
$acceptModelSaved
(
strURL
:
UriComponents
):
void
;
$acceptDirtyStateChanged
(
strURL
:
string
,
isDirty
:
boolean
):
void
;
$acceptDirtyStateChanged
(
strURL
:
UriComponents
,
isDirty
:
boolean
):
void
;
$acceptModelChanged
(
strURL
:
string
,
e
:
IModelChangedEvent
,
isDirty
:
boolean
):
void
;
$acceptModelChanged
(
strURL
:
UriComponents
,
e
:
IModelChangedEvent
,
isDirty
:
boolean
):
void
;
}
}
export
interface
ExtHostDocumentSaveParticipantShape
{
export
interface
ExtHostDocumentSaveParticipantShape
{
...
...
src/vs/workbench/api/node/extHostDocuments.ts
浏览文件 @
f322baeb
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
'
use strict
'
;
'
use strict
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
Event
,
{
Emitter
}
from
'
vs/base/common/event
'
;
import
URI
from
'
vs/base/common/uri
'
;
import
URI
,
{
UriComponents
}
from
'
vs/base/common/uri
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
*
as
TypeConverters
from
'
./extHostTypeConverters
'
;
import
*
as
TypeConverters
from
'
./extHostTypeConverters
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
...
@@ -95,7 +95,9 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
...
@@ -95,7 +95,9 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
return
this
.
_proxy
.
$tryCreateDocument
(
options
).
then
(
data
=>
URI
.
revive
(
data
));
return
this
.
_proxy
.
$tryCreateDocument
(
options
).
then
(
data
=>
URI
.
revive
(
data
));
}
}
public
$acceptModelModeChanged
(
strURL
:
string
,
oldModeId
:
string
,
newModeId
:
string
):
void
{
public
$acceptModelModeChanged
(
uriComponents
:
UriComponents
,
oldModeId
:
string
,
newModeId
:
string
):
void
{
const
uri
=
URI
.
revive
(
uriComponents
);
const
strURL
=
uri
.
toString
();
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
// Treat a mode change as a remove + add
// Treat a mode change as a remove + add
...
@@ -105,13 +107,17 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
...
@@ -105,13 +107,17 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
this
.
_onDidAddDocument
.
fire
(
data
.
document
);
this
.
_onDidAddDocument
.
fire
(
data
.
document
);
}
}
public
$acceptModelSaved
(
strURL
:
string
):
void
{
public
$acceptModelSaved
(
uriComponents
:
UriComponents
):
void
{
const
uri
=
URI
.
revive
(
uriComponents
);
const
strURL
=
uri
.
toString
();
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
this
.
$acceptDirtyStateChanged
(
strURL
,
false
);
this
.
$acceptDirtyStateChanged
(
uriComponents
,
false
);
this
.
_onDidSaveDocument
.
fire
(
data
.
document
);
this
.
_onDidSaveDocument
.
fire
(
data
.
document
);
}
}
public
$acceptDirtyStateChanged
(
strURL
:
string
,
isDirty
:
boolean
):
void
{
public
$acceptDirtyStateChanged
(
uriComponents
:
UriComponents
,
isDirty
:
boolean
):
void
{
const
uri
=
URI
.
revive
(
uriComponents
);
const
strURL
=
uri
.
toString
();
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
data
.
_acceptIsDirty
(
isDirty
);
data
.
_acceptIsDirty
(
isDirty
);
this
.
_onDidChangeDocument
.
fire
({
this
.
_onDidChangeDocument
.
fire
({
...
@@ -120,7 +126,9 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
...
@@ -120,7 +126,9 @@ export class ExtHostDocuments implements ExtHostDocumentsShape {
});
});
}
}
public
$acceptModelChanged
(
strURL
:
string
,
events
:
IModelChangedEvent
,
isDirty
:
boolean
):
void
{
public
$acceptModelChanged
(
uriComponents
:
UriComponents
,
events
:
IModelChangedEvent
,
isDirty
:
boolean
):
void
{
const
uri
=
URI
.
revive
(
uriComponents
);
const
strURL
=
uri
.
toString
();
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
let
data
=
this
.
_documentsAndEditors
.
getDocument
(
strURL
);
data
.
_acceptIsDirty
(
isDirty
);
data
.
_acceptIsDirty
(
isDirty
);
data
.
onEvents
(
events
);
data
.
onEvents
(
events
);
...
...
src/vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts
浏览文件 @
f322baeb
...
@@ -298,7 +298,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
...
@@ -298,7 +298,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
let
sub
=
participant
.
getOnWillSaveTextDocumentEvent
(
nullExtensionDescription
)(
function
(
e
)
{
let
sub
=
participant
.
getOnWillSaveTextDocumentEvent
(
nullExtensionDescription
)(
function
(
e
)
{
// concurrent change from somewhere
// concurrent change from somewhere
documents
.
$acceptModelChanged
(
resource
.
toString
()
,
{
documents
.
$acceptModelChanged
(
resource
,
{
changes
:
[{
changes
:
[{
range
:
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
1
},
range
:
{
startLineNumber
:
1
,
startColumn
:
1
,
endLineNumber
:
1
,
endColumn
:
1
},
rangeLength
:
undefined
,
rangeLength
:
undefined
,
...
@@ -332,7 +332,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
...
@@ -332,7 +332,7 @@ suite('ExtHostDocumentSaveParticipant', () => {
const
{
resource
,
edits
}
=
edit
;
const
{
resource
,
edits
}
=
edit
;
const
uri
=
URI
.
revive
(
resource
);
const
uri
=
URI
.
revive
(
resource
);
for
(
const
{
text
,
range
}
of
edits
)
{
for
(
const
{
text
,
range
}
of
edits
)
{
documents
.
$acceptModelChanged
(
uri
.
toString
()
,
{
documents
.
$acceptModelChanged
(
uri
,
{
changes
:
[{
changes
:
[{
range
,
range
,
text
,
text
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录