Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
b02c4fac
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 搜索 >>
提交
b02c4fac
编写于
4月 28, 2016
作者:
A
Alex Dima
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixes #5362: MainThreadTextEditor: disassociate code editor as soon as code editor's model changes
上级
10ef60a0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
113 addition
and
3 deletion
+113
-3
build/gulpfile.hygiene.js
build/gulpfile.hygiene.js
+2
-1
extensions/vscode-api-tests/src/window.test.ts
extensions/vscode-api-tests/src/window.test.ts
+66
-2
extensions/vscode-api-tests/testWorkspace/10linefile.ts
extensions/vscode-api-tests/testWorkspace/10linefile.ts
+10
-0
extensions/vscode-api-tests/testWorkspace/30linefile.ts
extensions/vscode-api-tests/testWorkspace/30linefile.ts
+30
-0
src/vs/workbench/api/node/mainThreadEditors.ts
src/vs/workbench/api/node/mainThreadEditors.ts
+5
-0
未找到文件。
build/gulpfile.hygiene.js
浏览文件 @
b02c4fac
...
...
@@ -55,7 +55,8 @@ var indentationFilter = [
'
!extensions/**/snippets/**
'
,
'
!extensions/**/syntaxes/**
'
,
'
!extensions/**/themes/**
'
,
'
!extensions/**/colorize-fixtures/**
'
'
!extensions/**/colorize-fixtures/**
'
,
'
!extensions/vscode-api-tests/testWorkspace/**
'
];
var
copyrightFilter
=
[
...
...
extensions/vscode-api-tests/src/window.test.ts
浏览文件 @
b02c4fac
...
...
@@ -6,7 +6,7 @@
'
use strict
'
;
import
*
as
assert
from
'
assert
'
;
import
{
workspace
,
window
,
ViewColumn
,
TextEditorViewColumnChangeEvent
,
Uri
}
from
'
vscode
'
;
import
{
workspace
,
window
,
ViewColumn
,
TextEditorViewColumnChangeEvent
,
Uri
,
Selection
,
Position
}
from
'
vscode
'
;
import
{
join
}
from
'
path
'
;
import
{
cleanUp
,
pathEquals
}
from
'
./utils
'
;
...
...
@@ -82,4 +82,68 @@ suite('window namespace tests', () => {
});
});
});
});
\ No newline at end of file
test
(
'
issue #5362 - Incorrect TextEditor passed by onDidChangeTextEditorSelection
'
,
(
done
)
=>
{
const
file10Path
=
join
(
workspace
.
rootPath
,
'
./10linefile.ts
'
);
const
file30Path
=
join
(
workspace
.
rootPath
,
'
./30linefile.ts
'
);
let
finished
=
false
;
let
failOncePlease
=
(
err
:
Error
)
=>
{
if
(
finished
)
{
return
;
}
finished
=
true
;
done
(
err
);
};
let
passOncePlease
=
()
=>
{
if
(
finished
)
{
return
;
}
finished
=
true
;
done
(
null
);
};
let
subscription
=
window
.
onDidChangeTextEditorSelection
((
e
)
=>
{
let
lineCount
=
e
.
textEditor
.
document
.
lineCount
;
let
pos1
=
e
.
textEditor
.
selections
[
0
].
active
.
line
;
let
pos2
=
e
.
selections
[
0
].
active
.
line
;
if
(
pos1
!==
pos2
)
{
failOncePlease
(
new
Error
(
'
received invalid selection changed event!
'
));
return
;
}
if
(
pos1
>=
lineCount
)
{
failOncePlease
(
new
Error
(
`Cursor position (
${
pos1
}
) is not valid in the document
${
e
.
textEditor
.
document
.
fileName
}
that has
${
lineCount
}
lines.`
));
return
;
}
});
// Open 10 line file, show it in slot 1, set cursor to line 10
// Open 30 line file, show it in slot 1, set cursor to line 30
// Open 10 line file, show it in slot 1
// Open 30 line file, show it in slot 1
workspace
.
openTextDocument
(
file10Path
).
then
((
doc
)
=>
{
return
window
.
showTextDocument
(
doc
,
ViewColumn
.
One
);
}).
then
((
editor10line
)
=>
{
editor10line
.
selection
=
new
Selection
(
new
Position
(
9
,
0
),
new
Position
(
9
,
0
));
}).
then
(()
=>
{
return
workspace
.
openTextDocument
(
file30Path
);
}).
then
((
doc
)
=>
{
return
window
.
showTextDocument
(
doc
,
ViewColumn
.
One
);
}).
then
((
editor30line
)
=>
{
editor30line
.
selection
=
new
Selection
(
new
Position
(
29
,
0
),
new
Position
(
29
,
0
));
}).
then
(()
=>
{
return
workspace
.
openTextDocument
(
file10Path
);
}).
then
((
doc
)
=>
{
return
window
.
showTextDocument
(
doc
,
ViewColumn
.
One
);
}).
then
(()
=>
{
return
workspace
.
openTextDocument
(
file30Path
);
}).
then
((
doc
)
=>
{
return
window
.
showTextDocument
(
doc
,
ViewColumn
.
One
);
}).
then
(()
=>
{
subscription
.
dispose
();
}).
then
(
passOncePlease
,
failOncePlease
);
});
});
extensions/vscode-api-tests/testWorkspace/10linefile.ts
0 → 100644
浏览文件 @
b02c4fac
function
foo
():
void
{
var
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
}
\ No newline at end of file
extensions/vscode-api-tests/testWorkspace/30linefile.ts
0 → 100644
浏览文件 @
b02c4fac
function
bar
():
void
{
var
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
a
=
1
;
}
\ No newline at end of file
src/vs/workbench/api/node/mainThreadEditors.ts
浏览文件 @
b02c4fac
...
...
@@ -126,6 +126,11 @@ export class MainThreadTextEditor {
this
.
_codeEditor
=
codeEditor
;
if
(
this
.
_codeEditor
)
{
// Catch early the case that this code editor gets a different model set and disassociate from this model
this
.
_codeEditorListeners
.
push
(
this
.
_codeEditor
.
addListener2
(
EditorCommon
.
EventType
.
ModelChanged
,
()
=>
{
this
.
setCodeEditor
(
null
);
}));
let
forwardSelection
=
()
=>
{
this
.
_lastSelection
=
this
.
_codeEditor
.
getSelections
();
this
.
_onSelectionChanged
.
fire
(
this
.
_lastSelection
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录