Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
4447915b
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,发现更多精彩内容 >>
提交
4447915b
编写于
5月 06, 2020
作者:
R
rebornix
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
saveAs
上级
b4dd66bc
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
61 addition
and
7 deletion
+61
-7
src/vs/workbench/api/browser/mainThreadNotebook.ts
src/vs/workbench/api/browser/mainThreadNotebook.ts
+5
-0
src/vs/workbench/api/common/extHost.protocol.ts
src/vs/workbench/api/common/extHost.protocol.ts
+1
-0
src/vs/workbench/api/common/extHostNotebook.ts
src/vs/workbench/api/common/extHostNotebook.ts
+15
-3
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
...workbench/contrib/notebook/browser/notebookEditorInput.ts
+27
-3
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
...workbench/contrib/notebook/browser/notebookServiceImpl.ts
+10
-0
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
.../workbench/contrib/notebook/common/notebookEditorModel.ts
+1
-1
src/vs/workbench/contrib/notebook/common/notebookService.ts
src/vs/workbench/contrib/notebook/common/notebookService.ts
+2
-0
未找到文件。
src/vs/workbench/api/browser/mainThreadNotebook.ts
浏览文件 @
4447915b
...
...
@@ -309,4 +309,9 @@ export class MainThreadNotebookController implements IMainNotebookController {
async
save
(
uri
:
URI
,
token
:
CancellationToken
):
Promise
<
boolean
>
{
return
this
.
_proxy
.
$saveNotebook
(
this
.
_viewType
,
uri
,
token
);
}
async
saveAs
(
uri
:
URI
,
target
:
URI
,
token
:
CancellationToken
):
Promise
<
boolean
>
{
return
this
.
_proxy
.
$saveNotebookAs
(
this
.
_viewType
,
uri
,
target
,
token
);
}
}
src/vs/workbench/api/common/extHost.protocol.ts
浏览文件 @
4447915b
...
...
@@ -1556,6 +1556,7 @@ export interface ExtHostNotebookShape {
$resolveNotebookData
(
viewType
:
string
,
uri
:
UriComponents
):
Promise
<
NotebookDataDto
|
undefined
>
;
$executeNotebook
(
viewType
:
string
,
uri
:
UriComponents
,
cellHandle
:
number
|
undefined
,
token
:
CancellationToken
):
Promise
<
void
>
;
$saveNotebook
(
viewType
:
string
,
uri
:
UriComponents
,
token
:
CancellationToken
):
Promise
<
boolean
>
;
$saveNotebookAs
(
viewType
:
string
,
uri
:
UriComponents
,
target
:
UriComponents
,
token
:
CancellationToken
):
Promise
<
boolean
>
;
$acceptDisplayOrder
(
displayOrder
:
INotebookDisplayOrder
):
void
;
$onDidReceiveMessage
(
uri
:
UriComponents
,
message
:
any
):
void
;
$acceptModelChanged
(
uriComponents
:
UriComponents
,
event
:
NotebookCellsChangedEvent
):
void
;
...
...
src/vs/workbench/api/common/extHostNotebook.ts
浏览文件 @
4447915b
...
...
@@ -846,10 +846,22 @@ export class ExtHostNotebookController implements ExtHostNotebookShape, ExtHostN
return
true
;
}
let
provider
=
this
.
_notebookContentProviders
.
get
(
viewType
);
return
false
;
}
async
$saveNotebookAs
(
viewType
:
string
,
uri
:
UriComponents
,
target
:
UriComponents
,
token
:
CancellationToken
):
Promise
<
boolean
>
{
let
document
=
this
.
_documents
.
get
(
URI
.
revive
(
uri
).
toString
());
if
(
!
document
)
{
return
false
;
}
if
(
this
.
_notebookContentProviders
.
has
(
viewType
))
{
try
{
await
this
.
_notebookContentProviders
.
get
(
viewType
)
!
.
provider
.
saveNotebookAs
(
URI
.
revive
(
target
),
document
,
token
);
}
catch
(
e
)
{
return
false
;
}
if
(
provider
&&
document
)
{
await
provider
.
provider
.
saveNotebook
(
document
,
token
);
return
true
;
}
...
...
src/vs/workbench/contrib/notebook/browser/notebookEditorInput.ts
浏览文件 @
4447915b
...
...
@@ -6,10 +6,12 @@
import
{
EditorInput
,
IEditorInput
,
GroupIdentifier
,
ISaveOptions
}
from
'
vs/workbench/common/editor
'
;
import
{
INotebookService
}
from
'
vs/workbench/contrib/notebook/common/notebookService
'
;
import
{
URI
}
from
'
vs/base/common/uri
'
;
import
{
isEqual
}
from
'
vs/base/common/resources
'
;
import
{
isEqual
,
basename
}
from
'
vs/base/common/resources
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
IFilesConfigurationService
,
AutoSaveMode
}
from
'
vs/workbench/services/filesConfiguration/common/filesConfigurationService
'
;
import
{
NotebookEditorModel
}
from
'
vs/workbench/contrib/notebook/common/notebookEditorModel
'
;
import
{
IFileDialogService
}
from
'
vs/platform/dialogs/common/dialogs
'
;
import
{
IEditorService
}
from
'
vs/workbench/services/editor/common/editorService
'
;
export
class
NotebookEditorInput
extends
EditorInput
{
...
...
@@ -39,7 +41,10 @@ export class NotebookEditorInput extends EditorInput {
public
name
:
string
,
public
readonly
viewType
:
string
|
undefined
,
@
INotebookService
private
readonly
notebookService
:
INotebookService
,
@
IFilesConfigurationService
private
readonly
filesConfigurationService
:
IFilesConfigurationService
@
IFilesConfigurationService
private
readonly
filesConfigurationService
:
IFilesConfigurationService
,
@
IFileDialogService
private
readonly
fileDialogService
:
IFileDialogService
,
@
IEditorService
private
readonly
editorService
:
IEditorService
,
@
IInstantiationService
private
readonly
instantiationService
:
IInstantiationService
)
{
super
();
}
...
...
@@ -86,7 +91,26 @@ export class NotebookEditorInput extends EditorInput {
}
async
saveAs
(
group
:
GroupIdentifier
,
options
?:
ISaveOptions
):
Promise
<
IEditorInput
|
undefined
>
{
return
this
;
if
(
!
this
.
textModel
)
{
return
undefined
;
}
const
dialogPath
=
this
.
textModel
.
resource
;
const
target
=
await
this
.
fileDialogService
.
pickFileToSave
(
dialogPath
,
options
?.
availableFileSystems
);
if
(
!
target
)
{
return
undefined
;
// save cancelled
}
if
(
!
await
this
.
textModel
.
saveAs
(
target
))
{
return
undefined
;
}
return
this
.
_move
(
group
,
target
)?.
editor
;
}
_move
(
group
:
GroupIdentifier
,
newResource
:
URI
):
{
editor
:
IEditorInput
}
|
undefined
{
const
editorInput
=
NotebookEditorInput
.
getOrCreate
(
this
.
instantiationService
,
newResource
,
basename
(
newResource
),
this
.
viewType
);
return
{
editor
:
editorInput
};
}
async
revert
(
group
:
GroupIdentifier
):
Promise
<
void
>
{
...
...
src/vs/workbench/contrib/notebook/browser/notebookServiceImpl.ts
浏览文件 @
4447915b
...
...
@@ -324,6 +324,16 @@ export class NotebookService extends Disposable implements INotebookService, ICu
return
false
;
}
async
saveAs
(
viewType
:
string
,
resource
:
URI
,
target
:
URI
,
token
:
CancellationToken
):
Promise
<
boolean
>
{
let
provider
=
this
.
_notebookProviders
.
get
(
viewType
);
if
(
provider
)
{
return
provider
.
controller
.
saveAs
(
resource
,
target
,
token
);
}
return
false
;
}
onDidReceiveMessage
(
viewType
:
string
,
uri
:
URI
,
message
:
any
):
void
{
let
provider
=
this
.
_notebookProviders
.
get
(
viewType
);
...
...
src/vs/workbench/contrib/notebook/common/notebookEditorModel.ts
浏览文件 @
4447915b
...
...
@@ -161,7 +161,7 @@ export class NotebookEditorModel extends EditorModel implements IWorkingCopy, IN
async
saveAs
(
targetResource
:
URI
):
Promise
<
boolean
>
{
const
tokenSource
=
new
CancellationTokenSource
();
await
this
.
notebookService
.
save
(
this
.
notebook
.
viewType
,
this
.
notebook
.
uri
,
tokenSource
.
token
);
await
this
.
notebookService
.
save
As
(
this
.
notebook
.
viewType
,
this
.
notebook
.
uri
,
targetResource
,
tokenSource
.
token
);
this
.
_dirty
=
false
;
this
.
_onDidChangeDirty
.
fire
();
return
true
;
...
...
src/vs/workbench/contrib/notebook/common/notebookService.ts
浏览文件 @
4447915b
...
...
@@ -23,6 +23,7 @@ export interface IMainNotebookController {
executeNotebookCell
(
uri
:
URI
,
handle
:
number
,
token
:
CancellationToken
):
Promise
<
void
>
;
removeNotebookDocument
(
notebook
:
INotebookTextModel
):
Promise
<
void
>
;
save
(
uri
:
URI
,
token
:
CancellationToken
):
Promise
<
boolean
>
;
saveAs
(
uri
:
URI
,
target
:
URI
,
token
:
CancellationToken
):
Promise
<
boolean
>
;
}
export
interface
INotebookService
{
...
...
@@ -46,6 +47,7 @@ export interface INotebookService {
destoryNotebookDocument
(
viewType
:
string
,
notebook
:
INotebookTextModel
):
void
;
updateActiveNotebookDocument
(
viewType
:
string
,
resource
:
URI
):
void
;
save
(
viewType
:
string
,
resource
:
URI
,
token
:
CancellationToken
):
Promise
<
boolean
>
;
saveAs
(
viewType
:
string
,
resource
:
URI
,
target
:
URI
,
token
:
CancellationToken
):
Promise
<
boolean
>
;
onDidReceiveMessage
(
viewType
:
string
,
uri
:
URI
,
message
:
any
):
void
;
setToCopy
(
items
:
NotebookCellTextModel
[]):
void
;
getToCopy
():
NotebookCellTextModel
[]
|
undefined
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录