Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
0519a269
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,发现更多精彩内容 >>
提交
0519a269
编写于
5月 20, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
First cut at monaco editor d.ts auto-generation
上级
9812161a
变更
6
展开全部
隐藏空白更改
内联
并排
Showing
6 changed file
with
4596 addition
and
0 deletion
+4596
-0
.vscode/launch.json
.vscode/launch.json
+15
-0
build/lib/monaco-editor.d.ts
build/lib/monaco-editor.d.ts
+4252
-0
build/lib/monaco-editor.d.ts.recipe
build/lib/monaco-editor.d.ts.recipe
+57
-0
build/lib/monaco.js
build/lib/monaco.js
+117
-0
build/lib/monaco.ts
build/lib/monaco.ts
+153
-0
gulpfile.js
gulpfile.js
+2
-0
未找到文件。
.vscode/launch.json
浏览文件 @
0519a269
...
...
@@ -74,6 +74,21 @@
"request"
:
"launch"
,
"program"
:
"${workspaceRoot}/src/vs/languages/css/common/buildscripts/generate_browserjs.js"
,
"stopOnEntry"
:
false
},
{
"name"
:
"Debug monaco"
,
"type"
:
"node"
,
"request"
:
"launch"
,
"program"
:
"${workspaceRoot}/build/lib/monaco.js"
,
"stopOnEntry"
:
false
,
"args"
:
[
],
"cwd"
:
"${workspaceRoot}/build/lib"
//
,
//
"port"
:
5870
,
//
"sourceMaps"
:
true
,
//
"outDir"
:
"${workspaceRoot}/out"
}
]
}
\ No newline at end of file
build/lib/monaco-editor.d.ts
0 → 100644
浏览文件 @
0519a269
此差异已折叠。
点击以展开。
build/lib/monaco-editor.d.ts.recipe
0 → 100644
浏览文件 @
0519a269
declare module monaco {
interface Thenable<R> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @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) => void): Thenable<TResult>;
}
export interface Event<T> {
(listener: (e: T) => any): IDisposable;
}
export class Emitter<T> {
constructor();
event: Event<T>;
fire(event?: T): void;
dispose(): void;
}
export interface IDisposable {
dispose(): void;
}
#include(vs/base/common/uri): URI
#include(vs/base/common/winjs.base.d.ts): TValueCallback, ProgressCallback, TPromise
}
declare module monaco.editor {
export function create(domElement: HTMLElement, options: IEditorConstructionOptions, services?: any): ICodeEditor;
export function createDiffEditor(domElement: HTMLElement, options: IDiffEditorConstructionOptions, services?: any): IDiffEditor;
export function createModel(value:string, mode:string|IMonarchLanguage|IMode, associatedResource?:any|string): IModel;
export function getOrCreateMode(modeId: string): TPromise<IMode>;
export function createCustomMode(description:IMonarchLanguage): TPromise<IMode>;
export function colorize(text: string, modeId: string, options: IColorizerOptions): TPromise<string>;
export function colorizeElement(domNode: HTMLElement, options: IColorizerElementOptions): TPromise<void>;
export function colorizeLine(line: string, tokens: Editor.ILineToken[], tabSize?: number): string;
export function colorizeModelLine(model: Editor.IModel, lineNumber: number, tabSize?: number): string;
export function registerWorkerParticipant(modeId:string, moduleName:string, ctorName:string): void;
export function configureMode(modeId: string, options: any): void;
#include(vs/base/browser/ui/scrollbar/scrollableElementOptions): ScrollbarVisibility
#include(vs/base/common/htmlContent): IHTMLContentElementCode, IHTMLContentElement
#include(vs/editor/common/modes): ILineContext, IMode, IModeTransition, IToken
#includeAll(vs/editor/common/editorCommon):
#includeAll(vs/editor/browser/editorBrowser):
}
\ No newline at end of file
build/lib/monaco.js
0 → 100644
浏览文件 @
0519a269
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"
use strict
"
;
// PREREQUISITE:
// SET VSCODE_BUILD_DECLARATION_FILES=1
// run gulp watch once
var
fs
=
require
(
'
fs
'
);
var
ts
=
require
(
'
typescript
'
);
var
path
=
require
(
'
path
'
);
var
SRC
=
path
.
join
(
__dirname
,
'
../../src
'
);
var
OUT
=
path
.
join
(
__dirname
,
'
../../out
'
);
function
moduleIdToPath
(
moduleId
)
{
if
(
/
\.
d
\.
ts/
.
test
(
moduleId
))
{
return
path
.
join
(
SRC
,
moduleId
);
}
return
path
.
join
(
OUT
,
moduleId
)
+
'
.d.ts
'
;
}
var
SOURCE_FILE_MAP
=
{};
function
getSourceFile
(
moduleId
)
{
if
(
!
SOURCE_FILE_MAP
[
moduleId
])
{
var
filePath
=
moduleIdToPath
(
moduleId
);
var
fileContents
=
fs
.
readFileSync
(
filePath
).
toString
();
var
sourceFile
=
ts
.
createSourceFile
(
filePath
,
fileContents
,
ts
.
ScriptTarget
.
ES5
);
SOURCE_FILE_MAP
[
moduleId
]
=
sourceFile
;
}
return
SOURCE_FILE_MAP
[
moduleId
];
}
function
visitTopLevelDeclarations
(
sourceFile
,
visitor
)
{
var
stop
=
false
;
var
visit
=
function
(
node
)
{
if
(
stop
)
{
return
;
}
switch
(
node
.
kind
)
{
case
ts
.
SyntaxKind
.
InterfaceDeclaration
:
case
ts
.
SyntaxKind
.
EnumDeclaration
:
case
ts
.
SyntaxKind
.
ClassDeclaration
:
stop
=
visitor
(
node
);
break
;
}
if
(
stop
)
{
return
;
}
ts
.
forEachChild
(
node
,
visit
);
};
visit
(
sourceFile
);
}
function
getAllTopLevelDeclarations
(
sourceFile
)
{
var
all
=
[];
visitTopLevelDeclarations
(
sourceFile
,
function
(
node
)
{
all
.
push
(
node
);
return
false
/*continue*/
;
});
return
all
;
}
function
getTopLevelDeclaration
(
sourceFile
,
typeName
)
{
var
result
=
null
;
visitTopLevelDeclarations
(
sourceFile
,
function
(
node
)
{
if
(
node
.
name
.
text
===
typeName
)
{
result
=
node
;
return
true
/*stop*/
;
}
return
false
/*continue*/
;
});
return
result
;
}
function
getNodeText
(
sourceFile
,
node
)
{
return
sourceFile
.
getFullText
().
substring
(
node
.
pos
,
node
.
end
);
}
function
getMassagedTopLevelDeclarationText
(
sourceFile
,
declaration
)
{
var
result
=
getNodeText
(
sourceFile
,
declaration
);
result
=
result
.
replace
(
/export default/g
,
'
export
'
);
result
=
result
.
replace
(
/export declare/g
,
'
export
'
);
return
result
;
}
var
recipe
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts.recipe
'
)).
toString
();
var
lines
=
recipe
.
split
(
/
\r\n
|
\n
|
\r
/
);
var
result
=
[];
lines
.
forEach
(
function
(
line
)
{
var
m1
=
line
.
match
(
/^
\s
*#include
\(([^\)]
*
)\)\:(
.*
)
$/
);
if
(
m1
)
{
var
moduleId
=
m1
[
1
];
var
sourceFile_1
=
getSourceFile
(
moduleId
);
var
typeNames
=
m1
[
2
].
split
(
/,/
);
typeNames
.
forEach
(
function
(
typeName
)
{
typeName
=
typeName
.
trim
();
if
(
typeName
.
length
===
0
)
{
return
;
}
var
declaration
=
getTopLevelDeclaration
(
sourceFile_1
,
typeName
);
result
.
push
(
getMassagedTopLevelDeclarationText
(
sourceFile_1
,
declaration
));
});
return
;
}
var
m2
=
line
.
match
(
/^
\s
*#includeAll
\(([^\)]
*
)\)\:(
.*
)
$/
);
if
(
m2
)
{
var
moduleId
=
m2
[
1
];
var
sourceFile_2
=
getSourceFile
(
moduleId
);
var
typeNames
=
m2
[
2
].
split
(
/,/
);
var
typesToExclude_1
=
{};
typeNames
.
forEach
(
function
(
typeName
)
{
typeName
=
typeName
.
trim
();
if
(
typeName
.
length
===
0
)
{
return
;
}
typesToExclude_1
[
typeName
]
=
true
;
});
getAllTopLevelDeclarations
(
sourceFile_2
).
forEach
(
function
(
declaration
)
{
result
.
push
(
getMassagedTopLevelDeclarationText
(
sourceFile_2
,
declaration
));
});
return
;
}
result
.
push
(
line
);
});
fs
.
writeFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts
'
),
result
.
join
(
'
\n
'
));
build/lib/monaco.ts
0 → 100644
浏览文件 @
0519a269
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
// PREREQUISITE:
// SET VSCODE_BUILD_DECLARATION_FILES=1
// run gulp watch once
import
fs
=
require
(
'
fs
'
);
import
ts
=
require
(
'
typescript
'
);
import
path
=
require
(
'
path
'
);
const
SRC
=
path
.
join
(
__dirname
,
'
../../src
'
);
const
OUT
=
path
.
join
(
__dirname
,
'
../../out
'
);
function
moduleIdToPath
(
moduleId
:
string
):
string
{
if
(
/
\.
d
\.
ts/
.
test
(
moduleId
))
{
return
path
.
join
(
SRC
,
moduleId
);
}
return
path
.
join
(
OUT
,
moduleId
)
+
'
.d.ts
'
;
}
var
SOURCE_FILE_MAP
:
{[
moduleId
:
string
]:
ts
.
SourceFile
;}
=
{};
function
getSourceFile
(
moduleId
:
string
):
ts
.
SourceFile
{
if
(
!
SOURCE_FILE_MAP
[
moduleId
])
{
let
filePath
=
moduleIdToPath
(
moduleId
);
let
fileContents
=
fs
.
readFileSync
(
filePath
).
toString
();
let
sourceFile
=
ts
.
createSourceFile
(
filePath
,
fileContents
,
ts
.
ScriptTarget
.
ES5
);
SOURCE_FILE_MAP
[
moduleId
]
=
sourceFile
;
}
return
SOURCE_FILE_MAP
[
moduleId
];
}
type
TypeScriptTypeDeclaration
=
ts
.
InterfaceDeclaration
|
ts
.
EnumDeclaration
|
ts
.
ClassDeclaration
;
function
visitTopLevelDeclarations
(
sourceFile
:
ts
.
SourceFile
,
visitor
:(
node
:
TypeScriptTypeDeclaration
)
=>
boolean
):
void
{
let
stop
=
false
;
let
visit
=
(
node
:
ts
.
Node
):
void
=>
{
if
(
stop
)
{
return
;
}
switch
(
node
.
kind
)
{
case
ts
.
SyntaxKind
.
InterfaceDeclaration
:
case
ts
.
SyntaxKind
.
EnumDeclaration
:
case
ts
.
SyntaxKind
.
ClassDeclaration
:
stop
=
visitor
(
<
TypeScriptTypeDeclaration
>
node
);
break
;
}
if
(
stop
)
{
return
;
}
ts
.
forEachChild
(
node
,
visit
);
};
visit
(
sourceFile
);
}
function
getAllTopLevelDeclarations
(
sourceFile
:
ts
.
SourceFile
):
TypeScriptTypeDeclaration
[]
{
let
all
:
TypeScriptTypeDeclaration
[]
=
[];
visitTopLevelDeclarations
(
sourceFile
,
(
node
)
=>
{
all
.
push
(
node
);
return
false
/*continue*/
;
});
return
all
;
}
function
getTopLevelDeclaration
(
sourceFile
:
ts
.
SourceFile
,
typeName
:
string
):
TypeScriptTypeDeclaration
{
let
result
:
TypeScriptTypeDeclaration
=
null
;
visitTopLevelDeclarations
(
sourceFile
,
(
node
)
=>
{
if
(
node
.
name
.
text
===
typeName
)
{
result
=
node
;
return
true
/*stop*/
;
}
return
false
/*continue*/
;
});
return
result
;
}
function
getNodeText
(
sourceFile
:
ts
.
SourceFile
,
node
:
ts
.
Node
):
string
{
return
sourceFile
.
getFullText
().
substring
(
node
.
pos
,
node
.
end
);
}
function
getMassagedTopLevelDeclarationText
(
sourceFile
:
ts
.
SourceFile
,
declaration
:
TypeScriptTypeDeclaration
):
string
{
let
result
=
getNodeText
(
sourceFile
,
declaration
);
result
=
result
.
replace
(
/export default/g
,
'
export
'
);
result
=
result
.
replace
(
/export declare/g
,
'
export
'
);
return
result
;
}
var
recipe
=
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts.recipe
'
)).
toString
();
var
lines
=
recipe
.
split
(
/
\r\n
|
\n
|
\r
/
);
var
result
=
[];
lines
.
forEach
(
line
=>
{
let
m1
=
line
.
match
(
/^
\s
*#include
\(([^\)]
*
)\)\:(
.*
)
$/
);
if
(
m1
)
{
let
moduleId
=
m1
[
1
];
let
sourceFile
=
getSourceFile
(
moduleId
);
let
typeNames
=
m1
[
2
].
split
(
/,/
);
typeNames
.
forEach
((
typeName
)
=>
{
typeName
=
typeName
.
trim
();
if
(
typeName
.
length
===
0
)
{
return
;
}
let
declaration
=
getTopLevelDeclaration
(
sourceFile
,
typeName
);
result
.
push
(
getMassagedTopLevelDeclarationText
(
sourceFile
,
declaration
));
});
return
;
}
let
m2
=
line
.
match
(
/^
\s
*#includeAll
\(([^\)]
*
)\)\:(
.*
)
$/
);
if
(
m2
)
{
let
moduleId
=
m2
[
1
];
let
sourceFile
=
getSourceFile
(
moduleId
);
let
typeNames
=
m2
[
2
].
split
(
/,/
);
let
typesToExclude
:
{[
typeName
:
string
]:
boolean
;}
=
{};
typeNames
.
forEach
((
typeName
)
=>
{
typeName
=
typeName
.
trim
();
if
(
typeName
.
length
===
0
)
{
return
;
}
typesToExclude
[
typeName
]
=
true
;
});
getAllTopLevelDeclarations
(
sourceFile
).
forEach
((
declaration
)
=>
{
result
.
push
(
getMassagedTopLevelDeclarationText
(
sourceFile
,
declaration
));
});
return
;
}
result
.
push
(
line
);
});
fs
.
writeFileSync
(
path
.
join
(
__dirname
,
'
./monaco-editor.d.ts
'
),
result
.
join
(
'
\n
'
));
gulpfile.js
浏览文件 @
0519a269
...
...
@@ -25,10 +25,12 @@ var sourcemaps = require('gulp-sourcemaps');
var
_
=
require
(
'
underscore
'
);
var
assign
=
require
(
'
object-assign
'
);
var
quiet
=
!!
process
.
env
[
'
VSCODE_BUILD_QUIET
'
];
var
declaration
=
!!
proces
.
env
[
'
VSCODE_BUILD_DECLARATION_FILES
'
];
var
rootDir
=
path
.
join
(
__dirname
,
'
src
'
);
var
tsOptions
=
{
target
:
'
ES5
'
,
declaration
:
declaration
,
module
:
'
amd
'
,
verbose
:
!
quiet
,
preserveConstEnums
:
true
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录