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

fix: do not cache unsupported origins in config #571

Merged
merged 1 commit into from
Nov 9, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions client/src/notification_handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@ export function createRegistryStateHandler(): NotificationHandler<
RegistryStateParams
> {
return async function handler({ origin, suggestions }) {
let enable = false;
if (suggestions) {
const selection = await vscode.window.showInformationMessage(
`The server "${origin}" supports completion suggestions for imports. Do you wish to enable this? (Only do this if you trust "${origin}") [Learn More](https://github.com/denoland/vscode_deno/blob/main/docs/ImportCompletions.md)`,
"No",
"Enable",
);
enable = selection === "Enable";
const enable = selection === "Enable";
const suggestImportsConfig = vscode.workspace.getConfiguration(
"deno.suggest.imports",
);
const hosts: Record<string, boolean> =
suggestImportsConfig.get("hosts") ??
{};
hosts[origin] = enable;
await suggestImportsConfig.update(
"hosts",
hosts,
vscode.ConfigurationTarget.Workspace,
);
}
const suggestImportsConfig = vscode.workspace.getConfiguration(
"deno.suggest.imports",
);
const hosts: Record<string, boolean> = suggestImportsConfig.get("hosts") ??
{};
hosts[origin] = enable;
await suggestImportsConfig.update(
"hosts",
hosts,
vscode.ConfigurationTarget.Workspace,
);
};
}