mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
EA-85603 fix unconditional cast which fails in incorrect YAML docs
This commit is contained in:
@@ -56,11 +56,11 @@ public class YAMLBreadcrumbsInfoProvider extends BreadcrumbsInfoProvider {
|
||||
return ((YAMLKeyValue)e).getKeyText() + ':';
|
||||
}
|
||||
if (e instanceof YAMLSequenceItem) {
|
||||
final YAMLSequence parent = (YAMLSequence)e.getParent();
|
||||
if (parent == null) {
|
||||
final PsiElement parent = e.getParent();
|
||||
if (!(parent instanceof YAMLSequence)) {
|
||||
return "Item";
|
||||
}
|
||||
final List<YAMLSequenceItem> items = parent.getItems();
|
||||
final List<YAMLSequenceItem> items = ((YAMLSequence)parent).getItems();
|
||||
return "Item " + getIndexOf(items, e);
|
||||
}
|
||||
if (e instanceof YAMLScalar) {
|
||||
|
||||
@@ -61,12 +61,18 @@ public class YAMLBreadcrumbsTest extends LightPlatformCodeInsightFixtureTestCase
|
||||
"bar: asjdjkas,\n" +
|
||||
"baz: [foo: qoo, boo: fo<caret>o, doo: 123]\n" +
|
||||
"}\n" +
|
||||
"---\n" +
|
||||
"foo: \n" +
|
||||
" bar:\n" +
|
||||
"- av<caret>r\n" +
|
||||
"...";
|
||||
private static final String OUTPUT = "[Document 1/2;null][items:;null][Item 2/2;null][descrip:;null][High Heeled \"Ruby\" S...;null]\n" +
|
||||
private static final String OUTPUT = "[Document 1/3;null][items:;null][Item 2/2;null][descrip:;null][High Heeled \"Ruby\" S...;null]\n" +
|
||||
"------\n" +
|
||||
"[Document 1/2;null][specialDelivery:;null][Follow the Yellow Br...;null]\n" +
|
||||
"[Document 1/3;null][specialDelivery:;null][Follow the Yellow Br...;null]\n" +
|
||||
"------\n" +
|
||||
"[Document 2/2;null][baz:;null][Item 2/3;null][boo:;null][foo;null]";
|
||||
"[Document 2/3;null][baz:;null][Item 2/3;null][boo:;null][foo;null]\n" +
|
||||
"------\n" +
|
||||
"[Document 3/3;null][foo:;null][Item;null][avr;null]";
|
||||
|
||||
public void testAll() {
|
||||
myFixture.configureByText(YAMLFileType.YML, INPUT);
|
||||
|
||||
Reference in New Issue
Block a user