Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
1c4e72aa
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,发现更多精彩内容 >>
提交
1c4e72aa
编写于
11月 23, 2016
作者:
M
Martin Aeschlimann
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
share TypeScipt node_module amongst extensions
上级
38c5406b
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
120 addition
and
64297 deletion
+120
-64297
build/npm/postinstall.js
build/npm/postinstall.js
+14
-10
extensions/extension-editing/npm-shrinkwrap.json
extensions/extension-editing/npm-shrinkwrap.json
+0
-5
extensions/extension-editing/package.json
extensions/extension-editing/package.json
+0
-4
extensions/html/server/src/modes/javascriptMode.ts
extensions/html/server/src/modes/javascriptMode.ts
+5
-10
extensions/html/server/src/modes/typescript/lib-ts.d.ts
extensions/html/server/src/modes/typescript/lib-ts.d.ts
+0
-6
extensions/html/server/src/modes/typescript/lib-ts.js
extensions/html/server/src/modes/typescript/lib-ts.js
+0
-9
extensions/html/server/src/modes/typescript/typescriptServices.d.ts
.../html/server/src/modes/typescript/typescriptServices.d.ts
+0
-2615
extensions/html/server/src/modes/typescript/typescriptServices.js
...ns/html/server/src/modes/typescript/typescriptServices.js
+0
-61638
extensions/html/server/src/test/javascriptMode.test.ts
extensions/html/server/src/test/javascriptMode.test.ts
+44
-0
extensions/npm-shrinkwrap.json
extensions/npm-shrinkwrap.json
+11
-0
extensions/package.json
extensions/package.json
+12
-0
extensions/postinstall.js
extensions/postinstall.js
+34
-0
未找到文件。
build/npm/postinstall.js
浏览文件 @
1c4e72aa
...
...
@@ -6,6 +6,19 @@
const
cp
=
require
(
'
child_process
'
);
const
npm
=
process
.
platform
===
'
win32
'
?
'
npm.cmd
'
:
'
npm
'
;
function
npmInstall
(
location
)
{
const
result
=
cp
.
spawnSync
(
npm
,
[
'
install
'
],
{
cwd
:
location
,
stdio
:
'
inherit
'
});
if
(
result
.
error
||
result
.
status
!==
0
)
{
process
.
exit
(
1
);
}
}
npmInstall
(
'
extensions
'
);
// node modules shared by all extensions
const
extensions
=
[
'
vscode-api-tests
'
,
'
vscode-colorize-tests
'
,
...
...
@@ -20,13 +33,4 @@ const extensions = [
'
html
'
];
extensions
.
forEach
(
extension
=>
{
const
result
=
cp
.
spawnSync
(
npm
,
[
'
install
'
],
{
cwd
:
`extensions/
${
extension
}
`
,
stdio
:
'
inherit
'
});
if
(
result
.
error
||
result
.
status
!==
0
)
{
process
.
exit
(
1
);
}
});
\ No newline at end of file
extensions
.
forEach
(
extension
=>
npmInstall
(
`extensions/
${
extension
}
`
));
\ No newline at end of file
extensions/extension-editing/npm-shrinkwrap.json
浏览文件 @
1c4e72aa
...
...
@@ -2,10 +2,5 @@
"name"
:
"extension-editing"
,
"version"
:
"0.0.1"
,
"dependencies"
:
{
"typescript"
:
{
"version"
:
"1.8.10"
,
"from"
:
"typescript@>=1.8.10 <2.0.0"
,
"resolved"
:
"https://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz"
}
}
}
extensions/extension-editing/package.json
浏览文件 @
1c4e72aa
...
...
@@ -13,13 +13,9 @@
],
"main"
:
"./out/extension"
,
"scripts"
:
{
"postinstall"
:
"node ./postinstall"
,
"compile"
:
"gulp compile-extension:extension-editing"
,
"watch"
:
"gulp watch-extension:extension-editing"
},
"dependencies"
:
{
"typescript"
:
"^1.8.10"
},
"contributes"
:
{
"jsonValidation"
:
[
{
...
...
extensions/html/server/src/modes/javascriptMode.ts
浏览文件 @
1c4e72aa
...
...
@@ -9,14 +9,9 @@ import { CompletionItem, Location, SignatureHelp, SignatureInformation, Paramete
import
{
LanguageMode
}
from
'
./languageModes
'
;
import
{
getWordAtText
}
from
'
../utils/words
'
;
import
ts
=
require
(
'
./typescript/typescriptServices
'
);
import
{
contents
as
libdts
}
from
'
./typescript/lib-ts
'
;
import
*
as
ts
from
'
typescript
'
;
const
DEFAULT_LIB
=
{
NAME
:
'
defaultLib:lib.d.ts
'
,
CONTENTS
:
libdts
};
const
FILE_NAME
=
'
typescript://singlefile/1
'
;
// the same 'file' is used for all contents
const
FILE_NAME
=
'
vscode://javascript/1
'
;
// the same 'file' is used for all contents
const
JS_WORD_REGEX
=
/
(
-
?\d
*
\.\d\w
*
)
|
([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]
+
)
/g
;
...
...
@@ -33,15 +28,15 @@ export function getJavascriptMode(jsDocuments: LanguageModelCache<TextDocument>)
return
'
1
'
;
// default lib is static
},
getScriptSnapshot
:
(
fileName
:
string
)
=>
{
let
text
=
fileName
===
FILE_NAME
?
currentTextDocument
.
getText
()
:
DEFAULT_LIB
.
CONTENTS
;
let
text
=
fileName
===
FILE_NAME
?
currentTextDocument
.
getText
()
:
ts
.
sys
.
readFile
(
fileName
)
;
return
{
getText
:
(
start
,
end
)
=>
text
.
substring
(
start
,
end
),
getLength
:
()
=>
text
.
length
,
getChangeRange
:
()
=>
void
0
};
},
getCurrentDirectory
:
()
=>
''
,
getDefaultLibFileName
:
options
=>
DEFAULT_LIB
.
NAME
getCurrentDirectory
:
()
=>
ts
.
sys
.
getCurrentDirectory
()
,
getDefaultLibFileName
:
(
options
)
=>
ts
.
getDefaultLibFilePath
(
options
)
};
let
jsLanguageService
=
ts
.
createLanguageService
(
host
);
...
...
extensions/html/server/src/modes/typescript/lib-ts.d.ts
已删除
100644 → 0
浏览文件 @
38c5406b
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
export
declare
var
contents
:
string
;
extensions/html/server/src/modes/typescript/lib-ts.js
已删除
100644 → 0
浏览文件 @
38c5406b
此差异已折叠。
点击以展开。
extensions/html/server/src/modes/typescript/typescriptServices.d.ts
已删除
100644 → 0
浏览文件 @
38c5406b
此差异已折叠。
点击以展开。
extensions/html/server/src/modes/typescript/typescriptServices.js
已删除
100644 → 0
浏览文件 @
38c5406b
此差异已折叠。
点击以展开。
extensions/html/server/src/test/javascriptMode.test.ts
0 → 100644
浏览文件 @
1c4e72aa
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
getJavascriptMode
}
from
'
../modes/javascriptMode
'
;
import
{
TextDocument
,
Range
,
TextEdit
,
FormattingOptions
}
from
'
vscode-languageserver-types
'
;
import
{
getLanguageModelCache
}
from
'
../languageModelCache
'
;
import
{
getLanguageService
}
from
'
vscode-html-languageservice
'
;
import
*
as
embeddedSupport
from
'
../modes/embeddedSupport
'
;
suite
(
'
HTML Javascript Support
'
,
()
=>
{
var
htmlLanguageService
=
getLanguageService
();
function
assertCompletions
(
value
:
string
,
expectedProposals
:
string
[]):
void
{
let
offset
=
value
.
indexOf
(
'
|
'
);
value
=
value
.
substr
(
0
,
offset
)
+
value
.
substr
(
offset
+
1
);
let
document
=
TextDocument
.
create
(
'
test://test/test.html
'
,
'
html
'
,
0
,
value
);
let
documentRegions
=
embeddedSupport
.
getDocumentRegions
(
htmlLanguageService
,
document
);
let
embeddedJSDocuments
=
getLanguageModelCache
<
TextDocument
>
(
10
,
60
,
document
=>
documentRegions
.
getEmbeddedDocument
(
'
javascript
'
));
var
mode
=
getJavascriptMode
(
embeddedJSDocuments
);
let
position
=
document
.
positionAt
(
offset
);
let
list
=
mode
.
doComplete
(
document
,
position
);
assert
.
ok
(
list
);
let
actualLabels
=
list
.
items
.
map
(
c
=>
c
.
label
).
sort
();
for
(
let
expected
of
expectedProposals
)
{
assert
.
ok
(
actualLabels
.
indexOf
(
expected
)
!==
-
1
,
'
Not found:
'
+
expected
+
'
is
'
+
actualLabels
.
join
(
'
,
'
));
}
}
test
(
'
Completions
'
,
function
():
any
{
assertCompletions
(
'
<html><script>window.|</script></html>
'
,
[
'
location
'
]);
});
});
\ No newline at end of file
extensions/npm-shrinkwrap.json
0 → 100644
浏览文件 @
1c4e72aa
{
"name"
:
"vscode-extensions"
,
"version"
:
"0.0.1"
,
"dependencies"
:
{
"typescript"
:
{
"version"
:
"2.0.10"
,
"from"
:
"typescript@>=2.0.10 <3.0.0"
,
"resolved"
:
"https://registry.npmjs.org/typescript/-/typescript-2.0.10.tgz"
}
}
}
extensions/package.json
0 → 100644
浏览文件 @
1c4e72aa
{
"name"
:
"vscode-extensions"
,
"version"
:
"0.0.1"
,
"private"
:
true
,
"description"
:
"Dependencies shared by all extensions"
,
"dependencies"
:
{
"typescript"
:
"^2.0.10"
},
"scripts"
:
{
"postinstall"
:
"node ./postinstall"
}
}
extensions/
extension-editing/
postinstall.js
→
extensions/postinstall.js
浏览文件 @
1c4e72aa
...
...
@@ -8,16 +8,27 @@
const
fs
=
require
(
'
fs
'
);
const
path
=
require
(
'
path
'
);
// delete unused typescript stuff
const
root
=
path
.
dirname
(
require
.
resolve
(
'
typescript
'
));
function
removeFile
(
filePath
)
{
try
{
fs
.
unlinkSync
(
filePath
);
console
.
log
(
`removed '
${
filePath
}
'`
);
}
catch
(
e
)
{
console
.
warn
(
e
);
}
}
for
(
let
name
of
fs
.
readdirSync
(
root
))
{
if
(
name
!==
'
typescript.d.ts
'
&&
name
!==
'
typescript.js
'
)
{
try
{
fs
.
unlinkSync
(
path
.
join
(
root
,
name
));
console
.
log
(
`removed '
${
path
.
join
(
root
,
name
)}
'`
);
}
catch
(
e
)
{
console
.
warn
(
e
);
}
// delete unused typescript stuff in lib folder
const
libPath
=
path
.
dirname
(
require
.
resolve
(
'
typescript
'
));
for
(
let
name
of
fs
.
readdirSync
(
libPath
))
{
if
(
name
!==
'
typescript.d.ts
'
&&
name
!==
'
typescript.js
'
&&
name
!==
'
lib.es6.d.ts
'
)
{
removeFile
(
path
.
join
(
libPath
,
name
));
}
}
// delete unused typescript stuff in bin folder
const
binPath
=
path
.
join
(
path
.
dirname
(
libPath
),
'
bin
'
);
for
(
let
name
of
fs
.
readdirSync
(
binPath
))
{
removeFile
(
path
.
join
(
binPath
,
name
));
}
removeFile
(
path
.
join
(
path
.
dirname
(
libPath
),
'
Gulpfile.ts
'
));
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录