mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 20:37:46 -05:00
Breakpoint span on class and its name is set on whole declaration
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user