Skip to content

Commit

Permalink
fix: do not cache unsupported origins in config (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk authored Nov 9, 2021
1 parent 7d6e43d commit 4e1036c
Showing 1 changed file with 13 additions and 13 deletions.
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,
);
};
}

0 comments on commit 4e1036c

Please sign in to comment.