fix --localUse off-by-one error
makes behavior consistent with find declaration - where the first character of a token does not yield results, but the last does Before there was a weird edge case of it just finding the declaration on first character and no uses and finding nothing on the last character.
This commit is contained in:
parent
8dce131a8e
commit
38f6302e7a
|
|
@ -84,8 +84,8 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request,
|
|||
{
|
||||
if (t.type != tok!"identifier")
|
||||
continue;
|
||||
if (request.cursorPosition >= t.index &&
|
||||
request.cursorPosition < t.index + t.text.length)
|
||||
if (request.cursorPosition > t.index &&
|
||||
request.cursorPosition <= t.index + t.text.length)
|
||||
{
|
||||
sourceToken = tokenArray.ptr + i;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -3,3 +3,7 @@ set -u
|
|||
|
||||
../../bin/dcd-client $1 file.d -u -c22 | sed s\""$(dirname "$(pwd)")"\"\" > actual1.txt
|
||||
diff actual1.txt expected1.txt
|
||||
|
||||
# should work on last character of identifier
|
||||
../../bin/dcd-client $1 file.d -u -c24 | sed s\""$(dirname "$(pwd)")"\"\" > actual2.txt
|
||||
diff actual2.txt expected1.txt
|
||||
|
|
|
|||
Loading…
Reference in New Issue