warn about bad cursor position
This commit is contained in:
parent
7e70c26faa
commit
b646dd4680
|
@ -120,7 +120,12 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray,
|
||||||
// since later there's a non-nothrow call to `toUpper`
|
// since later there's a non-nothrow call to `toUpper`
|
||||||
import std.utf : validate, UTFException;
|
import std.utf : validate, UTFException;
|
||||||
try validate(partial);
|
try validate(partial);
|
||||||
catch (UTFException) partial = "";
|
catch (UTFException)
|
||||||
|
{
|
||||||
|
import std.experimental.logger : warning;
|
||||||
|
warning("cursor positioned within a UTF sequence");
|
||||||
|
partial = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
significantTokenType = partial.length ? tok!"identifier" : tok!"";
|
significantTokenType = partial.length ? tok!"identifier" : tok!"";
|
||||||
beforeTokens = beforeTokens[0 .. $ - 1];
|
beforeTokens = beforeTokens[0 .. $ - 1];
|
||||||
|
|
Loading…
Reference in New Issue