Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1ebfb1b6
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,发现更多精彩内容 >>
提交
1ebfb1b6
编写于
6月 16, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add createDiffNavigator API
上级
50e1f4f2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
81 addition
and
47 deletion
+81
-47
build/monaco/monaco.d.ts.recipe
build/monaco/monaco.d.ts.recipe
+5
-1
build/monaco/package.json
build/monaco/package.json
+1
-1
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
+16
-39
src/vs/editor/browser/standalone/standaloneEditor.ts
src/vs/editor/browser/standalone/standaloneEditor.ts
+22
-4
src/vs/monaco.d.ts
src/vs/monaco.d.ts
+37
-2
未找到文件。
build/monaco/monaco.d.ts.recipe
浏览文件 @
1ebfb1b6
...
...
@@ -53,7 +53,11 @@ declare module monaco {
declare module monaco.editor {
#includeAll(vs/editor/browser/standalone/standaloneEditor;modes.=>languages.):
#include(vs/editor/browser/standalone/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions
#include(vs/editor/browser/standalone/standaloneCodeEditor): IEditorConstructionOptions, IDiffEditorConstructionOptions, IStandaloneCodeEditor, IStandaloneDiffEditor
export interface ICommandHandler {
(...args:any[]): void;
}
#include(vs/platform/keybinding/common/keybindingService): IKeybindingContextKey
#include(vs/editor/browser/standalone/standaloneServices): IEditorOverrideServices
#include(vs/platform/markers/common/markers): IMarkerData
#include(vs/editor/browser/standalone/colorizer): IColorizerOptions, IColorizerElementOptions
...
...
build/monaco/package.json
浏览文件 @
1ebfb1b6
{
"name"
:
"monaco-editor-core"
,
"private"
:
true
,
"version"
:
"0.4.
1
"
,
"version"
:
"0.4.
2
"
,
"description"
:
"A browser based code editor"
,
"author"
:
"Microsoft Corporation"
,
"license"
:
"MIT"
,
...
...
src/vs/editor/browser/standalone/standaloneCodeEditor.ts
浏览文件 @
1ebfb1b6
...
...
@@ -7,11 +7,9 @@
import
{
IDisposable
,
dispose
}
from
'
vs/base/common/lifecycle
'
;
import
{
IContextViewService
}
from
'
vs/platform/contextview/browser/contextView
'
;
import
{
IEditorService
}
from
'
vs/platform/editor/common/editor
'
;
import
{
IInstantiationService
}
from
'
vs/platform/instantiation/common/instantiation
'
;
import
{
AbstractKeybindingService
}
from
'
vs/platform/keybinding/browser/keybindingServiceImpl
'
;
import
{
ICommandHandler
,
IKeybindingContextKey
,
IKeybindingService
}
from
'
vs/platform/keybinding/common/keybindingService
'
;
import
{
IMarkerService
}
from
'
vs/platform/markers/common/markers
'
;
import
{
RemoteTelemetryServiceHelper
}
from
'
vs/platform/telemetry/common/remoteTelemetryService
'
;
import
{
ITelemetryService
}
from
'
vs/platform/telemetry/common/telemetry
'
;
import
{
IActionDescriptor
,
ICodeEditorWidgetCreationOptions
,
IDiffEditorOptions
,
IModel
,
IModelChangedEvent
,
EventType
}
from
'
vs/editor/common/editorCommon
'
;
...
...
@@ -21,6 +19,7 @@ import {StandaloneKeybindingService} from 'vs/editor/browser/standalone/simpleSe
import
{
IEditorContextViewService
,
IEditorOverrideServices
,
ensureStaticPlatformServices
,
getOrCreateStaticServices
}
from
'
vs/editor/browser/standalone/standaloneServices
'
;
import
{
CodeEditorWidget
}
from
'
vs/editor/browser/widget/codeEditorWidget
'
;
import
{
DiffEditorWidget
}
from
'
vs/editor/browser/widget/diffEditorWidget
'
;
import
{
ICodeEditor
,
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
/**
* The options to create an editor.
...
...
@@ -44,12 +43,22 @@ export interface IEditorConstructionOptions extends ICodeEditorWidgetCreationOpt
export
interface
IDiffEditorConstructionOptions
extends
IDiffEditorOptions
{
}
export
class
StandaloneEditor
extends
CodeEditorWidget
{
export
interface
IStandaloneCodeEditor
extends
ICodeEditor
{
addCommand
(
keybinding
:
number
,
handler
:
ICommandHandler
,
context
:
string
):
string
;
createContextKey
<
T
>
(
key
:
string
,
defaultValue
:
T
):
IKeybindingContextKey
<
T
>
;
addAction
(
descriptor
:
IActionDescriptor
):
void
;
}
export
interface
IStandaloneDiffEditor
extends
IDiffEditor
{
addCommand
(
keybinding
:
number
,
handler
:
ICommandHandler
,
context
:
string
):
string
;
createContextKey
<
T
>
(
key
:
string
,
defaultValue
:
T
):
IKeybindingContextKey
<
T
>
;
addAction
(
descriptor
:
IActionDescriptor
):
void
;
}
export
class
StandaloneEditor
extends
CodeEditorWidget
implements
IStandaloneCodeEditor
{
private
_editorService
:
IEditorService
;
private
_standaloneKeybindingService
:
StandaloneKeybindingService
;
private
_contextViewService
:
IEditorContextViewService
;
private
_markerService
:
IMarkerService
;
private
_ownsModel
:
boolean
;
private
_toDispose2
:
IDisposable
[];
...
...
@@ -61,9 +70,7 @@ export class StandaloneEditor extends CodeEditorWidget {
@
ICodeEditorService
codeEditorService
:
ICodeEditorService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IEditorService
editorService
:
IEditorService
,
@
IMarkerService
markerService
:
IMarkerService
@
IContextViewService
contextViewService
:
IContextViewService
)
{
if
(
keybindingService
instanceof
AbstractKeybindingService
)
{
(
<
AbstractKeybindingService
><
any
>
keybindingService
).
setInstantiationService
(
instantiationService
);
...
...
@@ -77,8 +84,6 @@ export class StandaloneEditor extends CodeEditorWidget {
}
this
.
_contextViewService
=
<
IEditorContextViewService
>
contextViewService
;
this
.
_editorService
=
editorService
;
this
.
_markerService
=
markerService
;
this
.
_toDispose2
=
toDispose
;
let
model
:
IModel
=
null
;
...
...
@@ -110,10 +115,6 @@ export class StandaloneEditor extends CodeEditorWidget {
this
.
dispose
();
}
public
getMarkerService
():
IMarkerService
{
return
this
.
_markerService
;
}
public
addCommand
(
keybinding
:
number
,
handler
:
ICommandHandler
,
context
:
string
):
string
{
if
(
!
this
.
_standaloneKeybindingService
)
{
console
.
warn
(
'
Cannot add command because the editor is configured with an unrecognized KeybindingService
'
);
...
...
@@ -146,14 +147,6 @@ export class StandaloneEditor extends CodeEditorWidget {
}
}
public
getTelemetryService
():
ITelemetryService
{
return
this
.
_telemetryService
;
}
public
getEditorService
():
IEditorService
{
return
this
.
_editorService
;
}
_attachModel
(
model
:
IModel
):
void
{
super
.
_attachModel
(
model
);
if
(
this
.
_view
)
{
...
...
@@ -170,13 +163,11 @@ export class StandaloneEditor extends CodeEditorWidget {
}
}
export
class
StandaloneDiffEditor
extends
DiffEditorWidget
{
export
class
StandaloneDiffEditor
extends
DiffEditorWidget
implements
IStandaloneDiffEditor
{
private
_contextViewService
:
IEditorContextViewService
;
private
_standaloneKeybindingService
:
StandaloneKeybindingService
;
private
_toDispose2
:
IDisposable
[];
private
_markerService
:
IMarkerService
;
private
_telemetryService
:
ITelemetryService
;
constructor
(
domElement
:
HTMLElement
,
...
...
@@ -185,9 +176,6 @@ export class StandaloneDiffEditor extends DiffEditorWidget {
@
IInstantiationService
instantiationService
:
IInstantiationService
,
@
IKeybindingService
keybindingService
:
IKeybindingService
,
@
IContextViewService
contextViewService
:
IContextViewService
,
@
IEditorService
editorService
:
IEditorService
,
@
IMarkerService
markerService
:
IMarkerService
,
@
ITelemetryService
telemetryService
:
ITelemetryService
,
@
IEditorWorkerService
editorWorkerService
:
IEditorWorkerService
)
{
if
(
keybindingService
instanceof
AbstractKeybindingService
)
{
...
...
@@ -202,9 +190,6 @@ export class StandaloneDiffEditor extends DiffEditorWidget {
this
.
_contextViewService
=
<
IEditorContextViewService
>
contextViewService
;
this
.
_markerService
=
markerService
;
this
.
_telemetryService
=
telemetryService
;
this
.
_toDispose2
=
toDispose
;
this
.
_contextViewService
.
setContainer
(
this
.
_containerDomElement
);
...
...
@@ -219,10 +204,6 @@ export class StandaloneDiffEditor extends DiffEditorWidget {
this
.
dispose
();
}
public
getMarkerService
():
IMarkerService
{
return
this
.
_markerService
;
}
public
addCommand
(
keybinding
:
number
,
handler
:
ICommandHandler
,
context
:
string
):
string
{
if
(
!
this
.
_standaloneKeybindingService
)
{
console
.
warn
(
'
Cannot add command because the editor is configured with an unrecognized KeybindingService
'
);
...
...
@@ -254,10 +235,6 @@ export class StandaloneDiffEditor extends DiffEditorWidget {
});
}
}
public
getTelemetryService
():
ITelemetryService
{
return
this
.
_telemetryService
;
}
}
export
var
startup
=
(
function
()
{
...
...
src/vs/editor/browser/standalone/standaloneEditor.ts
浏览文件 @
1ebfb1b6
...
...
@@ -9,7 +9,7 @@ import 'vs/css!./media/standalone-tokens';
import
*
as
editorCommon
from
'
vs/editor/common/editorCommon
'
;
import
{
ContentWidgetPositionPreference
,
OverlayWidgetPositionPreference
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
ShallowCancelThenPromise
}
from
'
vs/base/common/async
'
;
import
{
StandaloneEditor
,
StandaloneDiffEditor
,
startup
,
IEditorConstructionOptions
,
IDiffEditorConstructionOptions
}
from
'
vs/editor/browser/standalone/standaloneCodeEditor
'
;
import
{
StandaloneEditor
,
IStandaloneCodeEditor
,
StandaloneDiffEditor
,
I
StandaloneDiffEditor
,
startup
,
IEditorConstructionOptions
,
IDiffEditorConstructionOptions
}
from
'
vs/editor/browser/standalone/standaloneCodeEditor
'
;
import
{
ScrollbarVisibility
}
from
'
vs/base/browser/ui/scrollbar/scrollableElementOptions
'
;
import
{
IEditorOverrideServices
,
ensureDynamicPlatformServices
,
ensureStaticPlatformServices
}
from
'
vs/editor/browser/standalone/standaloneServices
'
;
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
...
...
@@ -20,12 +20,12 @@ import {ServiceCollection} from 'vs/platform/instantiation/common/serviceCollect
import
{
InstantiationService
}
from
'
vs/platform/instantiation/common/instantiationService
'
;
import
{
IModel
}
from
'
vs/editor/common/editorCommon
'
;
import
{
IModelService
}
from
'
vs/editor/common/services/modelService
'
;
import
{
ICodeEditor
,
IDiffEditor
}
from
'
vs/editor/browser/editorBrowser
'
;
import
{
Colorizer
,
IColorizerElementOptions
,
IColorizerOptions
}
from
'
vs/editor/browser/standalone/colorizer
'
;
import
{
SimpleEditorService
}
from
'
vs/editor/browser/standalone/simpleServices
'
;
import
*
as
modes
from
'
vs/editor/common/modes
'
;
import
{
EditorWorkerClient
}
from
'
vs/editor/common/services/editorWorkerServiceImpl
'
;
import
{
IMarkerData
}
from
'
vs/platform/markers/common/markers
'
;
import
{
DiffNavigator
}
from
'
vs/editor/contrib/diffNavigator/common/diffNavigator
'
;
function
shallowClone
<
T
>
(
obj
:
T
):
T
{
let
r
:
T
=
<
any
>
{};
...
...
@@ -51,7 +51,7 @@ export function setupServices(services: IEditorOverrideServices): IEditorOverrid
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
export
function
create
(
domElement
:
HTMLElement
,
options
?:
IEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
ICodeEditor
{
export
function
create
(
domElement
:
HTMLElement
,
options
?:
IEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
I
Standalone
CodeEditor
{
startup
.
initStaticServicesIfNecessary
();
services
=
shallowClone
(
services
);
...
...
@@ -76,7 +76,7 @@ export function create(domElement:HTMLElement, options?:IEditorConstructionOptio
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
export
function
createDiffEditor
(
domElement
:
HTMLElement
,
options
?:
IDiffEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
IDiffEditor
{
export
function
createDiffEditor
(
domElement
:
HTMLElement
,
options
?:
IDiffEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
I
Standalone
DiffEditor
{
startup
.
initStaticServicesIfNecessary
();
services
=
shallowClone
(
services
);
...
...
@@ -96,6 +96,23 @@ export function createDiffEditor(domElement:HTMLElement, options?:IDiffEditorCon
return
result
;
}
export
interface
IDiffNavigator
{
canNavigate
():
boolean
;
next
():
void
;
previous
():
void
;
dispose
():
void
;
}
export
interface
IDiffNavigatorOptions
{
followsCaret
?:
boolean
;
ignoreCharChanges
?:
boolean
;
alwaysRevealFirst
?:
boolean
;
}
export
function
createDiffNavigator
(
diffEditor
:
IStandaloneDiffEditor
,
opts
?:
IDiffNavigatorOptions
):
IDiffNavigator
{
return
new
DiffNavigator
(
diffEditor
,
opts
);
}
function
prepareServices
(
domElement
:
HTMLElement
,
services
:
IEditorOverrideServices
):
{
ctx
:
IEditorOverrideServices
;
toDispose
:
IDisposable
[];
}
{
services
=
ensureStaticPlatformServices
(
services
);
var
toDispose
=
ensureDynamicPlatformServices
(
domElement
,
services
);
...
...
@@ -371,6 +388,7 @@ export function createMonacoEditorAPI(): typeof monaco.editor {
// methods
create
:
create
,
createDiffEditor
:
createDiffEditor
,
createDiffNavigator
:
createDiffNavigator
,
createModel
:
createModel
,
setModelLanguage
:
setModelLanguage
,
...
...
src/vs/monaco.d.ts
浏览文件 @
1ebfb1b6
...
...
@@ -752,14 +752,29 @@ declare module monaco.editor {
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
export
function
create
(
domElement
:
HTMLElement
,
options
?:
IEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
ICodeEditor
;
export
function
create
(
domElement
:
HTMLElement
,
options
?:
IEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
I
Standalone
CodeEditor
;
/**
* Create a new diff editor under `domElement`.
* `domElement` should be empty (not contain other dom nodes).
* The editor will read the size of `domElement`.
*/
export
function
createDiffEditor
(
domElement
:
HTMLElement
,
options
?:
IDiffEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
IDiffEditor
;
export
function
createDiffEditor
(
domElement
:
HTMLElement
,
options
?:
IDiffEditorConstructionOptions
,
services
?:
IEditorOverrideServices
):
IStandaloneDiffEditor
;
export
interface
IDiffNavigator
{
canNavigate
():
boolean
;
next
():
void
;
previous
():
void
;
dispose
():
void
;
}
export
interface
IDiffNavigatorOptions
{
followsCaret
?:
boolean
;
ignoreCharChanges
?:
boolean
;
alwaysRevealFirst
?:
boolean
;
}
export
function
createDiffNavigator
(
diffEditor
:
IStandaloneDiffEditor
,
opts
?:
IDiffNavigatorOptions
):
IDiffNavigator
;
/**
* Create a new editor model.
...
...
@@ -879,6 +894,26 @@ declare module monaco.editor {
export
interface
IDiffEditorConstructionOptions
extends
IDiffEditorOptions
{
}
export
interface
IStandaloneCodeEditor
extends
ICodeEditor
{
addCommand
(
keybinding
:
number
,
handler
:
ICommandHandler
,
context
:
string
):
string
;
createContextKey
<
T
>
(
key
:
string
,
defaultValue
:
T
):
IKeybindingContextKey
<
T
>
;
addAction
(
descriptor
:
IActionDescriptor
):
void
;
}
export
interface
IStandaloneDiffEditor
extends
IDiffEditor
{
addCommand
(
keybinding
:
number
,
handler
:
ICommandHandler
,
context
:
string
):
string
;
createContextKey
<
T
>
(
key
:
string
,
defaultValue
:
T
):
IKeybindingContextKey
<
T
>
;
addAction
(
descriptor
:
IActionDescriptor
):
void
;
}
export
interface
ICommandHandler
{
(...
args
:
any
[]):
void
;
}
export
interface
IKeybindingContextKey
<
T
>
{
set
(
value
:
T
):
void
;
reset
():
void
;
}
export
interface
IEditorOverrideServices
{
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录