fix(language-service): Diagnostic span should point to class name (#34932)
Right now, if an Angular diagnostic is generated for a TypeScript node, the span points to the decorator Identifier, i.e. the Identifier node like `@NgModule`, `@Component`, etc. This is weird. It should point to the class name instead. Note, we do not have a more fine-grained breakdown of the span when diagnostics are emitted, this work remains to be done. PR Close #34932
This commit is contained in:

committed by
Andrew Kushnir

parent
37727ce898
commit
c9db7bdb8a
@ -28,10 +28,10 @@ describe('getDirectiveClassLike()', () => {
|
||||
}
|
||||
});
|
||||
expect(result).toBeTruthy();
|
||||
const {decoratorId, classDecl} = result !;
|
||||
const {decoratorId, classId} = result !;
|
||||
expect(decoratorId.kind).toBe(ts.SyntaxKind.Identifier);
|
||||
expect((decoratorId as ts.Identifier).text).toBe('NgModule');
|
||||
expect(classDecl.name !.text).toBe('AppModule');
|
||||
expect(decoratorId.text).toBe('NgModule');
|
||||
expect(classId.text).toBe('AppModule');
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user