fix(37825): exclude private fields from completions in subclasses (#37906)
This commit is contained in:
parent
92a63741a2
commit
d2016912b5
|
@ -2427,7 +2427,8 @@ namespace ts.Completions {
|
|||
return baseSymbols.filter(propertySymbol =>
|
||||
!existingMemberNames.has(propertySymbol.escapedName) &&
|
||||
!!propertySymbol.declarations &&
|
||||
!(getDeclarationModifierFlagsFromSymbol(propertySymbol) & ModifierFlags.Private));
|
||||
!(getDeclarationModifierFlagsFromSymbol(propertySymbol) & ModifierFlags.Private) &&
|
||||
!isPrivateIdentifierPropertyDeclaration(propertySymbol.valueDeclaration));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
15
tests/cases/fourslash/completionListClassPrivateFields.ts
Normal file
15
tests/cases/fourslash/completionListClassPrivateFields.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
////class A {
|
||||
//// #private = 1;
|
||||
////}
|
||||
////
|
||||
////class B extends A {
|
||||
//// /**/
|
||||
////}
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
exact: completion.classElementKeywords,
|
||||
isNewIdentifierLocation: true
|
||||
});
|
21
tests/cases/fourslash/completionListClassPrivateFields_JS.ts
Normal file
21
tests/cases/fourslash/completionListClassPrivateFields_JS.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
/// <reference path="fourslash.ts" />
|
||||
|
||||
// @allowJs: true
|
||||
// @Filename: a.js
|
||||
////class A {
|
||||
//// #private = 1;
|
||||
////}
|
||||
////
|
||||
////class B extends A {
|
||||
//// /**/
|
||||
////}
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
exact: [
|
||||
{ name: "A", sortText: completion.SortText.JavascriptIdentifiers },
|
||||
{ name: "B", sortText: completion.SortText.JavascriptIdentifiers },
|
||||
...completion.classElementInJsKeywords
|
||||
],
|
||||
isNewIdentifierLocation: true
|
||||
});
|
Loading…
Reference in a new issue