From 951870e06f3bedde1d6d4b8e3a834ac6e3cd6ea6 Mon Sep 17 00:00:00 2001 From: davu Date: Sat, 8 Oct 2022 15:45:49 +0200 Subject: [PATCH] hide private functions --- src/dcd/server/autocomplete/ufcs.d | 10 ++++++++-- tests/tc_ufcs_completions/fooutils/fooutils.d | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/dcd/server/autocomplete/ufcs.d b/src/dcd/server/autocomplete/ufcs.d index aefa75c..5e153fe 100644 --- a/src/dcd/server/autocomplete/ufcs.d +++ b/src/dcd/server/autocomplete/ufcs.d @@ -69,6 +69,8 @@ DSymbol*[] getSymbolsForUFCS(Scope* completionScope, const(DSymbol)* beforeDotSy HashSet!size_t visited; // local imports only FilteredAppender!(a => a.isCallableWithArg(beforeDotSymbol), DSymbol*[]) app; + FilteredAppender!(a => a.protection != tok!"private", DSymbol*[]) globalsFunctions; + while (currentScope !is null && currentScope.parent !is null) { auto localImports = currentScope.symbols.filter!(a => a.kind == CompletionKind.importSymbol); @@ -95,8 +97,12 @@ DSymbol*[] getSymbolsForUFCS(Scope* completionScope, const(DSymbol)* beforeDotSy { if (sym.qualifier == SymbolQualifier.selectiveImport) app.put(sym.type); - else - sym.type.getParts(internString(null), app, visited); + else{ + sym.type.getParts(istring(null), globalsFunctions, visited); + foreach(gSym; globalsFunctions) { + app.put(gSym); + } + } } } return app.data; diff --git a/tests/tc_ufcs_completions/fooutils/fooutils.d b/tests/tc_ufcs_completions/fooutils/fooutils.d index f16af2d..187f39d 100644 --- a/tests/tc_ufcs_completions/fooutils/fooutils.d +++ b/tests/tc_ufcs_completions/fooutils/fooutils.d @@ -25,4 +25,6 @@ void ufcsBarRefConst(ref const Foo foo, string mama) void ufcsBarRefConstWrapped(ref const(Foo) foo, string mama) {} void ufcsBarRefImmuttableWrapped(ref immutable(Foo) foo, string mama) {} void ufcsBarScope(ref scope Foo foo, string mama) {} -void ufcsBarReturnScope(return scope Foo foo, string mama) {} \ No newline at end of file +void ufcsBarReturnScope(return scope Foo foo, string mama) {} +private void privateUfcsBar(Foo foo, string message) {} +void notUfcsBar(string message) {} \ No newline at end of file