use of com.intellij.lang.javascript.psi.stubs.impl.JSImplicitElementImpl in project intellij-plugins by JetBrains.
the class AngularJSIndexingHandler method addImplicitElements.
private static void addImplicitElements(@NotNull final JSImplicitElementProvider elementProvider, @Nullable final String command, @NotNull final StubIndexKey<String, JSImplicitElementProvider> index, @Nullable String defaultName, @Nullable final String value, @NotNull final JSElementIndexingData outData) {
if (defaultName == null)
return;
final List<String> keys = INDEXES.getKeysByValue(index);
assert keys != null && keys.size() == 1;
final Consumer<JSImplicitElementImpl.Builder> adder = builder -> {
builder.setType(elementProvider instanceof JSDocComment ? JSImplicitElement.Type.Tag : JSImplicitElement.Type.Class).setTypeString(value);
builder.setUserString(keys.get(0));
final JSImplicitElementImpl implicitElement = builder.toImplicitElement();
outData.addImplicitElement(implicitElement);
};
final Function<String, List<String>> variants = POLY_NAME_CONVERTERS.get(command);
final Function<String, String> converter = command != null ? NAME_CONVERTERS.get(command) : null;
final String name = converter != null ? converter.fun(defaultName) : defaultName;
if (variants != null) {
final List<String> strings = variants.fun(name);
for (String string : strings) {
adder.consume(new JSImplicitElementImpl.Builder(string, elementProvider));
}
} else {
adder.consume(new JSImplicitElementImpl.Builder(JSQualifiedNameImpl.fromQualifiedName(name), elementProvider));
}
if (!StringUtil.equals(defaultName, name)) {
JSImplicitElementImpl.Builder symbolElementBuilder = new JSImplicitElementImpl.Builder(defaultName, elementProvider).setType(elementProvider instanceof JSDocComment ? JSImplicitElement.Type.Tag : JSImplicitElement.Type.Class).setTypeString(value);
final List<String> symbolKeys = INDEXES.getKeysByValue(AngularSymbolIndex.KEY);
assert symbolKeys != null && symbolKeys.size() == 1;
symbolElementBuilder.setUserString(symbolKeys.get(0));
final JSImplicitElementImpl implicitElement2 = symbolElementBuilder.toImplicitElement();
outData.addImplicitElement(implicitElement2);
}
}
use of com.intellij.lang.javascript.psi.stubs.impl.JSImplicitElementImpl in project intellij-plugins by JetBrains.
the class AngularJSIndexingHandler method generateNamespace.
private static void generateNamespace(@NotNull JSLiteralExpression argument, @NotNull JSElementIndexingData outData) {
final String namespace = unquote(argument);
if (namespace == null)
return;
JSQualifiedNameImpl qName = JSQualifiedNameImpl.fromQualifiedName(namespace);
JSImplicitElementImpl.Builder elementBuilder = new JSImplicitElementImpl.Builder(qName, argument).setType(JSImplicitElement.Type.Class).setUserString(ANGULAR_SYMBOL_INDEX_USER_STRING);
final JSImplicitElementImpl implicitElement = elementBuilder.toImplicitElement();
outData.addImplicitElement(implicitElement);
// TODO fix
//final JSFunction function = findFunction(argument);
//final JSNamespace ns = visitor.findNsForExpr((JSExpression)argument);
//if (function != null && ns != null) {
// visitor.visitWithNamespace(ns, function, false);
//}
}
Aggregations