Skip to content

Commit eb59282

Browse files
committed
Fix incompatibilities with IDEA 2021
1 parent bca84a7 commit eb59282

File tree

12 files changed

+21
-20
lines changed

12 files changed

+21
-20
lines changed

resources/META-INF/plugin.xml renamed to META-INF/plugin.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>lv.midiana.misc.idea-plugins.deep-js-completion</id>
33
<name>deep-js-completion</name>
4-
<version>2020.06.22.001</version>
4+
<version>2021.04.21.001</version>
55
<vendor email="[email protected]" url="http://midiana.lv/entry/deep-js-completion">klesun</vendor>
66

77
<description><![CDATA[
File renamed without changes.

src/org/klesun/deep_js_completion/contexts/SearchCtx.scala

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class SearchCtx(
4040
.getOrElse(7500)
4141
}
4242

43-
private def getWsType(expr: JSExpression) = {
43+
private def getWsType(expr: JSExpression): GenTraversableOnce[JSType] = {
4444
val isProp = cast[JSReferenceExpression](expr)
4545
.exists(ref => ref.getQualifier != null)
4646
val isMeth = cast[JSCallExpression](expr)
@@ -55,7 +55,8 @@ class SearchCtx(
5555
} else {
5656
// would be nice to find a better function - that would
5757
// try _guessing_ declaration by just member name
58-
Option(JSTypeEvaluator.getExpressionType(expr))
58+
Option(JSTypeEvaluator.getElementType(expr))
59+
.flatMap(res => if (res.getResults().size() > 0) Some(res.getResults().get(0)) else None)
5960
.flatMap(res => Option(res.getType))
6061
}
6162
}

src/org/klesun/deep_js_completion/resolvers/MainRes.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import scala.collection.GenTraversableOnce
1919
import scala.collection.JavaConverters._
2020
import scala.util.Try
2121

22-
case class ThisCls(isStatic: Boolean, clsPsi: JSClass[StubElement[_]])
22+
case class ThisCls(isStatic: Boolean, clsPsi: JSClass)
2323

2424
object MainRes {
2525

@@ -36,7 +36,7 @@ object MainRes {
3636

3737
def getThisCls(expr: JSThisExpression) = {
3838
var parent = expr.getParent
39-
var clsOpt: Option[JSClass[StubElement[_]]] = None
39+
var clsOpt: Option[JSClass] = None
4040
var isStatic = false
4141
var done = false
4242
while (parent != null && clsOpt.isEmpty) {
@@ -47,7 +47,7 @@ object MainRes {
4747
isStatic = parent.getChildren
4848
.flatMap(cast[JSAttributeList](_))
4949
.exists(attrs => attrs.hasModifier(ModifierType.STATIC))
50-
clsOpt = Option(parent.getParent).flatMap(cast[JSClass[StubElement[_]]](_))
50+
clsOpt = Option(parent.getParent).flatMap(cast[JSClass](_))
5151
done = true
5252
}
5353
}

src/org/klesun/deep_js_completion/resolvers/VarRes.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ case class VarRes(ctx: IExprCtx) {
182182
}
183183
}
184184
case func: JSFunction => FuncRes(ctx).resolve(func)
185-
case cls: JSClass[StubElement[_]] =>
186-
cast[JSClass[StubElement[_]]](cls)
185+
case cls: JSClass =>
186+
cast[JSClass](cls)
187187
.map(cls => {
188188
val clst = JSDeepClassType(cls, ctx.subCtxEmpty())
189189
clst

src/org/klesun/deep_js_completion/resolvers/var_res/ArgRes.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ case class ArgRes(ctx: IExprCtx) {
9090
private def getInlineFuncArgType(func: PsiElement, argOrder: Integer): GenTraversableOnce[JSType] = {
9191
nit(func.getParent)
9292
.flatMap(cast[JSArgumentList](_))
93-
.flatMap(argList => nit(argList.getArguments.indexOf(func))
93+
.flatMap(argList => nit(argList.getArguments.indexWhere(arg => arg.equals(func)))
9494
.flatMap(inlineFuncArgOrder => Option(true)
9595
.flatMap(ok => Option(argList.getParent))
9696
.flatMap(cast[JSCallExpression](_)).itr

src/org/klesun/deep_js_completion/structures/JSDeepClassType.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import scala.collection.JavaConverters._
2323
* you _any_ type when you call .asRecordType()
2424
*/
2525
case class JSDeepClassType(
26-
clsPsi: JSClass[StubElement[_]],
26+
clsPsi: JSClass,
2727
closureCtx: IExprCtx,
2828
) extends JSType {
2929

@@ -67,7 +67,7 @@ case class JSDeepClassType(
6767

6868
override def acceptChildren(jsRecursiveTypeVisitor: JSRecursiveTypeVisitor): Unit = ???
6969

70-
override def resolveClass(): JSClass[_ <: StubElement[_ <: PsiElement]] = ???
70+
override def resolveClass(): JSClass = ???
7171

7272
override def getSource: JSTypeSource = ???
7373

@@ -77,7 +77,7 @@ case class JSDeepClassType(
7777

7878
override def isEquivalentTo(jsType: JSType, processingContext: ProcessingContext): Boolean = ???
7979

80-
override def transformTypeHierarchy(function: util.Function[JSType, JSType]): JSType = ???
80+
override def transformTypeHierarchy(function: util.Function[_ >: JSType, _ <: JSType]): JSType = ???
8181

8282
override def transformTypeHierarchy(jsRecursiveTypeTransformer: JSRecursiveTypeTransformer): JSType = ???
8383

src/org/klesun/deep_js_completion/structures/JSDeepFunctionTypeImpl.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ case class JSDeepFunctionTypeImpl(
2121
val closureCtx: Option[IFuncCtx] = None,
2222
) extends JSTypeBaseImpl(JSTypeSource.EMPTY) {
2323

24-
override def copyTypeHierarchy(function: util.Function[JSType, JSType]): JSType = this
24+
override def copyTypeHierarchy(function: util.Function[_ >: JSType, _ <: JSType]): JSType = this
2525

2626
override def copyWithNewSource(jsTypeSource: JSTypeSource): JSType = this
2727

@@ -31,7 +31,7 @@ case class JSDeepFunctionTypeImpl(
3131

3232
def isEquivalentToImpl(jsType: JSType, processingContext: ProcessingContext, b: Boolean): Boolean = isEquivalentToWithSameClass(jsType, processingContext, b)
3333

34-
override def resolvedHashCodeImpl(): Int = {
34+
override def hashCodeImpl(): Int = {
3535
Objects.hash(List(funcPsi))
3636
}
3737

src/org/klesun/deep_js_completion/structures/JSDeepModuleTypeImpl.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ case class JSDeepModuleTypeImpl(
2121
val name: String, val instType: EInstType.T
2222
) extends JSTypeBaseImpl(JSTypeSource.EMPTY) {
2323

24-
override def copyTypeHierarchy(function: util.Function[JSType, JSType]): JSType = this
24+
override def copyTypeHierarchy(function: util.Function[_ >: JSType, _ <: JSType]): JSType = this
2525

2626
override def copyWithNewSource(jsTypeSource: JSTypeSource): JSType = this
2727

@@ -31,7 +31,7 @@ case class JSDeepModuleTypeImpl(
3131

3232
def isEquivalentToImpl(jsType: JSType, processingContext: ProcessingContext, b: Boolean): Boolean = isEquivalentToWithSameClass(jsType, processingContext, b)
3333

34-
override def resolvedHashCodeImpl(): Int = {
34+
override def hashCodeImpl(): Int = {
3535
Objects.hash(List(name))
3636
}
3737

src/org/klesun/deep_js_completion/structures/JSDeepMultiType.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ case class JSDeepMultiType(
1414
mit: MemIt[JSType],
1515
) extends JSTypeBaseImpl(JSTypeSource.EMPTY) {
1616

17-
override def copyTypeHierarchy(function: util.Function[JSType, JSType]): JSType = this
17+
override def copyTypeHierarchy(function: util.Function[_ >: JSType, _ <: JSType]): JSType = this
1818

1919
override def copyWithNewSource(jsTypeSource: JSTypeSource): JSType = this
2020

@@ -24,7 +24,7 @@ case class JSDeepMultiType(
2424

2525
def isEquivalentToImpl(jsType: JSType, processingContext: ProcessingContext, b: Boolean): Boolean = isEquivalentToWithSameClass(jsType, processingContext, b)
2626

27-
override def resolvedHashCodeImpl(): Int = {
27+
override def hashCodeImpl(): Int = {
2828
mit.hashCode()
2929
}
3030

tests/jsroot/ExactKeysUnitTest.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const ApoPnrParser = require("../unv/grect/backend/Transpiled/Gds/Parsers/Apollo
1212
const SabPnrParser = require("../unv/grect/backend/Transpiled/Gds/Parsers/Sabre/Pnr/PnrParser");
1313
const AmaPnrParser = require("../unv/grect/backend/Transpiled/Gds/Parsers/Amadeus/Pnr/PnrParser");
1414
const GalPnrParser = require("../unv/grect/backend/Transpiled/Gds/Parsers/Galileo/Pnr/PnrParser");
15-
const CmdLogs = require('../unv/grect/backend/Repositories/CmdLogs.js');
15+
const CmdLogs = require('../unv/grect/backend/Repositories/CmddLogs.js');
1616
const _ = require('lodash');
1717
const PersistentHttpRq = require('klesun-node-tools/src/Utils/PersistentHttpRq.js');
1818
const Rej = require("klesun-node-tools/src/Rej");
@@ -433,4 +433,4 @@ exports.provideJsonRequire = () => {
433433
var zhopaConfig = getConfigFromSomewhere();
434434
zhopaConfig.dbNodes[0].;
435435
return zhopaConfig;
436-
};
436+
};

0 commit comments

Comments
 (0)