Skip to content

Integrate with fig's generator code #240135

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

Merged
merged 10 commits into from
Feb 10, 2025
28 changes: 14 additions & 14 deletions extensions/terminal-suggest/src/terminalSuggestMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,22 +228,22 @@ export async function getCompletionItemsFromSpecs(
if (result.items) {
items.push(...result.items);
}
}

if (tokenType === TokenType.Command) {
// Include builitin/available commands in the results
const labels = new Set(items.map((i) => i.label));
for (const command of availableCommands) {
if (!labels.has(command.label)) {
items.push(createCompletionItem(terminalContext.cursorPosition, prefix, command, command.detail));
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want it how it was before? Otherwise, it's possible that result had no items, neither files nor folders were requested, and we won't change that.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, that's why the tests failed too 👍

if (tokenType === TokenType.Command) {
// Include builitin/available commands in the results
const labels = new Set(items.map((i) => i.label));
for (const command of availableCommands) {
if (!labels.has(command.label)) {
items.push(createCompletionItem(terminalContext.cursorPosition, prefix, command, command.detail));
}
}
filesRequested = true;
foldersRequested = true;
} else if (!items.length && !filesRequested && !foldersRequested) {
// Not a command and no specific args or options were provided, so show resources
filesRequested = true;
foldersRequested = true;
}
filesRequested = true;
foldersRequested = true;
} else if (!items.length && !filesRequested && !foldersRequested && !hasCurrentArg) {
// Not a command and no specific args or options were provided, so show resources
filesRequested = true;
foldersRequested = true;
}

let cwd: vscode.Uri | undefined;
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.