Skip to content

Commit 3576511

Browse files
committed
fixed type hint resolution for classes
1 parent 4c07fb1 commit 3576511

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

haxe_libraries/rename.hxml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# @install: lix --silent download "gh://github.com/HaxeCheckstyle/haxe-rename#222e156eef9a32fb86ad015940248a683268cd7f" into rename/2.3.1/github/222e156eef9a32fb86ad015940248a683268cd7f
2-
-cp ${HAXE_LIBCACHE}/rename/2.3.1/github/222e156eef9a32fb86ad015940248a683268cd7f/src
1+
# @install: lix --silent download "gh://github.com/HaxeCheckstyle/haxe-rename#031091ba12a60b45d523f551adccc2cf3f1bf7d6" into rename/2.3.1/github/031091ba12a60b45d523f551adccc2cf3f1bf7d6
2+
-cp ${HAXE_LIBCACHE}/rename/2.3.1/github/031091ba12a60b45d523f551adccc2cf3f1bf7d6/src
33
-D rename=2.3.1

src/haxeLanguageServer/features/haxe/refactoring/LanguageServerTyper.hx

+13-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ class LanguageServerTyper implements ITyper {
4242
#end
4343
resolve(null);
4444
} else {
45-
resolve(buildTypeHint(hover, '$filePath@$pos'));
45+
final typeHint:Null<TypeHintType> = buildTypeHint(hover, '$filePath@$pos');
46+
#if debug
47+
trace('[refactor] received type info for $filePath@$pos: ${refactor.PrintHelper.typeHintToString(typeHint)}');
48+
#end
49+
resolve(typeHint);
4650
}
4751
return null;
4852
}, reject.handler());
@@ -59,8 +63,14 @@ class LanguageServerTyper implements ITyper {
5963
final name = printer.printPath(path.path);
6064
var fullPath = fullPrinter.printPath(path.path);
6165
final typeName = path.path?.typeName;
62-
if (typeName != null && typeName.startsWith("Abstract<")) {
63-
fullPath = typeName.substring(9, typeName.length - 1);
66+
67+
if (typeName != null) {
68+
if (typeName.startsWith("Abstract<")) {
69+
fullPath = typeName.substring(9, typeName.length - 1);
70+
}
71+
if (typeName.startsWith("Class<")) {
72+
fullPath = typeName.substring(6, typeName.length - 1);
73+
}
6474
}
6575
final type = typeList?.getType(fullPath);
6676
final params:Array<TypeHintType> = [];

0 commit comments

Comments
 (0)