Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
8516b9a6
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,发现更多精彩内容 >>
提交
8516b9a6
编写于
3月 21, 2017
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
no EOLEdit for now, no replacement yet
上级
6a062eea
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
6 addition
and
54 deletion
+6
-54
src/vs/vscode.d.ts
src/vs/vscode.d.ts
+1
-29
src/vs/workbench/api/node/extHost.api.impl.ts
src/vs/workbench/api/node/extHost.api.impl.ts
+0
-1
src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts
src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts
+5
-11
src/vs/workbench/api/node/extHostTypes.ts
src/vs/workbench/api/node/extHostTypes.ts
+0
-13
未找到文件。
src/vs/vscode.d.ts
浏览文件 @
8516b9a6
...
...
@@ -2048,34 +2048,6 @@ declare module 'vscode' {
constructor
(
range
:
Range
,
newText
:
string
);
}
/**
* Represents a change of the [eol-sequence](#TextDocument.eol) that is used in a document.
*/
export
class
EndOfLineEdit
{
/**
* Use the line feed `\n` character.
*/
static
readonly
LF
:
EndOfLineEdit
;
/**
* Use the carriage return line feed `\r\n` sequence.
*/
static
readonly
CRLF
:
EndOfLineEdit
;
/**
* The new end of line sequence
*/
newEol
:
EndOfLine
;
/**
* Create a new EndOfLineEdit.
*
* @param newEol A new end of line sequence.
*/
constructor
(
newEol
:
EndOfLine
);
}
/**
* A workspace edit represents textual changes for many documents.
*/
...
...
@@ -3990,7 +3962,7 @@ declare module 'vscode' {
*
* @param thenable A thenable that resolves to [pre-save-edits](#TextEdit).
*/
waitUntil
(
thenable
:
Thenable
<
TextEdit
[]
|
EndOfLineEdit
>
):
void
;
waitUntil
(
thenable
:
Thenable
<
TextEdit
[]
>
):
void
;
/**
* Allows to pause the event loop until the provided thenable resolved.
...
...
src/vs/workbench/api/node/extHost.api.impl.ts
浏览文件 @
8516b9a6
...
...
@@ -486,7 +486,6 @@ export function createApiFactory(initData: IInitData, threadService: IThreadServ
SymbolKind
:
extHostTypes
.
SymbolKind
,
TextDocumentSaveReason
:
extHostTypes
.
TextDocumentSaveReason
,
TextEdit
:
extHostTypes
.
TextEdit
,
EndOfLineEdit
:
extHostTypes
.
EndOfLineEdit
,
TextEditorCursorStyle
:
EditorCommon
.
TextEditorCursorStyle
,
TextEditorLineNumbersStyle
:
extHostTypes
.
TextEditorLineNumbersStyle
,
TextEditorRevealType
:
extHostTypes
.
TextEditorRevealType
,
...
...
src/vs/workbench/api/node/extHostDocumentSaveParticipant.ts
浏览文件 @
8516b9a6
...
...
@@ -11,8 +11,8 @@ import { sequence, always } from 'vs/base/common/async';
import
{
illegalState
}
from
'
vs/base/common/errors
'
;
import
{
TPromise
}
from
'
vs/base/common/winjs.base
'
;
import
{
MainThreadWorkspaceShape
,
ExtHostDocumentSaveParticipantShape
}
from
'
vs/workbench/api/node/extHost.protocol
'
;
import
{
TextEdit
,
EndOfLineEdit
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
fromRange
,
TextDocumentSaveReason
,
fromEOL
}
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
TextEdit
}
from
'
vs/workbench/api/node/extHostTypes
'
;
import
{
fromRange
,
TextDocumentSaveReason
}
from
'
vs/workbench/api/node/extHostTypeConverters
'
;
import
{
IResourceEdit
}
from
'
vs/editor/common/services/bulkEdit
'
;
import
{
ExtHostDocuments
}
from
'
vs/workbench/api/node/extHostDocuments
'
;
import
{
SaveReason
}
from
'
vs/workbench/services/textfile/common/textfiles
'
;
...
...
@@ -101,7 +101,7 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
private
_deliverEventAsync
(
listener
:
Function
,
thisArg
:
any
,
stubEvent
:
vscode
.
TextDocumentWillSaveEvent
):
TPromise
<
any
>
{
const
promises
:
TPromise
<
vscode
.
TextEdit
[]
|
vscode
.
EndOfLineEdit
>
[]
=
[];
const
promises
:
TPromise
<
vscode
.
TextEdit
[]
>
[]
=
[];
const
{
document
,
reason
}
=
stubEvent
;
const
{
version
}
=
document
;
...
...
@@ -127,7 +127,7 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
// freeze promises after event call
Object
.
freeze
(
promises
);
return
new
TPromise
<
(
vscode
.
TextEdit
[]
|
vscode
.
EndOfLineEdit
)
[]
>
((
resolve
,
reject
)
=>
{
return
new
TPromise
<
vscode
.
TextEdit
[]
[]
>
((
resolve
,
reject
)
=>
{
// join on all listener promises, reject after timeout
const
handle
=
setTimeout
(()
=>
reject
(
new
Error
(
'
timeout
'
)),
this
.
_thresholds
.
timeout
);
return
always
(
TPromise
.
join
(
promises
),
()
=>
clearTimeout
(
handle
)).
then
(
resolve
,
reject
);
...
...
@@ -137,13 +137,7 @@ export class ExtHostDocumentSaveParticipant extends ExtHostDocumentSaveParticipa
let
edits
:
IResourceEdit
[]
=
[];
for
(
const
value
of
values
)
{
if
(
value
instanceof
EndOfLineEdit
)
{
edits
.
push
({
resource
:
<
URI
>
document
.
uri
,
eol
:
fromEOL
(
value
.
newEol
)
});
}
else
if
(
Array
.
isArray
(
value
)
&&
(
<
vscode
.
TextEdit
[]
>
value
).
every
(
e
=>
e
instanceof
TextEdit
))
{
if
(
Array
.
isArray
(
value
)
&&
(
<
vscode
.
TextEdit
[]
>
value
).
every
(
e
=>
e
instanceof
TextEdit
))
{
for
(
const
{
newText
,
range
}
of
value
)
{
edits
.
push
({
resource
:
<
URI
>
document
.
uri
,
...
...
src/vs/workbench/api/node/extHostTypes.ts
浏览文件 @
8516b9a6
...
...
@@ -404,19 +404,6 @@ export enum EndOfLine {
CRLF
=
2
}
export
class
EndOfLineEdit
{
static
readonly
LF
:
EndOfLineEdit
=
Object
.
freeze
({
newEol
:
EndOfLine
.
LF
});
static
readonly
CRLF
:
EndOfLineEdit
=
Object
.
freeze
({
newEol
:
EndOfLine
.
CRLF
});
newEol
:
EndOfLine
;
constructor
(
newEol
:
EndOfLine
)
{
this
.
newEol
=
newEol
;
}
}
export
class
TextEdit
{
static
isTextEdit
(
thing
:
any
):
thing
is
TextEdit
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录