Breakpoint span on class and its name is set on whole declaration

This commit is contained in:
Sheetal Nandi
2014-10-21 13:17:44 -07:00
parent b72b3ac850
commit 84016da726
8 changed files with 291 additions and 26 deletions

View File

@@ -182,6 +182,7 @@ module ts.BreakpointResolver {
return undefined;
}
case SyntaxKind.ClassDeclaration:
case SyntaxKind.EnumDeclaration:
case SyntaxKind.EnumMember:
case SyntaxKind.CallExpression:
@@ -189,9 +190,6 @@ module ts.BreakpointResolver {
// span on complete node
return textSpan(node);
case SyntaxKind.ClassDeclaration:
return spanInClassDeclaration(<ClassDeclaration>node);
case SyntaxKind.WithStatement:
// span in statement
return spanInNode((<WithStatement>node).statement);
@@ -387,14 +385,6 @@ module ts.BreakpointResolver {
}
}
function spanInClassDeclaration(classDeclaration: ClassDeclaration): TypeScript.TextSpan {
if (classDeclaration.members.length) {
return spanInNode(classDeclaration.members[0]);
}
return spanInNode(classDeclaration.getLastToken());
}
// Tokens:
function spanInOpenBraceToken(node: Node): TypeScript.TextSpan {
switch (node.parent.kind) {
@@ -402,6 +392,10 @@ module ts.BreakpointResolver {
var enumDeclaration = <EnumDeclaration>node.parent;
return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
case SyntaxKind.ClassDeclaration:
var classDeclaration = <ClassDeclaration>node.parent;
return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
case SyntaxKind.SwitchStatement:
return spanInNodeIfStartsOnSameLine(node.parent, (<SwitchStatement>node.parent).clauses[0]);
}