Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
18ec9f07
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,体验更适合开发者的 AI 搜索 >>
提交
18ec9f07
编写于
12月 11, 2020
作者:
R
Raymond Zhao
提交者:
GitHub
12月 11, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
DO NOT MERGE
上级
79557ebb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
172 addition
and
6 deletion
+172
-6
extensions/emmet/src/emmetCommon.ts
extensions/emmet/src/emmetCommon.ts
+1
-1
extensions/emmet/src/updateTag.ts
extensions/emmet/src/updateTag.ts
+1
-0
extensions/emmet/src/updateTagButNewer.ts
extensions/emmet/src/updateTagButNewer.ts
+65
-0
scripts/test-emmet.sh
scripts/test-emmet.sh
+104
-0
yarn.lock
yarn.lock
+1
-5
未找到文件。
extensions/emmet/src/emmetCommon.ts
浏览文件 @
18ec9f07
...
...
@@ -7,7 +7,7 @@ import * as vscode from 'vscode';
import
{
DefaultCompletionItemProvider
}
from
'
./defaultCompletionProvider
'
;
import
{
expandEmmetAbbreviation
,
wrapWithAbbreviation
,
wrapIndividualLinesWithAbbreviation
}
from
'
./abbreviationActions
'
;
import
{
removeTag
}
from
'
./removeTag
'
;
import
{
updateTag
}
from
'
./updateTag
'
;
import
{
updateTag
}
from
'
./updateTag
ButNewer
'
;
import
{
matchTag
}
from
'
./matchTag
'
;
import
{
balanceOut
,
balanceIn
}
from
'
./balance
'
;
import
{
splitJoinTag
}
from
'
./splitJoinTag
'
;
...
...
extensions/emmet/src/updateTag.ts
浏览文件 @
18ec9f07
...
...
@@ -44,6 +44,7 @@ function getRangesToUpdate(editor: vscode.TextEditor, selection: vscode.Selectio
let
closeEnd
=
nodeToUpdate
.
close
.
end
.
translate
(
0
,
-
1
);
ranges
.
push
(
new
vscode
.
Range
(
closeStart
,
closeEnd
));
}
console
.
log
(
ranges
);
return
ranges
;
}
...
...
extensions/emmet/src/updateTagButNewer.ts
0 → 100644
浏览文件 @
18ec9f07
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import
*
as
vscode
from
'
vscode
'
;
import
{
toLSTextDocument
,
validate
}
from
'
./util
'
;
import
{
getLanguageService
,
TextDocument
as
LSTextDocument
,
Node
as
LSNode
}
from
'
vscode-html-languageservice
'
;
const
languageService
=
getLanguageService
();
export
function
updateTag
(
tagName
:
string
):
Thenable
<
boolean
>
|
undefined
{
if
(
!
validate
(
false
)
||
!
vscode
.
window
.
activeTextEditor
)
{
return
;
}
const
editor
=
vscode
.
window
.
activeTextEditor
;
// multicursor support
const
rangesToUpdate
=
editor
.
selections
.
reverse
()
.
reduce
<
vscode
.
Range
[]
>
((
prev
,
selection
)
=>
prev
.
concat
(
getRangesToUpdate
(
editor
,
selection
)),
[]);
return
editor
.
edit
(
editBuilder
=>
{
rangesToUpdate
.
forEach
(
range
=>
{
editBuilder
.
replace
(
range
,
tagName
);
});
});
}
function
getPositionFromOffset
(
offset
:
number
|
undefined
,
document
:
LSTextDocument
):
vscode
.
Position
|
undefined
{
if
(
!
offset
)
{
return
undefined
;
}
const
pos
=
document
.
positionAt
(
offset
);
const
vspos
=
new
vscode
.
Position
(
pos
.
line
,
pos
.
character
);
return
vspos
;
}
function
getRangesFromNode
(
node
:
LSNode
,
document
:
LSTextDocument
):
vscode
.
Range
[]
{
const
start
=
getPositionFromOffset
(
node
.
start
,
document
);
const
startTagEnd
=
getPositionFromOffset
(
node
.
startTagEnd
,
document
);
const
end
=
getPositionFromOffset
(
node
.
end
,
document
);
const
endTagStart
=
getPositionFromOffset
(
node
.
endTagStart
,
document
);
let
ranges
:
vscode
.
Range
[]
=
[];
if
(
startTagEnd
)
{
ranges
.
push
(
new
vscode
.
Range
(
start
!
.
translate
(
0
,
1
),
start
!
.
translate
(
0
,
1
).
translate
(
0
,
node
?.
tag
?.
length
??
0
)));
}
if
(
endTagStart
)
{
ranges
.
push
(
new
vscode
.
Range
(
endTagStart
.
translate
(
0
,
2
),
end
!
.
translate
(
0
,
-
1
)));
}
return
ranges
;
}
function
getRangesToUpdate
(
editor
:
vscode
.
TextEditor
,
selection
:
vscode
.
Selection
):
vscode
.
Range
[]
{
const
document
=
toLSTextDocument
(
editor
.
document
);
const
parsedDocument
=
languageService
.
parseHTMLDocument
(
document
);
const
selectionStartOffset
=
document
.
offsetAt
(
selection
.
start
);
const
nodeToUpdate
:
any
=
parsedDocument
.
findNodeAt
(
selectionStartOffset
);
const
ranges
=
getRangesFromNode
(
nodeToUpdate
,
document
);
console
.
log
(
ranges
);
return
ranges
;
}
scripts/test-emmet.sh
0 → 100755
浏览文件 @
18ec9f07
#!/usr/bin/env bash
set
-e
if
[[
"
$OSTYPE
"
==
"darwin"
*
]]
;
then
realpath
()
{
[[
$1
=
/
*
]]
&&
echo
"
$1
"
||
echo
"
$PWD
/
${
1
#./
}
"
;
}
ROOT
=
$(
dirname
$(
dirname
$(
realpath
"
$0
"
)))
else
ROOT
=
$(
dirname
$(
dirname
$(
readlink
-f
$0
)))
# Electron 6 introduces a chrome-sandbox that requires root to run. This can fail. Disable sandbox via --no-sandbox.
LINUX_EXTRA_ARGS
=
"--no-sandbox"
fi
VSCODEUSERDATADIR
=
`
mktemp
-d
2>/dev/null
`
VSCODECRASHDIR
=
$ROOT
/.build/crashes
cd
$ROOT
# Figure out which Electron to use for running tests
if
[
-z
"
$INTEGRATION_TEST_ELECTRON_PATH
"
]
then
# Run out of sources: no need to compile as code.sh takes care of it
INTEGRATION_TEST_ELECTRON_PATH
=
"./scripts/code.sh"
echo
"Storing crash reports into '
$VSCODECRASHDIR
'."
echo
"Running integration tests out of sources."
else
# Run from a built: need to compile all test extensions
# because we run extension tests from their source folders
# and the build bundles extensions into .build webpacked
yarn gulp compile-extension:vscode-api-tests
\
compile-extension:vscode-colorize-tests
\
compile-extension:vscode-custom-editor-tests
\
compile-extension:vscode-notebook-tests
\
compile-extension:markdown-language-features
\
compile-extension:typescript-language-features
\
compile-extension:emmet
\
compile-extension:css-language-features-server
\
compile-extension:html-language-features-server
\
compile-extension:json-language-features-server
\
compile-extension:git
# Configuration for more verbose output
export
VSCODE_CLI
=
1
export
ELECTRON_ENABLE_STACK_DUMPING
=
1
export
ELECTRON_ENABLE_LOGGING
=
1
# Production builds are run on docker containers where size of /dev/shm partition < 64MB which causes OOM failure
# for chromium compositor that uses the partition for shared memory
if
[
"
$LINUX_EXTRA_ARGS
"
]
then
LINUX_EXTRA_ARGS
=
"
$LINUX_EXTRA_ARGS
--disable-dev-shm-usage --use-gl=swiftshader"
fi
echo
"Storing crash reports into '
$VSCODECRASHDIR
'."
echo
"Running integration tests with '
$INTEGRATION_TEST_ELECTRON_PATH
' as build."
fi
if
[
-z
"
$INTEGRATION_TEST_APP_NAME
"
]
;
then
after_suite
()
{
true
;
}
else
after_suite
()
{
killall
$INTEGRATION_TEST_APP_NAME
||
true
;
}
fi
# Integration tests in AMD
./scripts/test.sh
--runGlob
**
/
*
.integrationTest.js
"
$@
"
after_suite
# Tests in the extension host
# "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-api-tests/testWorkspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# after_suite
"
$INTEGRATION_TEST_ELECTRON_PATH
"
$LINUX_EXTRA_ARGS
$ROOT
/extensions/emmet/out/test/test-fixtures
--extensionDevelopmentPath
=
$ROOT
/extensions/emmet
--extensionTestsPath
=
$ROOT
/extensions/emmet/out/test
--disable-telemetry
--crash-reporter-directory
=
$VSCODECRASHDIR
--no-cached-data
--disable-updates
--disable-extensions
--user-data-dir
=
$VSCODEUSERDATADIR
after_suite
# # TODO(deepak1556): Disable workspace test temporarily
# # https://github.com/microsoft/vscode/issues/111288
# #"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --enable-proposed-api=vscode.vscode-api-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# #after_suite
# "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# after_suite
# "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/markdown-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# after_suite
# #"$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/typescript-language-features/test-workspace --extensionDevelopmentPath=$ROOT/extensions/typescript-language-features --extensionTestsPath=$ROOT/extensions/typescript-language-features/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# # after_suite
# "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/emmet/out/test/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# after_suite
# "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $(mktemp -d 2>/dev/null) --enable-proposed-api=vscode.git --extensionDevelopmentPath=$ROOT/extensions/git --extensionTestsPath=$ROOT/extensions/git/out/test --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# after_suite
# "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_EXTRA_ARGS $ROOT/extensions/vscode-notebook-tests/test --enable-proposed-api=vscode.vscode-notebook-tests --extensionDevelopmentPath=$ROOT/extensions/vscode-notebook-tests --extensionTestsPath=$ROOT/extensions/vscode-notebook-tests/out/ --disable-telemetry --crash-reporter-directory=$VSCODECRASHDIR --no-cached-data --disable-updates --disable-extensions --user-data-dir=$VSCODEUSERDATADIR
# after_suite
# Tests in commonJS (CSS, HTML)
cd
$ROOT
/extensions/css-language-features/server
&&
$ROOT
/scripts/node-electron.sh
test
/index.js
after_suite
cd
$ROOT
/extensions/html-language-features/server
&&
$ROOT
/scripts/node-electron.sh
test
/index.js
after_suite
rm
-rf
$VSCODEUSERDATADIR
yarn.lock
浏览文件 @
18ec9f07
...
...
@@ -9525,6 +9525,7 @@ tsec@googleinterns/tsec#630b53fe2b23815c28dd219119cc98dbd59e29b2:
resolved "https://codeload.github.com/googleinterns/tsec/tar.gz/630b53fe2b23815c28dd219119cc98dbd59e29b2"
dependencies:
"@types/node" "^13.13.5"
typescript "^3.9.2"
tslib@^1.8.1, tslib@^1.9.0:
version "1.9.3"
...
...
@@ -9608,11 +9609,6 @@ typescript@^2.6.2:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.6.2.tgz#3c5b6fd7f6de0914269027f03c0946758f7673a4"
integrity sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q=
typescript@^3.9.2:
version "3.9.7"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
uc.micro@^1.0.1, uc.micro@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.3.tgz#7ed50d5e0f9a9fb0a573379259f2a77458d50192"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录