提交 61feb91e 编写于 作者: A Alex Dima

Do not terminate link if `[` occurs in the authority section of URLs (allow for ipv6 authorities)

上级 bddb39d5
......@@ -205,7 +205,7 @@ class LinkComputer {
let resetStateMachine = false;
const chCode = line.charCodeAt(j);
if (state === State.Accept || state === State.End) {
if (state === State.Accept) {
let chClass: CharacterClass;
switch (chCode) {
case CharCode.OpenParen:
......@@ -245,9 +245,22 @@ class LinkComputer {
// Check if character terminates link
if (chClass === CharacterClass.ForceTermination) {
if (state === State.Accept) {
result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, j));
}
result.push(LinkComputer._createLink(classifier, line, i, linkBeginIndex, j));
resetStateMachine = true;
}
} else if (state === State.End) {
let chClass: CharacterClass;
if (chCode === CharCode.OpenSquareBracket) {
// Allow for the authority part to contain ipv6 addresses which contain [ and ]
hasOpenSquareBracket = true;
chClass = CharacterClass.None;
} else {
chClass = classifier.get(chCode);
}
// Check if character terminates link
if (chClass === CharacterClass.ForceTermination) {
resetStateMachine = true;
} else {
state = State.Accept;
......
......@@ -195,4 +195,11 @@ suite('Editor Modes - Link Computer', () => {
' https://msdn.microsoft.com/en-us/library/windows/desktop/ms687414(v=vs.85).aspx '
);
});
test('issue #62278: "Ctrl + click to follow link" for IPv6 URLs', () => {
assertLink(
'let x = "http://[::1]:5000/connect/token"',
' http://[::1]:5000/connect/token '
);
});
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册