Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
b9b39fd2
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,发现更多精彩内容 >>
提交
b9b39fd2
编写于
5月 21, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Auto-format the generated monaco-editor.d.ts
上级
b693a851
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
4003 addition
and
3887 deletion
+4003
-3887
build/lib/monaco-editor.d.ts
build/lib/monaco-editor.d.ts
+3833
-3833
build/lib/monaco-editor.d.ts.recipe
build/lib/monaco-editor.d.ts.recipe
+54
-52
build/lib/monaco.js
build/lib/monaco.js
+53
-1
build/lib/monaco.ts
build/lib/monaco.ts
+63
-1
未找到文件。
build/lib/monaco-editor.d.ts
浏览文件 @
b9b39fd2
此差异已折叠。
点击以展开。
build/lib/monaco-editor.d.ts.recipe
浏览文件 @
b9b39fd2
declare module monaco.editor {
declare module monaco.editor {
export function create(domElement: HTMLElement, options: IEditorConstructionOptions, services?: any): ICodeEditor;
export function create(domElement: HTMLElement, options: IEditorConstructionOptions, services?: any): ICodeEditor;
export function createDiffEditor(domElement: HTMLElement, options: IDiffEditorConstructionOptions, services?: any): IDiffEditor;
export function createDiffEditor(domElement: HTMLElement, options: IDiffEditorConstructionOptions, services?: any): IDiffEditor;
export function createModel(value:string, mode:string|ILanguage|IMode, associatedResource?:any|string): IModel;
export function createModel(value:string, mode:string|ILanguage|IMode, associatedResource?:any|string): IModel;
export function getOrCreateMode(modeId: string): TPromise<IMode>;
export function getOrCreateMode(modeId: string): TPromise<IMode>;
export function createCustomMode(description:ILanguage): TPromise<IMode>;
export function createCustomMode(description:ILanguage): TPromise<IMode>;
export function colorize(text: string, modeId: string, options: IColorizerOptions): TPromise<string>;
export function colorize(text: string, modeId: string, options: IColorizerOptions): TPromise<string>;
export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): TPromise<void>;
export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): TPromise<void>;
export function colorizeLine(line: string, tokens: ViewLineToken[], tabSize?: number): string;
export function colorizeLine(line: string, tokens: ViewLineToken[], tabSize?: number): string;
export function colorizeModelLine(model: IModel, lineNumber: number, tabSize?: number): string;
export function colorizeModelLine(model: IModel, lineNumber: number, tabSize?: number): string;
export function registerWorkerParticipant(modeId:string, moduleName:string, ctorName:string): void;
export function registerWorkerParticipant(modeId:string, moduleName:string, ctorName:string): void;
export function configureMode(modeId: string, options: any): void;
export function configureMode(modeId: string, options: any): void;
export interface IColorizerOptions {
export interface IColorizerOptions {
tabSize?: number;
tabSize?: number;
}
}
...
@@ -36,48 +36,49 @@ declare module monaco.editor {
...
@@ -36,48 +36,49 @@ declare module monaco.editor {
declare module monaco {
declare module monaco {
interface Thenable<R> {
interface Thenable<R> {
/**
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
* @returns A Promise for the completion of which ever callback is executed.
*/
*/
then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => TResult | Thenable<TResult>): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
then<TResult>(onfulfilled?: (value: R) => TResult | Thenable<TResult>, onrejected?: (reason: any) => void): Thenable<TResult>;
}
}
export interface IDisposable {
dispose(): void;
}
export interface IDisposable
{
export interface IEvent<T>
{
dispose(): void
;
(listener: (e: T) => any, thisArg?: any): IDisposable
;
}
}
export interface IEvent<T> {
export class Emitter<T> {
(listener: (e: T) => any, thisArg?: any): IDisposable;
constructor();
}
event: IEvent<T>;
fire(event?: T): void;
dispose(): void;
}
export class Emitter<T> {
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise
constructor();
event: IEvent<T>;
fire(event?: T): void;
dispose(): void;
}
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise
#include(vs/base/common/uri): URI
#include(vs/base/common/uri): URI
#include(vs/base/common/eventEmitter): IEmitterEvent, ListenerCallback, IBulkListenerCallback, ListenerUnbind, IEventEmitter
#include(vs/base/common/eventEmitter): IEmitterEvent, ListenerCallback, IBulkListenerCallback, ListenerUnbind, IEventEmitter
#include(vs/base/common/keyCodes): KeyCode, KeyMod
#include(vs/base/common/keyCodes): KeyCode, KeyMod
#include(vs/base/common/htmlContent): IHTMLContentElementCode, IHTMLContentElement
#include(vs/base/common/htmlContent): IHTMLContentElementCode, IHTMLContentElement
#include(vs/base/common/actions): IAction
#include(vs/base/common/actions): IAction
#include(vs/base/browser/keyboardEvent): IKeyboardEvent
#include(vs/base/browser/keyboardEvent): IKeyboardEvent
#include(vs/base/browser/mouseEvent): IMouseEvent
#include(vs/base/browser/mouseEvent): IMouseEvent
export interface IPlatformServices {
export interface IPlatformServices {
}
}
export interface IInstantiationService {
export interface IInstantiationService {
...
@@ -95,21 +96,22 @@ declare module monaco {
...
@@ -95,21 +96,22 @@ declare module monaco {
declare module monaco.editor {
declare module monaco.editor {
#include(vs/editor/common/modes/monarch/monarchTypes): ILanguage, ILanguageBracket
#include(vs/editor/common/modes/monarch/monarchTypes): ILanguage, ILanguageBracket
#include(vs/editor/common/core/modeTransition): ModeTransition
#include(vs/editor/common/core/modeTransition): ModeTransition
#include(vs/editor/common/modes): IToken, IModeTransition, ILineContext
#include(vs/editor/common/modes): IToken, IModeTransition, ILineContext
export interface IMode {
export interface IMode {
}
}
#include(vs/base/browser/ui/scrollbar/scrollableElementOptions): ScrollbarVisibility
#include(vs/base/browser/ui/scrollbar/scrollableElementOptions): ScrollbarVisibility
#include(vs/editor/common/core/viewLineToken): ViewLineToken
#include(vs/editor/common/core/viewLineToken): ViewLineToken
#includeAll(vs/editor/common/editorCommon): KeyCode, KeyMod
#includeAll(vs/editor/common/editorCommon): KeyCode, KeyMod
#includeAll(vs/editor/browser/editorBrowser):
#includeAll(vs/editor/browser/editorBrowser):
}
}
\ No newline at end of file
build/lib/monaco.js
浏览文件 @
b9b39fd2
...
@@ -92,6 +92,52 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration) {
...
@@ -92,6 +92,52 @@ function getMassagedTopLevelDeclarationText(sourceFile, declaration) {
result
=
result
.
replace
(
/export declare/g
,
'
export
'
);
result
=
result
.
replace
(
/export declare/g
,
'
export
'
);
return
result
;
return
result
;
}
}
function
format
(
text
)
{
var
options
=
getDefaultOptions
();
// Parse the source text
var
sourceFile
=
ts
.
createSourceFile
(
'
file.ts
'
,
text
,
ts
.
ScriptTarget
.
Latest
,
/*setParentPointers*/
true
);
// Get the formatting edits on the input sources
var
edits
=
ts
.
formatting
.
formatDocument
(
sourceFile
,
getRuleProvider
(
options
),
options
);
// Apply the edits on the input code
return
applyEdits
(
text
,
edits
);
function
getRuleProvider
(
options
)
{
// Share this between multiple formatters using the same options.
// This represents the bulk of the space the formatter uses.
var
ruleProvider
=
new
ts
.
formatting
.
RulesProvider
();
ruleProvider
.
ensureUpToDate
(
options
);
return
ruleProvider
;
}
function
applyEdits
(
text
,
edits
)
{
// Apply edits in reverse on the existing text
var
result
=
text
;
for
(
var
i
=
edits
.
length
-
1
;
i
>=
0
;
i
--
)
{
var
change
=
edits
[
i
];
var
head
=
result
.
slice
(
0
,
change
.
span
.
start
);
var
tail
=
result
.
slice
(
change
.
span
.
start
+
change
.
span
.
length
);
result
=
head
+
change
.
newText
+
tail
;
}
return
result
;
}
function
getDefaultOptions
()
{
return
{
IndentSize
:
4
,
TabSize
:
4
,
NewLineCharacter
:
'
\r\n
'
,
ConvertTabsToSpaces
:
true
,
IndentStyle
:
ts
.
IndentStyle
.
Block
,
InsertSpaceAfterCommaDelimiter
:
true
,
InsertSpaceAfterSemicolonInForStatements
:
true
,
InsertSpaceBeforeAndAfterBinaryOperators
:
true
,
InsertSpaceAfterKeywordsInControlFlowStatements
:
true
,
InsertSpaceAfterFunctionKeywordForAnonymousFunctions
:
false
,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis
:
false
,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets
:
false
,
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces
:
true
,
PlaceOpenBraceOnNewLineForFunctions
:
false
,
PlaceOpenBraceOnNewLineForControlBlocks
:
false
,
};
}
}
var
recipe
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts.recipe
'
)).
toString
();
var
recipe
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts.recipe
'
)).
toString
();
var
lines
=
recipe
.
split
(
/
\r\n
|
\n
|
\r
/
);
var
lines
=
recipe
.
split
(
/
\r\n
|
\n
|
\r
/
);
var
result
=
[];
var
result
=
[];
...
@@ -131,4 +177,10 @@ lines.forEach(function (line) {
...
@@ -131,4 +177,10 @@ lines.forEach(function (line) {
}
}
result
.
push
(
line
);
result
.
push
(
line
);
});
});
fs
.
writeFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts
'
),
result
.
join
(
'
\n
'
).
replace
(
/
\b
editorCommon
\.
/g
,
''
).
replace
(
/
\b
Event</g
,
'
IEvent<
'
));
var
resultTxt
=
result
.
join
(
'
\n
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
editorCommon
\.
/g
,
''
);
resultTxt
=
resultTxt
.
replace
(
/
\b
Event</g
,
'
IEvent<
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
URI
\b
/g
,
'
Uri
'
);
resultTxt
=
format
(
resultTxt
);
resultTxt
=
resultTxt
.
replace
(
/
\r\n
/g
,
'
\n
'
);
fs
.
writeFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts
'
),
resultTxt
);
build/lib/monaco.ts
浏览文件 @
b9b39fd2
...
@@ -121,6 +121,59 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
...
@@ -121,6 +121,59 @@ function getMassagedTopLevelDeclarationText(sourceFile:ts.SourceFile, declaratio
return
result
;
return
result
;
}
}
function
format
(
text
:
string
):
string
{
let
options
=
getDefaultOptions
();
// Parse the source text
let
sourceFile
=
ts
.
createSourceFile
(
'
file.ts
'
,
text
,
ts
.
ScriptTarget
.
Latest
,
/*setParentPointers*/
true
);
// Get the formatting edits on the input sources
let
edits
=
(
<
any
>
ts
).
formatting
.
formatDocument
(
sourceFile
,
getRuleProvider
(
options
),
options
);
// Apply the edits on the input code
return
applyEdits
(
text
,
edits
);
function
getRuleProvider
(
options
:
ts
.
FormatCodeOptions
)
{
// Share this between multiple formatters using the same options.
// This represents the bulk of the space the formatter uses.
let
ruleProvider
=
new
(
<
any
>
ts
).
formatting
.
RulesProvider
();
ruleProvider
.
ensureUpToDate
(
options
);
return
ruleProvider
;
}
function
applyEdits
(
text
:
string
,
edits
:
ts
.
TextChange
[]):
string
{
// Apply edits in reverse on the existing text
let
result
=
text
;
for
(
let
i
=
edits
.
length
-
1
;
i
>=
0
;
i
--
)
{
let
change
=
edits
[
i
];
let
head
=
result
.
slice
(
0
,
change
.
span
.
start
);
let
tail
=
result
.
slice
(
change
.
span
.
start
+
change
.
span
.
length
)
result
=
head
+
change
.
newText
+
tail
;
}
return
result
;
}
function
getDefaultOptions
():
ts
.
FormatCodeOptions
{
return
{
IndentSize
:
4
,
TabSize
:
4
,
NewLineCharacter
:
'
\r\n
'
,
ConvertTabsToSpaces
:
true
,
IndentStyle
:
ts
.
IndentStyle
.
Block
,
InsertSpaceAfterCommaDelimiter
:
true
,
InsertSpaceAfterSemicolonInForStatements
:
true
,
InsertSpaceBeforeAndAfterBinaryOperators
:
true
,
InsertSpaceAfterKeywordsInControlFlowStatements
:
true
,
InsertSpaceAfterFunctionKeywordForAnonymousFunctions
:
false
,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis
:
false
,
InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets
:
false
,
InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces
:
true
,
PlaceOpenBraceOnNewLineForFunctions
:
false
,
PlaceOpenBraceOnNewLineForControlBlocks
:
false
,
};
}
}
var
recipe
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts.recipe
'
)).
toString
();
var
recipe
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts.recipe
'
)).
toString
();
var
lines
=
recipe
.
split
(
/
\r\n
|
\n
|
\r
/
);
var
lines
=
recipe
.
split
(
/
\r\n
|
\n
|
\r
/
);
...
@@ -169,4 +222,13 @@ lines.forEach(line => {
...
@@ -169,4 +222,13 @@ lines.forEach(line => {
result
.
push
(
line
);
result
.
push
(
line
);
});
});
fs
.
writeFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts
'
),
result
.
join
(
'
\n
'
).
replace
(
/
\b
editorCommon
\.
/g
,
''
).
replace
(
/
\b
Event</g
,
'
IEvent<
'
));
let
resultTxt
=
result
.
join
(
'
\n
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
editorCommon
\.
/g
,
''
);
resultTxt
=
resultTxt
.
replace
(
/
\b
Event</g
,
'
IEvent<
'
);
resultTxt
=
resultTxt
.
replace
(
/
\b
URI
\b
/g
,
'
Uri
'
);
resultTxt
=
format
(
resultTxt
);
resultTxt
=
resultTxt
.
replace
(
/
\r\n
/g
,
'
\n
'
);
fs
.
writeFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts
'
),
resultTxt
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录