Skip to content

Commit

Permalink
Fix bugs in ribbon action display
Browse files Browse the repository at this point in the history
  • Loading branch information
taichimaeda committed Apr 19, 2024
1 parent af5bd6b commit 0525a8d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,20 @@ export default class Markpilot extends Plugin {
return this.chatView;
});

this.registerCustomIcons(); // Call before `registerRibbonActions()`.
this.registerRibbonActions();
this.registerCommands();
}

registerRibbonActions() {
// Register custom icon.
// TODO:
// Remove once this PR gets merged:
// https://github.com/lucide-icons/lucide/pull/2079
registerCustomIcons() {
addIcon('bot-off', botOffIcon);
}

registerRibbonActions() {
const { settings } = this;

// TODO:
// Extract duplicate logic when toggling features.
const toggleCompletionsItem = this.addRibbonIcon(
'bot',
settings.completions.enabled ? 'bot' : 'bot-off',
'Toggle inline completions',
() => {
this.settings.completions.enabled = !this.settings.completions.enabled;
Expand Down

0 comments on commit 0525a8d

Please sign in to comment.