Skip to content

Commit b2457bd

Browse files
Re-added semantic colorization fix for colliding types colliding in value and namespace space, added a test.
1 parent 35c9ce1 commit b2457bd

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

src/services/services.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4663,15 +4663,19 @@ module ts {
46634663
else if (flags & SymbolFlags.Enum) {
46644664
return ClassificationTypeNames.enumName;
46654665
}
4666-
else if (flags & SymbolFlags.Interface) {
4667-
return ClassificationTypeNames.interfaceName;
4668-
}
4669-
else if (flags & SymbolFlags.TypeParameter) {
4670-
return ClassificationTypeNames.typeParameterName;
4666+
else if (meaningAtPosition & SemanticMeaning.Type) {
4667+
if (flags & SymbolFlags.Interface) {
4668+
return ClassificationTypeNames.interfaceName;
4669+
}
4670+
else if (flags & SymbolFlags.TypeParameter) {
4671+
return ClassificationTypeNames.typeParameterName;
4672+
}
46714673
}
46724674
else if (flags & SymbolFlags.Module) {
46734675
return ClassificationTypeNames.moduleName;
46744676
}
4677+
4678+
return undefined;
46754679
}
46764680

46774681
function processNode(node: Node) {

tests/cases/fourslash/semanticClassification2.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@
88
//// Thing.toExponential();
99

1010
var c = classification;
11-
// NOTE: this is *wrong*, but will be fixed shortly.
12-
verify.semanticClassificationsAre(c.interfaceName("Thing"), c.interfaceName("Thing"), c.interfaceName("Thing"));
11+
verify.semanticClassificationsAre(c.interfaceName("Thing"));
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/// <reference path="fourslash.ts"/>
2+
3+
////declare module M {
4+
//// interface I {
5+
////
6+
//// }
7+
////}
8+
////
9+
////var M = { I: 10 };
10+
11+
var c = classification;
12+
verify.semanticClassificationsAre(c.moduleName("M"), c.interfaceName("I"), c.moduleName("M"));

0 commit comments

Comments
 (0)