Skip to content

Commit

Permalink
Fix bugs in settings tab
Browse files Browse the repository at this point in the history
  • Loading branch information
taichimaeda committed Apr 21, 2024
1 parent 9fcb6dc commit 7f92cc7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/chat/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ChatItem } from './components/ChatItem';
import { ChatFetcher, ChatView } from './view';

const SYSTEM_PROMPT = `
Welcome, I'm your Copilot and I'm here to help you get things done faster. You can also start an inline chat session.
Welcome, I'm your Markpilot and I'm here to help you get things done faster. You can also start an inline chat session.
I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. Check out the Copilot documentation to learn more.
`;
Expand Down
13 changes: 1 addition & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class Markpilot extends Plugin {
return this.chatView;
});

this.registerCustomIcons(); // Call before `registerRibbonActions()`.
this.registerCustomIcons(); // Must be called before `registerRibbonActions()`.
this.registerRibbonActions();
this.registerCommands();
}
Expand Down Expand Up @@ -262,17 +262,6 @@ export default class Markpilot extends Plugin {
return view;
}

updateChatView() {
// TODO:
// This does not fully update the chat view.
// For example if anything becomes stale in the fetcher closure, it will not be updated.
if (this.settings.chat.enabled) {
this.activateView();
} else {
this.deactivateView();
}
}

async loadSettings() {
const data = await this.loadData();
if (data === null) {
Expand Down
7 changes: 6 additions & 1 deletion src/settings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ export class MarkpilotSettingTab extends PluginSettingTab {
.setDesc('Set the max tokens for inline completions.')
.addText((text) =>
text
.setDisabled(!settings.completions.enabled)
.setValue(settings.completions.maxTokens.toString())
.onChange(async (value) => {
const amount = parseInt(value);
Expand Down Expand Up @@ -443,7 +444,11 @@ export class MarkpilotSettingTab extends PluginSettingTab {
toggle.setValue(settings.chat.enabled).onChange(async (value) => {
settings.chat.enabled = value;
await plugin.saveSettings();
plugin.updateChatView();
if (settings.chat.enabled) {
await plugin.activateView();
} else {
await plugin.deactivateView();
}
this.display(); // Re-render settings tab
}),
);
Expand Down

0 comments on commit 7f92cc7

Please sign in to comment.