Skip to content

Commit

Permalink
fix #504 - Completion for partial identifier matching to a basic type…
Browse files Browse the repository at this point in the history
… doesn't work
  • Loading branch information
Lars-Kristiansen committed Jul 11, 2018
1 parent 07fe276 commit 5398d88
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dcd/server/autocomplete/complete.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public AutocompleteResponse complete(const AutocompleteRequest request,
request.cursorPosition, stringCache, tokenArray);

// allows to get completion on keyword, typically "is"
if (beforeTokens.length && isKeyword(beforeTokens[$-1].type))
if (beforeTokens.length &&
(isKeyword(beforeTokens[$-1].type) || isBasicType(beforeTokens[$-1].type)))
{
Token* fakeIdent = cast(Token*) (&beforeTokens[$-1]);
fakeIdent.text = str(fakeIdent.type);
Expand Down
2 changes: 2 additions & 0 deletions tests/tc_complete_kw/expected3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
identifiers
internal v
1 change: 1 addition & 0 deletions tests/tc_complete_kw/file3.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
struct Member{int internal;}void main(){Member member;member.int }
3 changes: 3 additions & 0 deletions tests/tc_complete_kw/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ diff actual1.txt expected1.txt

../../bin/dcd-client $1 file2.d -c42 > actual2.txt
diff actual2.txt expected1.txt

../../bin/dcd-client $1 file3.d -c64 > actual3.txt
diff actual3.txt expected3.txt

0 comments on commit 5398d88

Please sign in to comment.