huggingface / huggingface/llm-vscode
Add support for properly interpreting `context.selectedCompletionInfo`
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 142
- Avg merge
- 3m
- Merged PRs (30d)
- 2
Description
I opened an [https://github.com/huggingface/llm-ls/issues/66](llm-ls) as I expect that project will need make some changes to fix this, but I was instructed to open an issue here.
When vscode shows a popup Completion item (i.e. what they used to call intellisense: a regular language syntax or function that vscode knows about), any inline completion is supposed to start with the Completion item. That is to say, the completion item should be added to the end of the prefix. Take the following python example:
```
file_path = '/tmp/my-file'
with open(file_path, "r") as handle:
# imagine the developer is in the middle of typing the period below
obj = json.
if obj.myField:
print('my field is present')
```
So imagine the developer is typing the `.` in the line `obj = json.`, vscode will pop up possible completions for `json`, and likely the method `loads` will be the top completion. The prefix that is sent to the LLM should use a value of `obj = json.loads` for that line. The suffix that comes after should also be included as normal. VScode will *ignore* any suggestion that does not start with `json.loads` so it should always be included.
The range that should be returned for the `vscode.InlineCompletionItem` should be properly adjusted for this as well.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.