From 5832c0a53809e69ca30f9175769a597da9d7b77f Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Wed, 8 Mar 2017 15:59:47 -0800 Subject: [PATCH] Fix #362 --- src/server/autocomplete.d | 4 ++-- tests/tc047/expected.txt | 1 + tests/tc047/file.d | 13 +++++++++++++ tests/tc047/run.sh | 5 +++++ 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 tests/tc047/expected.txt create mode 100644 tests/tc047/file.d create mode 100755 tests/tc047/run.sh diff --git a/src/server/autocomplete.d b/src/server/autocomplete.d index cdc045b..2dcd0ff 100644 --- a/src/server/autocomplete.d +++ b/src/server/autocomplete.d @@ -778,10 +778,10 @@ DSymbol*[] getSymbolsByTokenChain(T)(Scope* completionScope, // If the `symbols` array contains functions, and one of them returns // void and the others do not, this is a property function. For the // purposes of chaining auto-complete we want to ignore the one that - // returns void. + // returns void. This is a no-op if we are getting doc comments. void filterProperties() @nogc @safe { - if (symbols.length == 0) + if (symbols.length == 0 || completionType == CompletionType.ddoc) return; if (symbols[0].kind == CompletionKind.functionName || symbols[0].qualifier == SymbolQualifier.func) diff --git a/tests/tc047/expected.txt b/tests/tc047/expected.txt new file mode 100644 index 0000000..3e617d2 --- /dev/null +++ b/tests/tc047/expected.txt @@ -0,0 +1 @@ +Sets or gets prop diff --git a/tests/tc047/file.d b/tests/tc047/file.d new file mode 100644 index 0000000..fdb8620 --- /dev/null +++ b/tests/tc047/file.d @@ -0,0 +1,13 @@ +struct Foo +{ + /// Sets or gets prop + void prop(int t); + /// ditto + int prop(); +} + +void main(string[] args) +{ + Foo f; + f.prop +} diff --git a/tests/tc047/run.sh b/tests/tc047/run.sh new file mode 100755 index 0000000..411756a --- /dev/null +++ b/tests/tc047/run.sh @@ -0,0 +1,5 @@ +set -e +set -u + +../../bin/dcd-client $1 file.d -d -c136 > actual.txt +diff actual.txt expected.txt