Open brichet opened 2 weeks ago
the prompt has been updated but still contains the previous one. For example the fetch may have been requested with
def te
and the current prompt isdef test
.
Probably this could indeed help, although when typing it's common to go back, delete a few characters, type new ones. So not sure if it really helps in practice?
Also wondering if this may be adding additional complexity to the inline completer logic to work around the slow response time from the Mistral API? Maybe it's already a bit faster with other providers?
Probably this could indeed help, although when typing it's common to go back, delete a few characters, type new ones. So not sure if it really helps in practice?
I agree that it may not often be useful, it only avoid fetching again the completion if the previous one includes the changes... This part is only an extra of the PR, the main goal is to avoid displaying outdated suggestions, even if it takes time.
Also wondering if this may be adding additional complexity to the inline completer logic to work around the slow response time from the Mistral API?
The complexity is mostly added to the codestral completer, it should not be ported to other completers if not required.
I forgot to mention that it also adds a timeout of 3s, and fetch again if there is no respond in this delay. This is to avoid some infinite waiting from server.
This PR try to improve the relevance of code completion using codestral.
Should fix #16
Context
Codestral allows only one request per second, and a completion request may takes about 2 sec. This can lead to inconsistency between the suggestion and the current prompt, which may have change during the request.
Code change
The completion provider keep in memory the latest prompt if the a request is pending. When the suggestion is received, there are 3 possible situations:
def te
and the current prompt isdef test
.The completion may take more time to be display, but should be more relevant.
Additionally, the options
Debouncer delay
in the inline completion settings should be used, to add a delay before fetching the completion after the last key has been pressed.EDIT: I forgot to mention that it also adds a timeout of 3s, and fetch again if there is no respond in this delay. This is to avoid some infinite waiting from server.