File tree Expand file tree Collapse file tree
e2e/tolk/testcases/completion Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -177,3 +177,21 @@ struct Foo {
177177------------------------------------------------------------------------
17817813 private
17917913 readonly
180+
181+ ========================================================================
182+ Struct fields completion with private
183+ ========================================================================
184+ struct Foo {
185+ first: int,
186+ private second: slice,
187+ }
188+
189+ fun main() {
190+ val foo = Foo {};
191+ foo.<caret>;
192+ }
193+ ------------------------------------------------------------------------
194+ 9 first: int of Foo
195+ 1 forceLoadLazyObject(self): slice
196+ 1 stackMoveToTop(mutate self): void
197+ 1 toCell(self, options: PackOptions = {}): Cell<T>
Original file line number Diff line number Diff line change @@ -71,6 +71,11 @@ export class ReferenceCompletionProcessor implements ScopeProcessor {
7171 // since structs can be created like `Foo{}` we allow them
7272 if ( node instanceof Struct ) return true
7373 if ( node instanceof Enum ) return true // for Color.Red
74+
75+ if ( node instanceof Field ) {
76+ if ( node . isPrivate ( ) ) return false
77+ }
78+
7479 return true
7580 }
7681
Original file line number Diff line number Diff line change @@ -491,6 +491,12 @@ export class Field extends NamedNode {
491491 return new Struct ( ownerNode , this . file )
492492 }
493493
494+ public isPrivate ( ) : boolean {
495+ const modifiers = this . node . childForFieldName ( "modifiers" )
496+ if ( ! modifiers ) return false
497+ return modifiers . children . some ( it => it ?. text === "private" )
498+ }
499+
494500 public modifiers ( ) : string [ ] {
495501 const modifiers = this . node . childForFieldName ( "modifiers" )
496502 if ( ! modifiers ) return [ ]
You can’t perform that action at this time.
0 commit comments