Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
d0b77851
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,发现更多精彩内容 >>
提交
d0b77851
编写于
8月 16, 2016
作者:
J
Johannes Rieken
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
align names of CompletionItem and ISuggestion
上级
cafe4a99
变更
12
显示空白变更内容
内联
并排
Showing
12 changed file
with
46 addition
and
46 deletion
+46
-46
src/vs/editor/browser/standalone/standaloneLanguages.ts
src/vs/editor/browser/standalone/standaloneLanguages.ts
+4
-4
src/vs/editor/common/modes.ts
src/vs/editor/common/modes.ts
+3
-3
src/vs/editor/common/modes/snippetsRegistry.ts
src/vs/editor/common/modes/snippetsRegistry.ts
+2
-2
src/vs/editor/common/services/editorSimpleWorker.ts
src/vs/editor/common/services/editorSimpleWorker.ts
+1
-1
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
+11
-11
src/vs/editor/contrib/suggest/common/suggestModel.ts
src/vs/editor/contrib/suggest/common/suggestModel.ts
+1
-1
src/vs/editor/contrib/suggest/test/common/suggest.test.ts
src/vs/editor/contrib/suggest/test/common/suggest.test.ts
+3
-3
src/vs/languages/html/common/htmlWorker.ts
src/vs/languages/html/common/htmlWorker.ts
+8
-8
src/vs/languages/html/test/common/html-worker.test.ts
src/vs/languages/html/test/common/html-worker.test.ts
+1
-1
src/vs/workbench/api/node/extHostLanguageFeatures.ts
src/vs/workbench/api/node/extHostLanguageFeatures.ts
+1
-1
src/vs/workbench/api/node/extHostTypeConverters.ts
src/vs/workbench/api/node/extHostTypeConverters.ts
+7
-7
src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts
...s/workbench/test/node/api/extHostLanguageFeatures.test.ts
+4
-4
未找到文件。
src/vs/editor/browser/standalone/standaloneLanguages.ts
浏览文件 @
d0b77851
...
...
@@ -386,10 +386,10 @@ class SuggestAdapter {
return
{
_actual
:
item
,
label
:
item
.
label
,
codeSnippe
t
:
item
.
insertText
||
item
.
label
,
insertTex
t
:
item
.
insertText
||
item
.
label
,
type
:
convertKind
(
item
.
kind
),
typeLabe
l
:
item
.
detail
,
documentation
Label
:
item
.
documentation
,
detai
l
:
item
.
detail
,
documentation
:
item
.
documentation
,
sortText
:
item
.
sortText
,
filterText
:
item
.
filterText
};
...
...
@@ -444,7 +444,7 @@ class SuggestAdapter {
// insert the text of the edit and create a dedicated
// suggestion-container with overwrite[Before|After]
suggestion
.
codeSnippe
t
=
item
.
textEdit
.
text
;
suggestion
.
insertTex
t
=
item
.
textEdit
.
text
;
suggestion
.
overwriteBefore
=
position
.
column
-
editRange
.
startColumn
;
suggestion
.
overwriteAfter
=
editRange
.
endColumn
-
position
.
column
;
}
else
{
...
...
src/vs/editor/common/modes.ts
浏览文件 @
d0b77851
...
...
@@ -358,10 +358,10 @@ export type SuggestionType = 'method'
*/
export
interface
ISuggestion
{
label
:
string
;
codeSnippe
t
:
string
;
insertTex
t
:
string
;
type
:
SuggestionType
;
typeLabe
l
?:
string
;
documentation
Label
?:
string
;
detai
l
?:
string
;
documentation
?:
string
;
filterText
?:
string
;
sortText
?:
string
;
noAutoAccept
?:
boolean
;
...
...
src/vs/editor/common/modes/snippetsRegistry.ts
浏览文件 @
d0b77851
...
...
@@ -92,8 +92,8 @@ class SnippetsRegistry {
result
.
push
({
type
:
'
snippet
'
,
label
:
s
.
prefix
,
documentation
Label
:
s
.
description
,
codeSnippe
t
:
s
.
codeSnippet
,
documentation
:
s
.
description
,
insertTex
t
:
s
.
codeSnippet
,
noAutoAccept
:
true
,
overwriteBefore
});
...
...
src/vs/editor/common/services/editorSimpleWorker.ts
浏览文件 @
d0b77851
...
...
@@ -264,7 +264,7 @@ export abstract class BaseEditorSimpleWorker {
return
<
ISuggestion
>
{
type
:
'
text
'
,
label
:
word
,
codeSnippe
t
:
word
,
insertTex
t
:
word
,
noAutoAccept
:
true
};
});
...
...
src/vs/editor/contrib/suggest/browser/suggestWidget.ts
浏览文件 @
d0b77851
...
...
@@ -99,7 +99,7 @@ class Renderer implements IRenderer<CompletionItem, ISuggestionTemplateData> {
const
data
=
<
ISuggestionTemplateData
>
templateData
;
const
suggestion
=
(
<
CompletionItem
>
element
).
suggestion
;
if
(
suggestion
.
documentation
Label
)
{
if
(
suggestion
.
documentation
)
{
data
.
root
.
setAttribute
(
'
aria-label
'
,
nls
.
localize
(
'
suggestionWithDetailsAriaLabel
'
,
"
{0}, suggestion, has details
"
,
suggestion
.
label
));
}
else
{
data
.
root
.
setAttribute
(
'
aria-label
'
,
nls
.
localize
(
'
suggestionAriaLabel
'
,
"
{0}, suggestion
"
,
suggestion
.
label
));
...
...
@@ -109,7 +109,7 @@ class Renderer implements IRenderer<CompletionItem, ISuggestionTemplateData> {
data
.
colorspan
.
style
.
backgroundColor
=
''
;
if
(
suggestion
.
type
===
'
color
'
)
{
let
color
=
matchesColor
(
suggestion
.
label
)
||
matchesColor
(
suggestion
.
documentation
Label
);
let
color
=
matchesColor
(
suggestion
.
label
)
||
matchesColor
(
suggestion
.
documentation
);
if
(
color
)
{
data
.
icon
.
className
=
'
icon customcolor
'
;
data
.
colorspan
.
style
.
backgroundColor
=
color
;
...
...
@@ -117,10 +117,10 @@ class Renderer implements IRenderer<CompletionItem, ISuggestionTemplateData> {
}
data
.
highlightedLabel
.
set
(
suggestion
.
label
,
(
<
CompletionItem
>
element
).
highlights
);
data
.
typeLabel
.
textContent
=
suggestion
.
typeLabe
l
||
''
;
data
.
documentation
.
textContent
=
suggestion
.
documentation
Label
||
''
;
data
.
typeLabel
.
textContent
=
suggestion
.
detai
l
||
''
;
data
.
documentation
.
textContent
=
suggestion
.
documentation
||
''
;
if
(
suggestion
.
documentation
Label
)
{
if
(
suggestion
.
documentation
)
{
show
(
data
.
documentationDetails
);
data
.
documentationDetails
.
onmousedown
=
e
=>
{
e
.
stopPropagation
();
...
...
@@ -154,7 +154,7 @@ class Delegate implements IDelegate<CompletionItem> {
getHeight
(
element
:
CompletionItem
):
number
{
const
focus
=
this
.
listProvider
().
getFocusedElements
()[
0
];
if
(
element
.
suggestion
.
documentation
Label
&&
element
===
focus
)
{
if
(
element
.
suggestion
.
documentation
&&
element
===
focus
)
{
return
FocusHeight
;
}
...
...
@@ -251,8 +251,8 @@ class SuggestionDetails {
}
this
.
title
.
innerText
=
item
.
suggestion
.
label
;
this
.
type
.
innerText
=
item
.
suggestion
.
typeLabe
l
||
''
;
this
.
docs
.
innerText
=
item
.
suggestion
.
documentation
Label
;
this
.
type
.
innerText
=
item
.
suggestion
.
detai
l
||
''
;
this
.
docs
.
innerText
=
item
.
suggestion
.
documentation
;
this
.
back
.
onmousedown
=
e
=>
{
e
.
preventDefault
();
e
.
stopPropagation
();
...
...
@@ -265,7 +265,7 @@ class SuggestionDetails {
this
.
scrollbar
.
scanDomNode
();
this
.
ariaLabel
=
strings
.
format
(
'
{0}
\n
{1}
\n
{2}
'
,
item
.
suggestion
.
label
||
''
,
item
.
suggestion
.
typeLabel
||
''
,
item
.
suggestion
.
documentationLabel
||
''
);
this
.
ariaLabel
=
strings
.
format
(
'
{0}
\n
{1}
\n
{2}
'
,
item
.
suggestion
.
label
||
''
,
item
.
suggestion
.
detail
||
''
,
item
.
suggestion
.
documentation
||
''
);
}
getAriaLabel
():
string
{
...
...
@@ -421,7 +421,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
}
private
_getSuggestionAriaAlertLabel
(
item
:
CompletionItem
):
string
{
if
(
item
.
suggestion
.
documentation
Label
)
{
if
(
item
.
suggestion
.
documentation
)
{
return
nls
.
localize
(
'
ariaCurrentSuggestionWithDetails
'
,
"
{0}, suggestion, has details
"
,
item
.
suggestion
.
label
);
}
else
{
return
nls
.
localize
(
'
ariaCurrentSuggestion
'
,
"
{0}, suggestion
"
,
item
.
suggestion
.
label
);
...
...
@@ -721,7 +721,7 @@ export class SuggestWidget implements IContentWidget, IDisposable {
const
item
=
this
.
list
.
getFocusedElements
()[
0
];
if
(
!
item
||
!
item
.
suggestion
.
documentation
Label
)
{
if
(
!
item
||
!
item
.
suggestion
.
documentation
)
{
return
;
}
...
...
src/vs/editor/contrib/suggest/common/suggestModel.ts
浏览文件 @
d0b77851
...
...
@@ -380,7 +380,7 @@ export class SuggestModel implements IDisposable {
}
this
.
_onDidAccept
.
fire
({
snippet
:
new
CodeSnippet
(
suggestion
.
codeSnippe
t
),
snippet
:
new
CodeSnippet
(
suggestion
.
insertTex
t
),
overwriteBefore
:
overwriteBefore
+
(
this
.
editor
.
getPosition
().
column
-
this
.
context
.
column
),
overwriteAfter
});
...
...
src/vs/editor/contrib/suggest/test/common/suggest.test.ts
浏览文件 @
d0b77851
...
...
@@ -30,15 +30,15 @@ suite('Suggest', function () {
suggestions
:
[{
label
:
'
aaa
'
,
type
:
'
snippet
'
,
codeSnippe
t
:
'
aaa
'
insertTex
t
:
'
aaa
'
},
{
label
:
'
zzz
'
,
type
:
'
snippet
'
,
codeSnippe
t
:
'
zzz
'
insertTex
t
:
'
zzz
'
},
{
label
:
'
fff
'
,
type
:
'
property
'
,
codeSnippe
t
:
'
fff
'
insertTex
t
:
'
fff
'
}]
};
}
...
...
src/vs/languages/html/common/htmlWorker.ts
浏览文件 @
d0b77851
...
...
@@ -146,7 +146,7 @@ export class HTMLWorker {
if
(
matchingTag
)
{
let
suggestion
:
modes
.
ISuggestion
=
{
label
:
'
/
'
+
matchingTag
,
codeSnippe
t
:
'
/
'
+
matchingTag
+
closeTag
,
insertTex
t
:
'
/
'
+
matchingTag
+
closeTag
,
overwriteBefore
:
overwriteBefore
,
type
:
'
property
'
};
...
...
@@ -159,7 +159,7 @@ export class HTMLWorker {
let
endIndent
=
model
.
getLineContent
(
endPosition
.
lineNumber
).
substring
(
0
,
endPosition
.
column
-
1
);
if
(
isWhiteSpace
(
startIndent
)
&&
isWhiteSpace
(
endIndent
))
{
suggestion
.
overwriteBefore
=
position
.
column
-
1
;
// replace from start of line
suggestion
.
codeSnippe
t
=
startIndent
+
'
</
'
+
matchingTag
+
closeTag
;
suggestion
.
insertTex
t
=
startIndent
+
'
</
'
+
matchingTag
+
closeTag
;
suggestion
.
filterText
=
endIndent
+
'
</
'
+
matchingTag
+
closeTag
;
}
}
...
...
@@ -177,9 +177,9 @@ export class HTMLWorker {
suggestions
.
suggestions
.
push
({
label
:
'
/
'
+
tag
,
overwriteBefore
:
suggestions
.
currentWord
.
length
+
1
,
codeSnippe
t
:
'
/
'
+
tag
+
closeTag
,
insertTex
t
:
'
/
'
+
tag
+
closeTag
,
type
:
'
property
'
,
documentation
Label
:
label
,
documentation
:
label
,
filterText
:
'
</
'
+
tag
+
closeTag
});
});
...
...
@@ -192,9 +192,9 @@ export class HTMLWorker {
provider
.
collectTags
((
tag
,
label
)
=>
{
suggestions
.
suggestions
.
push
({
label
:
tag
,
codeSnippe
t
:
tag
,
insertTex
t
:
tag
,
type
:
'
property
'
,
documentation
Label
:
label
,
documentation
:
label
,
overwriteBefore
:
suggestions
.
currentWord
.
length
});
});
...
...
@@ -227,7 +227,7 @@ export class HTMLWorker {
}
suggestions
.
suggestions
.
push
({
label
:
attribute
,
codeSnippe
t
:
codeSnippet
,
insertTex
t
:
codeSnippet
,
type
:
type
===
'
handler
'
?
'
function
'
:
'
value
'
,
overwriteBefore
:
suggestions
.
currentWord
.
length
});
...
...
@@ -260,7 +260,7 @@ export class HTMLWorker {
provider
.
collectValues
(
parentTag
,
attribute
,(
value
)
=>
{
suggestions
.
suggestions
.
push
({
label
:
value
,
codeSnippe
t
:
needsQuotes
?
'
"
'
+
value
+
'
"
'
:
value
,
insertTex
t
:
needsQuotes
?
'
"
'
+
value
+
'
"
'
:
value
,
type
:
'
unit
'
,
overwriteBefore
:
suggestions
.
currentWord
.
length
});
...
...
src/vs/languages/html/test/common/html-worker.test.ts
浏览文件 @
d0b77851
...
...
@@ -54,7 +54,7 @@ suite('HTML - worker', () => {
var
assertSuggestion
=
function
(
completion
:
Modes
.
ISuggestResult
,
label
:
string
,
type
?:
string
,
codeSnippet
?:
string
)
{
var
proposalsFound
=
completion
.
suggestions
.
filter
(
function
(
suggestion
:
Modes
.
ISuggestion
)
{
return
suggestion
.
label
===
label
&&
(
!
type
||
suggestion
.
type
===
type
)
&&
(
!
codeSnippet
||
suggestion
.
codeSnippe
t
===
codeSnippet
);
return
suggestion
.
label
===
label
&&
(
!
type
||
suggestion
.
type
===
type
)
&&
(
!
codeSnippet
||
suggestion
.
insertTex
t
===
codeSnippet
);
});
if
(
proposalsFound
.
length
!==
1
)
{
assert
.
fail
(
'
Suggestion not found:
'
+
label
+
'
, has
'
+
completion
.
suggestions
.
map
(
s
=>
s
.
label
).
join
(
'
,
'
));
...
...
src/vs/workbench/api/node/extHostLanguageFeatures.ts
浏览文件 @
d0b77851
...
...
@@ -554,7 +554,7 @@ class SuggestAdapter {
// insert the text of the edit and create a dedicated
// suggestion-container with overwrite[Before|After]
suggestion
.
codeSnippe
t
=
item
.
textEdit
.
newText
;
suggestion
.
insertTex
t
=
item
.
textEdit
.
newText
;
suggestion
.
overwriteBefore
=
pos
.
character
-
editRange
.
start
.
character
;
suggestion
.
overwriteAfter
=
editRange
.
end
.
character
-
pos
.
character
;
...
...
src/vs/workbench/api/node/extHostTypeConverters.ts
浏览文件 @
d0b77851
...
...
@@ -314,10 +314,10 @@ export const Suggest = {
from
(
item
:
vscode
.
CompletionItem
):
modes
.
ISuggestion
{
const
suggestion
:
modes
.
ISuggestion
=
{
label
:
item
.
label
,
codeSnippe
t
:
item
.
insertText
||
item
.
label
,
insertTex
t
:
item
.
insertText
||
item
.
label
,
type
:
CompletionItemKind
.
from
(
item
.
kind
),
typeLabe
l
:
item
.
detail
,
documentation
Label
:
item
.
documentation
,
detai
l
:
item
.
detail
,
documentation
:
item
.
documentation
,
sortText
:
item
.
sortText
,
filterText
:
item
.
filterText
};
...
...
@@ -326,10 +326,10 @@ export const Suggest = {
to
(
container
:
modes
.
ISuggestResult
,
position
:
types
.
Position
,
suggestion
:
modes
.
ISuggestion
):
types
.
CompletionItem
{
const
result
=
new
types
.
CompletionItem
(
suggestion
.
label
);
result
.
insertText
=
suggestion
.
codeSnippe
t
;
result
.
insertText
=
suggestion
.
insertTex
t
;
result
.
kind
=
CompletionItemKind
.
to
(
suggestion
.
type
);
result
.
detail
=
suggestion
.
typeLabe
l
;
result
.
documentation
=
suggestion
.
documentation
Label
;
result
.
detail
=
suggestion
.
detai
l
;
result
.
documentation
=
suggestion
.
documentation
;
result
.
sortText
=
suggestion
.
sortText
;
result
.
filterText
=
suggestion
.
filterText
;
...
...
@@ -340,7 +340,7 @@ export const Suggest = {
endPosition
=
new
types
.
Position
(
position
.
line
,
position
.
character
+
suggestion
.
overwriteAfter
);
}
result
.
textEdit
=
types
.
TextEdit
.
replace
(
new
types
.
Range
(
startPosition
,
endPosition
),
suggestion
.
codeSnippe
t
);
result
.
textEdit
=
types
.
TextEdit
.
replace
(
new
types
.
Range
(
startPosition
,
endPosition
),
suggestion
.
insertTex
t
);
return
result
;
}
};
...
...
src/vs/workbench/test/node/api/extHostLanguageFeatures.test.ts
浏览文件 @
d0b77851
...
...
@@ -767,7 +767,7 @@ suite('ExtHostLanguageFeatures', function() {
return
threadService
.
sync
().
then
(()
=>
{
return
provideSuggestionItems
(
model
,
new
EditorPosition
(
1
,
1
),
{
snippetConfig
:
'
none
'
}).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
assert
.
equal
(
value
[
0
].
suggestion
.
codeSnippe
t
,
'
testing2
'
);
assert
.
equal
(
value
[
0
].
suggestion
.
insertTex
t
,
'
testing2
'
);
});
});
});
...
...
@@ -789,7 +789,7 @@ suite('ExtHostLanguageFeatures', function() {
return
threadService
.
sync
().
then
(()
=>
{
return
provideSuggestionItems
(
model
,
new
EditorPosition
(
1
,
1
),
{
snippetConfig
:
'
none
'
}).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
1
);
assert
.
equal
(
value
[
0
].
suggestion
.
codeSnippe
t
,
'
weak-selector
'
);
assert
.
equal
(
value
[
0
].
suggestion
.
insertTex
t
,
'
weak-selector
'
);
});
});
});
...
...
@@ -811,8 +811,8 @@ suite('ExtHostLanguageFeatures', function() {
return
threadService
.
sync
().
then
(()
=>
{
return
provideSuggestionItems
(
model
,
new
EditorPosition
(
1
,
1
),
{
snippetConfig
:
'
none
'
}).
then
(
value
=>
{
assert
.
equal
(
value
.
length
,
2
);
assert
.
equal
(
value
[
0
].
suggestion
.
codeSnippe
t
,
'
strong-1
'
);
// sort by label
assert
.
equal
(
value
[
1
].
suggestion
.
codeSnippe
t
,
'
strong-2
'
);
assert
.
equal
(
value
[
0
].
suggestion
.
insertTex
t
,
'
strong-1
'
);
// sort by label
assert
.
equal
(
value
[
1
].
suggestion
.
insertTex
t
,
'
strong-2
'
);
});
});
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录