This commit fixes an issue connected with temporary files recognition
during auto-completion process. Invoking the “find definition” facility
on a symbol placed in the file currently being edited implied opening
a temporary file (with a .racertmp infix), which does not seem to exist
at the moment immediately after executing a Racer command.
The RacerClient class imports temp and performs a temp.open() call
for creating, opening and writing a temporary file passed into Racer.
The temp library uses Math.random and toString(36) in order to
produce a random path suffix. When called on a floating-point number,
the toString method generate a string containing a decimal delimeter
(.). Hence that random path suffix contains an extra dot
(e.g. ._main.rs.racertmp116717-2079-43y0eh.hktltbj4i), and extname
yields some random noise (.hktltbj4i in the previous example) instead
of a string starting with .racertmp. That was not correctly handled
by the code.
The attached screenshot illustrates what happened on my machine
before applying the patch.
This commit fixes an issue connected with temporary files recognition during auto-completion process. Invoking the “find definition” facility on a symbol placed in the file currently being edited implied opening a temporary file (with a
.racertmp
infix), which does not seem to exist at the moment immediately after executing a Racer command.The RacerClient class imports
temp
and performs atemp.open()
call for creating, opening and writing a temporary file passed into Racer. Thetemp
library usesMath.random
andtoString(36)
in order to produce a random path suffix. When called on a floating-point number, thetoString
method generate a string containing a decimal delimeter (.
). Hence that random path suffix contains an extra dot (e.g.._main.rs.racertmp116717-2079-43y0eh.hktltbj4i
), andextname
yields some random noise (.hktltbj4i
in the previous example) instead of a string starting with.racertmp
. That was not correctly handled by the code.The attached screenshot illustrates what happened on my machine before applying the patch.