-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: display the editor line and column info on statusBar
- Loading branch information
Showing
5 changed files
with
97 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as React from 'react'; | ||
import { IStatusBarItem, StatusBarEvent } from 'mo'; | ||
import { Controller } from 'mo/react/controller'; | ||
import { statusBarService } from 'mo/services'; | ||
import { singleton } from 'tsyringe'; | ||
import { Icon } from 'mo/components/icon'; | ||
|
||
export interface IStatusBarController { | ||
onClick?: (e: React.MouseEvent, item: IStatusBarItem) => void; | ||
} | ||
|
||
const problems: IStatusBarItem = { | ||
id: 'MoProblems', | ||
sortIndex: 1, | ||
name: 'Problems', | ||
}; | ||
|
||
const notifications: IStatusBarItem = { | ||
id: 'MoNotification', | ||
sortIndex: 1, | ||
name: 'Notification', | ||
render: () => <Icon type="bell" />, | ||
}; | ||
|
||
export const editorLineColumnItem: IStatusBarItem = { | ||
id: 'EditorCountInfo', | ||
sortIndex: 2, | ||
name: 'Go to Line/Column', | ||
render: () => <span>Ln 0, Col 0</span>, | ||
}; | ||
|
||
@singleton() | ||
export class StatusBarController | ||
extends Controller | ||
implements IStatusBarController { | ||
constructor() { | ||
super(); | ||
this.initStatusBar(); | ||
} | ||
|
||
public onClick = (e: React.MouseEvent, item: IStatusBarItem) => { | ||
this.emit(StatusBarEvent.onClick, e, item); | ||
}; | ||
|
||
public notify() { | ||
console.log('service:', statusBarService); | ||
} | ||
|
||
private initStatusBar() { | ||
statusBarService.appendLeftItem(problems); | ||
statusBarService.appendRightItem(notifications); | ||
statusBarService.appendRightItem(editorLineColumnItem); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters