Skip to content

Commit b33a35b

Browse files
committed
Highlight abstract keywords on classes and members
1 parent 35ca82c commit b33a35b

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/services/services.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4694,6 +4694,10 @@ namespace ts {
46944694
if (!(container.kind === SyntaxKind.ModuleBlock || container.kind === SyntaxKind.SourceFile)) {
46954695
return undefined;
46964696
}
4697+
} else if (modifier === SyntaxKind.AbstractKeyword) {
4698+
if (!(container.kind === SyntaxKind.ClassDeclaration || declaration.kind === SyntaxKind.ClassDeclaration)) {
4699+
return undefined;
4700+
}
46974701
}
46984702
else {
46994703
// unsupported modifier
@@ -4707,7 +4711,13 @@ namespace ts {
47074711
switch (container.kind) {
47084712
case SyntaxKind.ModuleBlock:
47094713
case SyntaxKind.SourceFile:
4710-
nodes = (<Block>container).statements;
4714+
// Container is either a class declaration or the declaration is a classDeclaration
4715+
if (modifierFlag & NodeFlags.Abstract) {
4716+
nodes = (<Node[]>(<ClassDeclaration>declaration).members).concat(declaration);
4717+
}
4718+
else {
4719+
nodes = (<Block>container).statements;
4720+
}
47114721
break;
47124722
case SyntaxKind.Constructor:
47134723
nodes = (<Node[]>(<ConstructorDeclaration>container).parameters).concat(
@@ -4727,6 +4737,9 @@ namespace ts {
47274737
nodes = nodes.concat(constructor.parameters);
47284738
}
47294739
}
4740+
else if (modifierFlag & NodeFlags.Abstract) {
4741+
nodes = nodes.concat(container);
4742+
}
47304743
break;
47314744
default:
47324745
Debug.fail("Invalid container kind.")
@@ -4754,6 +4767,8 @@ namespace ts {
47544767
return NodeFlags.Export;
47554768
case SyntaxKind.DeclareKeyword:
47564769
return NodeFlags.Ambient;
4770+
case SyntaxKind.AbstractKeyword:
4771+
return NodeFlags.Abstract;
47574772
default:
47584773
Debug.fail();
47594774
}

0 commit comments

Comments
 (0)