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: handle configuration changes from the app #241

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
17 changes: 17 additions & 0 deletions src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type ExtensionMessage =
request: "openLink";
linkType: "url" | "file" | "directory";
link: string;
documentRange: DocumentRange | null;
}
| {
target: "extension";
Expand All @@ -35,6 +36,13 @@ export type ExtensionMessage =
target: "extension";
request: "insertAtCursor";
content: string;
}
| {
target: "extension";
request: "updateConfiguration";
section: string;
value: any;
bm424 marked this conversation as resolved.
Show resolved Hide resolved
configurationTarget: boolean;
bm424 marked this conversation as resolved.
Show resolved Hide resolved
};

type LanguageServerMessage = {
Expand Down Expand Up @@ -107,6 +115,15 @@ export class ChatProvider implements vscode.WebviewViewProvider {
this.handleInsertAtCursorRequest(message);
break;
}
case "updateConfiguration": {
bm424 marked this conversation as resolved.
Show resolved Hide resolved
await vscode.workspace
.getConfiguration()
.update(
message.section,
message.value,
message.configurationTarget
bm424 marked this conversation as resolved.
Show resolved Hide resolved
);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function registerCommands(
commands.registerCommand("sourcery.chat.toggleCodeLens", () => {
const config = vscode.workspace.getConfiguration();
const currentValue = config.get("sourcery.codeLens");
config.update("sourcery.codeLens", !currentValue);
config.update("sourcery.codeLens", !currentValue, vscode.ConfigurationTarget.Global);
})
);

Expand Down
Loading