|
2 | 2 | * Copyright (c) Microsoft Corporation. All rights reserved.
|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information.
|
4 | 4 | *--------------------------------------------------------------------------------------------*/
|
5 |
| -import type tt from 'typescript/lib/tsserverlibrary'; |
| 5 | +import tt from 'typescript/lib/tsserverlibrary'; |
6 | 6 | import TS from './typescript';
|
7 | 7 | const ts = TS();
|
8 | 8 |
|
@@ -470,7 +470,7 @@ class SimilarMethodRunnable extends SimilarPropertyRunnable<tt.MethodDeclaration
|
470 | 470 | }
|
471 | 471 | }
|
472 | 472 |
|
473 |
| -abstract class ClassPropertyContextProvider<T extends tt.MethodDeclaration | tt.ConstructorDeclaration> extends FunctionLikeContextProvider { |
| 473 | +abstract class ClassPropertyContextProvider<T extends tt.MethodDeclaration | tt.ConstructorDeclaration | tt.GetAccessorDeclaration | tt.SetAccessorDeclaration> extends FunctionLikeContextProvider { |
474 | 474 |
|
475 | 475 | protected readonly declaration: T;
|
476 | 476 | public override readonly isCallableProvider: boolean;
|
@@ -508,9 +508,9 @@ abstract class ClassPropertyContextProvider<T extends tt.MethodDeclaration | tt.
|
508 | 508 |
|
509 | 509 | class PropertiesTypeRunnable extends AbstractContextRunnable {
|
510 | 510 |
|
511 |
| - private readonly declaration: tt.MethodDeclaration | tt.ConstructorDeclaration; |
| 511 | + private readonly declaration: tt.MethodDeclaration | tt.ConstructorDeclaration | tt.GetAccessorDeclaration | tt.SetAccessorDeclaration; |
512 | 512 |
|
513 |
| - constructor(session: ComputeContextSession, languageService: tt.LanguageService, context: RequestContext, declaration: tt.MethodDeclaration | tt.ConstructorDeclaration, priority: number = Priorities.Properties) { |
| 513 | + constructor(session: ComputeContextSession, languageService: tt.LanguageService, context: RequestContext, declaration: tt.MethodDeclaration | tt.ConstructorDeclaration | tt.GetAccessorDeclaration | tt.SetAccessorDeclaration, priority: number = Priorities.Properties) { |
514 | 514 | super(session, languageService, context, 'PropertiesTypeRunnable', priority, ComputeCost.Medium);
|
515 | 515 | this.declaration = declaration;
|
516 | 516 | }
|
@@ -645,6 +645,18 @@ export class MethodContextProvider extends ClassPropertyContextProvider<tt.Metho
|
645 | 645 | }
|
646 | 646 | }
|
647 | 647 |
|
| 648 | +export class AccessorProvider extends ClassPropertyContextProvider<tt.GetAccessorDeclaration | tt.SetAccessorDeclaration> { |
| 649 | + |
| 650 | + constructor(declaration: tt.GetAccessorDeclaration | tt.SetAccessorDeclaration, tokenInfo: TokenInfo, computeContext: ProviderComputeContext) { |
| 651 | + super(declaration, tokenInfo, computeContext); |
| 652 | + } |
| 653 | + |
| 654 | + public override provide(result: ContextRunnableCollector, session: ComputeContextSession, languageService: tt.LanguageService, context: RequestContext, token: tt.CancellationToken): void { |
| 655 | + super.provide(result, session, languageService, context, token); |
| 656 | + result.addSecondary(new PropertiesTypeRunnable(session, languageService, context, this.declaration)); |
| 657 | + } |
| 658 | +} |
| 659 | + |
648 | 660 | class ConstructorBlueprintSearch extends FindInSiblingClassSearch<tt.ConstructorDeclaration> {
|
649 | 661 |
|
650 | 662 | constructor(program: tt.Program, symbols: Symbols, search: ConstructorBlueprintSearch);
|
|
0 commit comments