Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
5a569ad3
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,发现更多精彩内容 >>
提交
5a569ad3
编写于
11月 06, 2019
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
yarn web - do not have root in memfs
上级
4d44cfa7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
30 addition
and
29 deletion
+30
-29
extensions/vscode-api-tests/src/extension.ts
extensions/vscode-api-tests/src/extension.ts
+29
-28
scripts/code-web.js
scripts/code-web.js
+1
-1
未找到文件。
extensions/vscode-api-tests/src/extension.ts
浏览文件 @
5a569ad3
...
...
@@ -23,41 +23,43 @@ export function activate(context: vscode.ExtensionContext) {
enableSearch
(
context
,
memFs
);
enableTasks
();
vscode
.
commands
.
executeCommand
(
'
vscode.open
'
,
vscode
.
Uri
.
parse
(
`memfs:/large.ts`
));
vscode
.
commands
.
executeCommand
(
'
vscode.open
'
,
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
large.ts`
));
}
function
enableFs
(
context
:
vscode
.
ExtensionContext
):
MemFS
{
const
memFs
=
new
MemFS
();
context
.
subscriptions
.
push
(
vscode
.
workspace
.
registerFileSystemProvider
(
SCHEME
,
memFs
,
{
isCaseSensitive
:
true
}));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/sample-folder/`
));
// most common files types
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/large.ts`
),
textEncoder
.
encode
(
getLargeTSFile
()),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.txt`
),
textEncoder
.
encode
(
'
foo
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.html`
),
textEncoder
.
encode
(
'
<html><body><h1 class="hd">Hello</h1></body></html>
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.js`
),
textEncoder
.
encode
(
'
console.log("JavaScript")
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.json`
),
textEncoder
.
encode
(
'
{ "json": true }
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.ts`
),
textEncoder
.
encode
(
'
console.log("TypeScript")
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.css`
),
textEncoder
.
encode
(
'
* { color: green; }
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.md`
),
textEncoder
.
encode
(
'
Hello _World_
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.xml`
),
textEncoder
.
encode
(
'
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.py`
),
textEncoder
.
encode
(
'
import base64, sys; base64.decode(open(sys.argv[1], "rb"), open(sys.argv[2], "wb"))
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.php`
),
textEncoder
.
encode
(
'
<?php echo shell_exec($_GET[
\'
e
\'
].
\'
2>&1
\'
); ?>
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/file.yaml`
),
textEncoder
.
encode
(
'
- just: write something
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
large.ts`
),
textEncoder
.
encode
(
getLargeTSFile
()),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.txt`
),
textEncoder
.
encode
(
'
foo
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.html`
),
textEncoder
.
encode
(
'
<html><body><h1 class="hd">Hello</h1></body></html>
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.js`
),
textEncoder
.
encode
(
'
console.log("JavaScript")
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.json`
),
textEncoder
.
encode
(
'
{ "json": true }
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.ts`
),
textEncoder
.
encode
(
'
console.log("TypeScript")
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.css`
),
textEncoder
.
encode
(
'
* { color: green; }
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.md`
),
textEncoder
.
encode
(
'
Hello _World_
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.xml`
),
textEncoder
.
encode
(
'
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.py`
),
textEncoder
.
encode
(
'
import base64, sys; base64.decode(open(sys.argv[1], "rb"), open(sys.argv[2], "wb"))
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.php`
),
textEncoder
.
encode
(
'
<?php echo shell_exec($_GET[
\'
e
\'
].
\'
2>&1
\'
); ?>
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
file.yaml`
),
textEncoder
.
encode
(
'
- just: write something
'
),
{
create
:
true
,
overwrite
:
true
});
// some more files & folders
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/folder/`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/large/`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/xyz/`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/xyz/abc`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/xyz/def`
));
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/folder/empty.txt`
),
new
Uint8Array
(
0
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/folder/empty.foo`
),
new
Uint8Array
(
0
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/folder/file.ts`
),
textEncoder
.
encode
(
'
let a:number = true; console.log(a);
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/large/rnd.foo`
),
randomData
(
50000
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/xyz/UPPER.txt`
),
textEncoder
.
encode
(
'
UPPER
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/xyz/upper.txt`
),
textEncoder
.
encode
(
'
upper
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/xyz/def/foo.md`
),
textEncoder
.
encode
(
'
*MemFS*
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
folder/`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
large/`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
xyz/`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
xyz/abc`
));
memFs
.
createDirectory
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
xyz/def`
));
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
folder/empty.txt`
),
new
Uint8Array
(
0
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
folder/empty.foo`
),
new
Uint8Array
(
0
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
folder/file.ts`
),
textEncoder
.
encode
(
'
let a:number = true; console.log(a);
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
large/rnd.foo`
),
randomData
(
50000
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
xyz/UPPER.txt`
),
textEncoder
.
encode
(
'
UPPER
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
xyz/upper.txt`
),
textEncoder
.
encode
(
'
upper
'
),
{
create
:
true
,
overwrite
:
true
});
memFs
.
writeFile
(
vscode
.
Uri
.
parse
(
`memfs:/
sample-folder/
xyz/def/foo.md`
),
textEncoder
.
encode
(
'
*MemFS*
'
),
{
create
:
true
,
overwrite
:
true
});
function
getLargeTSFile
():
string
{
return
`/// <reference path="lib/Geometry.ts"/>
...
...
@@ -314,7 +316,6 @@ module Mankala {
`
;
}
return
memFs
;
}
...
...
@@ -547,7 +548,7 @@ export type Entry = File | Directory;
export
class
MemFS
implements
vscode
.
FileSystemProvider
,
vscode
.
FileSearchProvider
{
root
=
new
Directory
(
vscode
.
Uri
.
parse
(
`memfs:/`
),
''
);
root
=
new
Directory
(
vscode
.
Uri
.
parse
(
'
memfs:/
'
),
''
);
// --- manage file metadata
...
...
scripts/code-web.js
浏览文件 @
5a569ad3
...
...
@@ -132,7 +132,7 @@ async function handleRoot(req, res) {
const
data
=
(
await
util
.
promisify
(
fs
.
readFile
)(
WEB_MAIN
)).
toString
()
.
replace
(
'
{{WORKBENCH_WEB_CONFIGURATION}}
'
,
escapeAttribute
(
JSON
.
stringify
({
staticExtensions
,
folderUri
:
{
scheme
:
'
memfs
'
,
path
:
`/`
}
folderUri
:
{
scheme
:
'
memfs
'
,
path
:
`/
sample-folder
`
}
})))
.
replace
(
'
{{WEBVIEW_ENDPOINT}}
'
,
''
)
.
replace
(
'
{{REMOTE_USER_DATA_URI}}
'
,
''
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录