Skip to content

Commit

Permalink
introduce message levels for status bar message
Browse files Browse the repository at this point in the history
  • Loading branch information
furudean committed Sep 9, 2024
1 parent a9f3cd8 commit 89238c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/status_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class StatusBar {
processes: new Map<unknown, 'starting' | 'idle'>(),
is_follow_cursor: false,
message: undefined as string | undefined,
message_level: undefined as number | undefined,
}

constructor() {
Expand Down Expand Up @@ -94,8 +95,10 @@ export class StatusBar {
this.update_status_bar()
}

notify(message: string) {
this.update(() => ({ message }))
notify(message: string, level = 0) {
if (level >= (this.state.message_level ?? -1)) {
this.update(() => ({ message, message_level: level }))
}
}

private update_status_bar() {
Expand Down

0 comments on commit 89238c1

Please sign in to comment.