Skip to content

Commit 380d740

Browse files
committed
Hide property access completions of @ignored properties
1 parent 9757109 commit 380d740

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ import {
303303
getExternalModuleRequireArgument,
304304
getFirstConstructorWithBody,
305305
getFirstIdentifier,
306+
getFirstJSDocTag,
306307
getFunctionFlags,
307308
getHostSignatureFromJSDoc,
308309
getIdentifierGeneratedImportReference,
@@ -805,6 +806,7 @@ import {
805806
JSDocPublicTag,
806807
JSDocSatisfiesTag,
807808
JSDocSignature,
809+
JSDocTag,
808810
JSDocTemplateTag,
809811
JSDocThisTag,
810812
JSDocTypeAssertion,
@@ -34489,7 +34491,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3448934491
* @param property the accessed property's symbol.
3449034492
*/
3449134493
function isValidPropertyAccessForCompletions(node: PropertyAccessExpression | ImportTypeNode | QualifiedName, type: Type, property: Symbol): boolean {
34492-
return isPropertyAccessible(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, /*isWrite*/ false, type, property);
34494+
return isPropertyAccessible(node, node.kind === SyntaxKind.PropertyAccessExpression && node.expression.kind === SyntaxKind.SuperKeyword, /*isWrite*/ false, type, property)
34495+
&& (!property.valueDeclaration || !getFirstJSDocTag(property.valueDeclaration, (t): t is JSDocTag => t.kind === SyntaxKind.JSDocTag && t.tagName.escapedText === "ignore"));
3449334496
// Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context.
3449434497
}
3449534498

src/compiler/utilitiesPublic.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,11 @@ export function getJSDocTags(node: Node): readonly JSDocTag[] {
12601260
return getJSDocTagsWorker(node, /*noCache*/ false);
12611261
}
12621262

1263-
/** Get the first JSDoc tag of a specified kind, or undefined if not present. */
1264-
function getFirstJSDocTag<T extends JSDocTag>(node: Node, predicate: (tag: JSDocTag) => tag is T, noCache?: boolean): T | undefined {
1263+
/**
1264+
* @internal
1265+
* Get the first JSDoc tag of a specified kind, or undefined if not present.
1266+
*/
1267+
export function getFirstJSDocTag<T extends JSDocTag>(node: Node, predicate: (tag: JSDocTag) => tag is T, noCache?: boolean): T | undefined {
12651268
return find(getJSDocTagsWorker(node, noCache), predicate);
12661269
}
12671270

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// type Foo = {
4+
//// /** @ignore */
5+
//// a: string;
6+
//// b: number;
7+
//// };
8+
////
9+
//// declare const foo: Foo;
10+
//// foo./**/
11+
12+
verify.completions({
13+
marker: "",
14+
exact: "b",
15+
isNewIdentifierLocation: false,
16+
});

0 commit comments

Comments
 (0)