Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vscode): adding auto-import during accept inline completion item #3389

Merged

Conversation

Sma1lboy
Copy link
Collaborator

@Sma1lboy Sma1lboy commented Nov 8, 2024

still working

Screen.Recording.2024-11-08.at.03.45.50.mov

fix #2965

@Sma1lboy Sma1lboy marked this pull request as ready for review November 9, 2024 01:49
Comment on lines 232 to 239

commands.executeCommand("editor.action.inlineSuggest.commit");

const uri = editor.document.uri;
const range = this.inlineCompletionProvider.getCurrentDisplayRange();
if (!range) {
return;
}
Copy link
Member

@icycodes icycodes Nov 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
commands.executeCommand("editor.action.inlineSuggest.commit");
const uri = editor.document.uri;
const range = this.inlineCompletionProvider.getCurrentDisplayRange();
if (!range) {
return;
}
const range = this.inlineCompletionProvider.getCurrentDisplayRange();
await commands.executeCommand("editor.action.inlineSuggest.commit");
const uri = editor.document.uri;
if (!range) {
return;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it await the edit action of accept inline completion?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The await causes us to be unable to get the current display item because it is no longer available. I moved the part that retrieves the edited range before committing the inline suggestion. The range should always exist if a code prediction is present.

@icycodes icycodes merged commit 5f0d9f0 into TabbyML:main Nov 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[VSCode] When a code completion is selected, automatically invoke import fix code action if possible
2 participants