mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-22 02:35:48 -05:00
Fix find all refs and goto def for decorators
This commit is contained in:
@@ -703,6 +703,7 @@ module ts {
|
||||
case SyntaxKind.TemplateExpression:
|
||||
case SyntaxKind.NoSubstitutionTemplateLiteral:
|
||||
case SyntaxKind.OmittedExpression:
|
||||
case SyntaxKind.Decorator:
|
||||
return true;
|
||||
case SyntaxKind.QualifiedName:
|
||||
while (node.parent.kind === SyntaxKind.QualifiedName) {
|
||||
|
||||
19
tests/cases/fourslash/findAllRefsOnDecorators.ts
Normal file
19
tests/cases/fourslash/findAllRefsOnDecorators.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @Filename: a.ts
|
||||
////function decorator(target) {
|
||||
//// return target;
|
||||
////}
|
||||
////decorator();
|
||||
|
||||
// @Filename: b.ts
|
||||
////@deco/*1*/rator @decorator("again")
|
||||
////class C {
|
||||
//// @decorator
|
||||
//// method() {}
|
||||
////}
|
||||
|
||||
goTo.file("b.ts");
|
||||
goTo.marker("1");
|
||||
|
||||
verify.referencesCountIs(5);
|
||||
26
tests/cases/fourslash/goToDefinitionDecorator.ts
Normal file
26
tests/cases/fourslash/goToDefinitionDecorator.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
// @Filename: b.ts
|
||||
////@/*decoratorUse*/decorator
|
||||
////class C {
|
||||
//// @decora/*decoratorFactoryUse*/torFactory(a, "22", true)
|
||||
//// method() {}
|
||||
////}
|
||||
|
||||
|
||||
// @Filename: a.ts
|
||||
/////*decoratorDefinition*/function decorator(target) {
|
||||
//// return target;
|
||||
////}
|
||||
/////*decoratorFactoryDefinition*/function decoratorFactory(...args) {
|
||||
//// return target => target;
|
||||
////}
|
||||
|
||||
|
||||
goTo.marker('decoratorUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorDefinition');
|
||||
|
||||
goTo.marker('decoratorFactoryUse');
|
||||
goTo.definition();
|
||||
verify.caretAtMarker('decoratorFactoryDefinition');
|
||||
Reference in New Issue
Block a user