Skip to content

Commit

Permalink
Merge pull request #508 from BBasile/issue-504
Browse files Browse the repository at this point in the history
fix #504 - Completion for partial identifier matching to a basic type doesn't work
merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
  • Loading branch information
dlang-bot authored Jul 11, 2018
2 parents 6d02423 + 5398d88 commit e5dc996
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 e5dc996

Please sign in to comment.