diff --git a/browser/src/Editor/Editor.ts b/browser/src/Editor/Editor.ts index 5f03741a08..5bb138a0bd 100644 --- a/browser/src/Editor/Editor.ts +++ b/browser/src/Editor/Editor.ts @@ -24,13 +24,17 @@ export interface IEditor extends Oni.Editor { */ export class Editor extends Disposable implements Oni.Editor { private _currentMode: string - private _onBufferEnterEvent = new Event() - private _onBufferLeaveEvent = new Event() - private _onBufferChangedEvent = new Event() - private _onBufferSavedEvent = new Event() - private _onBufferScrolledEvent = new Event() - private _onCursorMoved = new Event() - private _onModeChangedEvent = new Event() + private _onBufferEnterEvent = new Event("Editor::onBufferEnterEvent") + private _onBufferLeaveEvent = new Event("Editor::onBufferLeaveEvent") + private _onBufferChangedEvent = new Event( + "Editor::onBufferChangedEvent", + ) + private _onBufferSavedEvent = new Event("Editor::onBufferSavedEvent") + private _onBufferScrolledEvent = new Event( + "Editor::onBufferScrolledEvent", + ) + private _onCursorMoved = new Event("Editor::onCursorMoved") + private _onModeChangedEvent = new Event("Editor::onModeChangedEvent") public get mode(): string { return this._currentMode diff --git a/browser/src/Editor/NeovimEditor/CompletionMenu.ts b/browser/src/Editor/NeovimEditor/CompletionMenu.ts index 66f3017b3e..c200f25ec7 100644 --- a/browser/src/Editor/NeovimEditor/CompletionMenu.ts +++ b/browser/src/Editor/NeovimEditor/CompletionMenu.ts @@ -15,8 +15,12 @@ import { ContextMenu } from "./../../Services/ContextMenu" import * as CompletionUtility from "./../../Services/Completion/CompletionUtility" export class CompletionMenu { - private _onItemFocusedEvent: Event = new Event() - private _onItemSelectedEvent: Event = new Event() + private _onItemFocusedEvent: Event = new Event( + "CompletionMenu::onItemFocusedEvent", + ) + private _onItemSelectedEvent: Event = new Event( + "CompletionMenu::onItemSelectedEvent", + ) public get onItemFocused(): IEvent { return this._onItemFocusedEvent diff --git a/browser/src/Editor/NeovimEditor/NeovimEditor.tsx b/browser/src/Editor/NeovimEditor/NeovimEditor.tsx index 77a31a8053..734f7c2957 100644 --- a/browser/src/Editor/NeovimEditor/NeovimEditor.tsx +++ b/browser/src/Editor/NeovimEditor/NeovimEditor.tsx @@ -113,7 +113,7 @@ export class NeovimEditor extends Editor implements IEditor { private _pendingAnimationFrame: boolean = false - private _onEnterEvent: Event = new Event() + private _onEnterEvent: Event = new Event("NeovimEditor::onEnterEvent") private _modeChanged$: Observable private _cursorMoved$: Observable @@ -142,7 +142,7 @@ export class NeovimEditor extends Editor implements IEditor { private _externalMenuOverlay: Overlay private _bufferLayerManager: BufferLayerManager - private _onNeovimQuit: Event = new Event() + private _onNeovimQuit: Event = new Event("NeovimEditor::onNeovimQuit") private _autoFocus: boolean = true diff --git a/browser/src/Input/Keyboard/KeyboardLayout.ts b/browser/src/Input/Keyboard/KeyboardLayout.ts index 2001b5353d..8f2256eb69 100644 --- a/browser/src/Input/Keyboard/KeyboardLayout.ts +++ b/browser/src/Input/Keyboard/KeyboardLayout.ts @@ -33,7 +33,7 @@ const augmentKeyMap = (keyMap: IKeyMap, language: string): IKeyMap => { export class KeyboardLayoutManager { private _keyMap: IKeyMap = null - private _onKeyMapChanged: Event = new Event() + private _onKeyMapChanged: Event = new Event("KeyboardLayout::onKeyMapChanged") /** * Event that is triggered when the keymap is changed, diff --git a/browser/src/Plugins/PluginInstaller.ts b/browser/src/Plugins/PluginInstaller.ts index 4aa7c7e730..21aae81def 100644 --- a/browser/src/Plugins/PluginInstaller.ts +++ b/browser/src/Plugins/PluginInstaller.ts @@ -44,9 +44,15 @@ export interface IPluginInstaller { } export class YarnPluginInstaller implements IPluginInstaller { - private _onOperationStarted = new Event() - private _onOperationCompleted = new Event() - private _onOperationError = new Event() + private _onOperationStarted = new Event( + "PluginInstaller::onOperationStarted", + ) + private _onOperationCompleted = new Event( + "PluginInstaller::onOperationCompleted", + ) + private _onOperationError = new Event( + "PluginInstaller::onOperationError", + ) public get onOperationStarted(): IEvent { return this._onOperationStarted diff --git a/browser/src/Plugins/PluginSidebarPane.tsx b/browser/src/Plugins/PluginSidebarPane.tsx index 34f27adac7..1acfee711c 100644 --- a/browser/src/Plugins/PluginSidebarPane.tsx +++ b/browser/src/Plugins/PluginSidebarPane.tsx @@ -69,8 +69,8 @@ export class PluginSidebarItemView extends React.PureComponent() - private _onLeave = new Event() + private _onEnter = new Event("PluginSidebarPane::onEnter") + private _onLeave = new Event("PluginSidebarPane::onLeave") public get id(): string { return "oni.sidebar.plugins" diff --git a/browser/src/Services/Bookmarks/BookmarksPane.tsx b/browser/src/Services/Bookmarks/BookmarksPane.tsx index cfcc5fde7c..58329a4429 100644 --- a/browser/src/Services/Bookmarks/BookmarksPane.tsx +++ b/browser/src/Services/Bookmarks/BookmarksPane.tsx @@ -20,8 +20,8 @@ import { SidebarContainerView, SidebarItemView } from "./../../UI/components/Sid import { VimNavigator } from "./../../UI/components/VimNavigator" export class BookmarksPane implements SidebarPane { - private _onEnter = new Event() - private _onLeave = new Event() + private _onEnter = new Event("BookmarksPane::onEnter") + private _onLeave = new Event("BookmarksPane::onLeave") constructor(private _bookmarksProvider: IBookmarksProvider) {} diff --git a/browser/src/Services/Bookmarks/index.ts b/browser/src/Services/Bookmarks/index.ts index fddfc37624..cfa9fe2e19 100644 --- a/browser/src/Services/Bookmarks/index.ts +++ b/browser/src/Services/Bookmarks/index.ts @@ -32,7 +32,7 @@ const marksToBookmarks = (mark: INeovimMarkInfo): IBookmark => ({ export class NeovimBookmarksProvider implements IBookmarksProvider { private _lastBookmarks: IBookmark[] = [] - private _onBookmarksUpdated = new Event() + private _onBookmarksUpdated = new Event("Bookmarks::onBookmarksUpdated") public get bookmarks(): IBookmark[] { return this._lastBookmarks diff --git a/browser/src/Services/Browser/index.tsx b/browser/src/Services/Browser/index.tsx index d164714dd8..7ed4bee305 100644 --- a/browser/src/Services/Browser/index.tsx +++ b/browser/src/Services/Browser/index.tsx @@ -24,14 +24,14 @@ import { import { BrowserView } from "./BrowserView" export class BrowserLayer implements Oni.BufferLayer { - private _debugEvent = new Event() - private _goBackEvent = new Event() - private _goForwardEvent = new Event() - private _reloadEvent = new Event() - private _scrollUpEvent = new Event() - private _scrollDownEvent = new Event() - private _scrollRightEvent = new Event() - private _scrollLeftEvent = new Event() + private _debugEvent = new Event("Browser::debugEvent") + private _goBackEvent = new Event("Browser::goBackEvent") + private _goForwardEvent = new Event("Browser::goForwardEvent") + private _reloadEvent = new Event("Browser::reloadEvent") + private _scrollUpEvent = new Event("Browser::scrollUpEvent") + private _scrollDownEvent = new Event("Browser::scrollDownEvent") + private _scrollRightEvent = new Event("Browser::scrollRightEvent") + private _scrollLeftEvent = new Event("Browser::scrollLeftEvent") private _webview: WebviewTag | null = null private _activeTagName: string | null = null diff --git a/browser/src/Services/Colors.ts b/browser/src/Services/Colors.ts index ecb2dd3013..d7a3d1c9bf 100644 --- a/browser/src/Services/Colors.ts +++ b/browser/src/Services/Colors.ts @@ -36,7 +36,7 @@ export interface IColors extends OniApi.IColors { export class Colors implements OniApi.IColors, IDisposable { private _subscriptions: IDisposable[] = [] private _colors: ColorsDictionary = {} - private _onColorsChangedEvent: Event = new Event() + private _onColorsChangedEvent: Event = new Event("Colors::onColorsChangedEvent") public get onColorsChanged(): IEvent { return this._onColorsChangedEvent diff --git a/browser/src/Services/Completion/Completion.ts b/browser/src/Services/Completion/Completion.ts index 81ec8674df..f51cca8c70 100644 --- a/browser/src/Services/Completion/Completion.ts +++ b/browser/src/Services/Completion/Completion.ts @@ -33,8 +33,10 @@ export class Completion implements IDisposable { private _onShowCompletionItemsEvent: Event = new Event< ICompletionShowEventArgs - >() - private _onHideCompletionItemsEvent: Event = new Event() + >("Completion::onShowCompletionItemsEvent") + private _onHideCompletionItemsEvent: Event = new Event( + "Completion::onHideCompletionItemsEvent", + ) public get onShowCompletionItems(): IEvent { return this._onShowCompletionItemsEvent diff --git a/browser/src/Services/Configuration/Configuration.ts b/browser/src/Services/Configuration/Configuration.ts index a788745331..033d63cbee 100644 --- a/browser/src/Services/Configuration/Configuration.ts +++ b/browser/src/Services/Configuration/Configuration.ts @@ -96,10 +96,14 @@ export class Configuration implements Oni.Configuration { private _configurationProviders: IConfigurationProvider[] = [] private _onConfigurationChangedEvent: Event> = new Event< Partial - >() - private _onConfigurationErrorEvent: Event = new Event() + >("Configuration::onConfigurationChangedEvent") + private _onConfigurationErrorEvent: Event = new Event( + "Configuration::onConfigurationErrorEvent", + ) - private _onConfigurationUpdatedEvent = new Event() + private _onConfigurationUpdatedEvent = new Event( + "Configuration::onConfigurationUpdatedEvent", + ) private _oniApi: Oni.Plugin.Api = null private _config: GenericConfigurationValues = {} @@ -158,7 +162,9 @@ export class Configuration implements Oni.Configuration { this.setValue(name, options.defaultValue) } - const newEvent = new Event>() + const newEvent = new Event>( + "Configuration::newEvent", + ) const subs: Array>> = this._subscriptions[name] || [] this._subscriptions[name] = [...subs, newEvent] diff --git a/browser/src/Services/Configuration/FileConfigurationProvider.ts b/browser/src/Services/Configuration/FileConfigurationProvider.ts index bc3f69ca72..b95034c036 100644 --- a/browser/src/Services/Configuration/FileConfigurationProvider.ts +++ b/browser/src/Services/Configuration/FileConfigurationProvider.ts @@ -26,8 +26,12 @@ const CONFIG_UPDATE_DEBOUNCE_TIME = 100 /*ms */ export class FileConfigurationProvider implements IConfigurationProvider { private _configurationFilePath: string private _containingFolder: string - private _configurationChangedEvent = new Event() - private _configurationErrorEvent = new Event() + private _configurationChangedEvent = new Event( + "FileConfigurationProvider::configurationChangedEvent", + ) + private _configurationErrorEvent = new Event( + "FileConfigurationProvider::configurationErrorEvent", + ) private _latestConfiguration: Partial = null private _lastError: Error | null = null private _configEverHadValue: boolean = false diff --git a/browser/src/Services/ContextMenu/ContextMenu.tsx b/browser/src/Services/ContextMenu/ContextMenu.tsx index c20af9e783..8578cc308f 100644 --- a/browser/src/Services/ContextMenu/ContextMenu.tsx +++ b/browser/src/Services/ContextMenu/ContextMenu.tsx @@ -80,10 +80,10 @@ export class ContextMenuManager { } export class ContextMenu { - private _onItemSelected = new Event() - private _onFilterTextChanged = new Event() - private _onHide = new Event() - private _onSelectedItemChanged = new Event() + private _onItemSelected = new Event("ContextMenu::onItemSelected") + private _onFilterTextChanged = new Event("ContextMenu::onFilterTextChanged") + private _onHide = new Event("ContextMenu::onHide") + private _onSelectedItemChanged = new Event("ContextMenu::onSelectedItemChanged") private _lastItems: any = null diff --git a/browser/src/Services/Diagnostics.ts b/browser/src/Services/Diagnostics.ts index a8d81147fe..51cab13094 100644 --- a/browser/src/Services/Diagnostics.ts +++ b/browser/src/Services/Diagnostics.ts @@ -65,7 +65,7 @@ export const getAllErrorsForFile = (fileName: string, errors: Errors): types.Dia export class DiagnosticsDataSource { private _errors: Errors = {} - private _onErrorsChangedEvent = new Event() + private _onErrorsChangedEvent = new Event("Diagnostics::onErrorsChangedEvent") public get onErrorsChanged(): IEvent { return this._onErrorsChangedEvent diff --git a/browser/src/Services/EditorManager.ts b/browser/src/Services/EditorManager.ts index e2642c9ff8..5facb38190 100644 --- a/browser/src/Services/EditorManager.ts +++ b/browser/src/Services/EditorManager.ts @@ -17,7 +17,9 @@ export class EditorManager implements Oni.EditorManager { private _allEditors: Oni.Editor[] = [] private _activeEditor: Oni.Editor = null private _anyEditorProxy: AnyEditorProxy = new AnyEditorProxy() - private _onActiveEditorChanged: Event = new Event() + private _onActiveEditorChanged: Event = new Event( + "EditorManager::onActiveEditorChanged", + ) private _closeWhenNoEditors: boolean = true @@ -95,13 +97,17 @@ class AnyEditorProxy implements Oni.Editor { private _activeEditor: Oni.Editor private _subscriptions: IDisposable[] = [] - private _onModeChanged = new Event() - private _onBufferEnter = new Event() - private _onBufferLeave = new Event() - private _onBufferChanged = new Event() - private _onBufferSaved = new Event() - private _onBufferScrolled = new Event() - private _onCursorMoved = new Event() + private _onModeChanged = new Event("EditorManager::onModeChanged") + private _onBufferEnter = new Event("EditorManager::onBufferEnter") + private _onBufferLeave = new Event("EditorManager::onBufferLeave") + private _onBufferChanged = new Event( + "EditorManager::onBufferChanged", + ) + private _onBufferSaved = new Event("EditorManager::onBufferSaved") + private _onBufferScrolled = new Event( + "EditorManager::onBufferScrolled", + ) + private _onCursorMoved = new Event("EditorManager::onCursorMoved") /** * API Methods diff --git a/browser/src/Services/Explorer/ExplorerSplit.tsx b/browser/src/Services/Explorer/ExplorerSplit.tsx index d2810cb321..436a328e7b 100644 --- a/browser/src/Services/Explorer/ExplorerSplit.tsx +++ b/browser/src/Services/Explorer/ExplorerSplit.tsx @@ -26,7 +26,7 @@ import { Explorer } from "./ExplorerView" type Node = ExplorerSelectors.ExplorerNode export class ExplorerSplit { - private _onEnterEvent: Event = new Event() + private _onEnterEvent: Event = new Event("ExplorerSplit::onEnterEvent") private _selectedId: string = null private _store: Store private _watcher: FileSystemWatcher = null diff --git a/browser/src/Services/FileSystemWatcher/index.ts b/browser/src/Services/FileSystemWatcher/index.ts index ddf967c4dd..db1cb59b4b 100644 --- a/browser/src/Services/FileSystemWatcher/index.ts +++ b/browser/src/Services/FileSystemWatcher/index.ts @@ -23,12 +23,12 @@ interface IStatsChangeEvent { export class FileSystemWatcher { private _watcher: chokidar.FSWatcher - private _onAdd = new Event() - private _onAddDir = new Event() - private _onDelete = new Event() - private _onDeleteDir = new Event() - private _onMove = new Event() - private _onChange = new Event() + private _onAdd = new Event("FileSystemWatcher::onAdd") + private _onAddDir = new Event("FileSystemWatcher::onAddDir") + private _onDelete = new Event("FileSystemWatcher::onDelete") + private _onDeleteDir = new Event("FileSystemWatcher::onDeleteDir") + private _onMove = new Event("FileSystemWatcher::onMove") + private _onChange = new Event("FileSystemWatcher::onChange") constructor({ target, options }: IFSOptions) { this._watcher = chokidar.watch(target, options) diff --git a/browser/src/Services/IconThemes/Icons.ts b/browser/src/Services/IconThemes/Icons.ts index c3bb963e70..cda7ae8b6f 100644 --- a/browser/src/Services/IconThemes/Icons.ts +++ b/browser/src/Services/IconThemes/Icons.ts @@ -72,7 +72,9 @@ export interface IIconTheme { export class Icons { private _activeIconTheme: IIconTheme = null - private _onIconThemeChangedEvent: Event = new Event() + private _onIconThemeChangedEvent: Event = new Event( + "Icons::onIconThemeChangedEvent", + ) public get activeIconTheme(): IIconTheme { return this._activeIconTheme diff --git a/browser/src/Services/Language/LanguageClientProcess.ts b/browser/src/Services/Language/LanguageClientProcess.ts index 43cd70747f..1d22929dd4 100644 --- a/browser/src/Services/Language/LanguageClientProcess.ts +++ b/browser/src/Services/Language/LanguageClientProcess.ts @@ -62,7 +62,9 @@ export interface InitializationOptions { export class LanguageClientProcess { private _process: ChildProcess private _connection: rpc.MessageConnection - private _onConnectionChangedEvent = new Event() + private _onConnectionChangedEvent = new Event( + "LanguageClientProcess::onConnectionChangedEvent", + ) private _lastWorkingDirectory: string = null private _lastRootPath: string = null diff --git a/browser/src/Services/Language/LanguageEditorIntegration.ts b/browser/src/Services/Language/LanguageEditorIntegration.ts index 543aec5532..93f1ca081d 100644 --- a/browser/src/Services/Language/LanguageEditorIntegration.ts +++ b/browser/src/Services/Language/LanguageEditorIntegration.ts @@ -32,11 +32,17 @@ export class LanguageEditorIntegration implements OniTypes.IDisposable { private _onShowDefinition: OniTypes.Event = new OniTypes.Event< IDefinitionResult - >() - private _onHideDefinition: OniTypes.Event = new OniTypes.Event() - - private _onShowHover: OniTypes.Event = new OniTypes.Event() - private _onHideHover: OniTypes.Event = new OniTypes.Event() + >("LanguageEditorIntegration::onShowDefinition") + private _onHideDefinition: OniTypes.Event = new OniTypes.Event( + "LanguageEditorIntegration::onHideDefinition", + ) + + private _onShowHover: OniTypes.Event = new OniTypes.Event( + "LanguageEditorIntegration::onShowHover", + ) + private _onHideHover: OniTypes.Event = new OniTypes.Event( + "LanguageEditorIntegration::onHideHover", + ) public get onShowDefinition(): OniTypes.IEvent { return this._onShowDefinition diff --git a/browser/src/Services/Language/LanguageManager.ts b/browser/src/Services/Language/LanguageManager.ts index 38b13bb752..cfa0748eea 100644 --- a/browser/src/Services/Language/LanguageManager.ts +++ b/browser/src/Services/Language/LanguageManager.ts @@ -273,7 +273,7 @@ export class LanguageManager { const currentSubscription = this._notificationSubscriptions[protocolMessage] if (!currentSubscription) { - const evt = new Event() + const evt = new Event("LanguageManager::evt") this._notificationSubscriptions[protocolMessage] = evt const languageClients = Object.values(this._languageServerInfo) diff --git a/browser/src/Services/Learning/Achievements/AchievementsManager.ts b/browser/src/Services/Learning/Achievements/AchievementsManager.ts index 83174d5958..13ff5b51f3 100644 --- a/browser/src/Services/Learning/Achievements/AchievementsManager.ts +++ b/browser/src/Services/Learning/Achievements/AchievementsManager.ts @@ -41,7 +41,9 @@ export class AchievementsManager { private _enabled: boolean private _currentIdleCallback: number | null = null - private _onAchievementAccomplishedEvent = new Event() + private _onAchievementAccomplishedEvent = new Event( + "AchievementsManager::onAchievementAccomplishedEvent", + ) public get enabled(): boolean { return this._enabled diff --git a/browser/src/Services/Learning/LearningPane.tsx b/browser/src/Services/Learning/LearningPane.tsx index e287a16c65..b194a3caf1 100644 --- a/browser/src/Services/Learning/LearningPane.tsx +++ b/browser/src/Services/Learning/LearningPane.tsx @@ -24,8 +24,8 @@ import { ITutorialMetadataWithProgress, TutorialManager } from "./Tutorial/Tutor import { noop } from "./../../Utility" export class LearningPane implements SidebarPane { - private _onEnter = new Event() - private _onLeave = new Event() + private _onEnter = new Event("LearningPane::onEnter") + private _onLeave = new Event("LearningPane::onLeave") constructor( private _tutorialManager: TutorialManager, diff --git a/browser/src/Services/Learning/Tutorial/TutorialBufferLayer.tsx b/browser/src/Services/Learning/Tutorial/TutorialBufferLayer.tsx index 6c56aed169..e804049440 100644 --- a/browser/src/Services/Learning/Tutorial/TutorialBufferLayer.tsx +++ b/browser/src/Services/Learning/Tutorial/TutorialBufferLayer.tsx @@ -96,7 +96,7 @@ export class TutorialBufferLayer implements Oni.BufferLayer { private _gameTracker: GameTracker = new GameTracker() private _onStateChangedEvent: Event = new Event< ITutorialBufferLayerState - >() + >("TutorialBufferLayer::onStateChangedEvent") public get id(): string { return "oni.layer.tutorial" diff --git a/browser/src/Services/Learning/Tutorial/TutorialGameplayManager.ts b/browser/src/Services/Learning/Tutorial/TutorialGameplayManager.ts index 47ea9d8525..92e1090323 100644 --- a/browser/src/Services/Learning/Tutorial/TutorialGameplayManager.ts +++ b/browser/src/Services/Learning/Tutorial/TutorialGameplayManager.ts @@ -25,10 +25,10 @@ export const TICK_RATE = 50 /* 50 ms, or 20 times pers second */ export class TutorialGameplayManager { private _activeTutorial: ITutorial private _currentStageIdx: number - private _onStateChanged = new Event() - private _onCompleted = new Event() + private _onStateChanged = new Event("TutorialGameplayManager::onStateChanged") + private _onCompleted = new Event("TutorialGameplayManager::onCompleted") private _currentState: ITutorialState = null - private _onTick = new Event() + private _onTick = new Event("TutorialGameplayManager::onTick") private _isTickInProgress: boolean = false private _buf: Oni.Buffer diff --git a/browser/src/Services/Learning/Tutorial/TutorialManager.ts b/browser/src/Services/Learning/Tutorial/TutorialManager.ts index b65179fd39..75e672a5c6 100644 --- a/browser/src/Services/Learning/Tutorial/TutorialManager.ts +++ b/browser/src/Services/Learning/Tutorial/TutorialManager.ts @@ -40,8 +40,12 @@ export class TutorialManager { private _initPromise: Promise private _persistedState: IPersistedTutorialState = { completionInfo: {} } - private _onTutorialCompletedEvent: Event = new Event() - private _onTutorialProgressChanged: Event = new Event() + private _onTutorialCompletedEvent: Event = new Event( + "TutorialManager::onTutorialCompletedEvent", + ) + private _onTutorialProgressChanged: Event = new Event( + "TutorialManager::onTutorialProgressChanged", + ) public get onTutorialCompletedEvent(): IEvent { return this._onTutorialCompletedEvent diff --git a/browser/src/Services/Menu/Menu.ts b/browser/src/Services/Menu/Menu.ts index 633da42c0e..b3864ef62b 100644 --- a/browser/src/Services/Menu/Menu.ts +++ b/browser/src/Services/Menu/Menu.ts @@ -106,10 +106,10 @@ export class MenuManager { } export class Menu implements Oni.Menu.MenuInstance { - private _onItemSelected = new Event() - private _onSelectedItemChanged = new Event() - private _onFilterTextChanged = new Event() - private _onHide = new Event() + private _onItemSelected = new Event("Menu::onItemSelected") + private _onSelectedItemChanged = new Event("Menu::onSelectedItemChanged") + private _onFilterTextChanged = new Event("Menu::onFilterTextChanged") + private _onHide = new Event("Menu::onHide") private _filterFunction = MenuFilter.fuseFilter public get onHide(): IEvent { diff --git a/browser/src/Services/Notifications/Notification.ts b/browser/src/Services/Notifications/Notification.ts index 175a96311e..685c856f89 100644 --- a/browser/src/Services/Notifications/Notification.ts +++ b/browser/src/Services/Notifications/Notification.ts @@ -17,8 +17,8 @@ export class Notification { private _expirationTime: number private _level: NotificationLevel = "info" - private _onClickEvent = new Event() - private _onCloseEvent = new Event() + private _onClickEvent = new Event("Notification::onClickEvent") + private _onCloseEvent = new Event("Notification::onCloseEvent") public get onClick(): IEvent { return this._onClickEvent diff --git a/browser/src/Services/QuickOpen/FinderProcess.ts b/browser/src/Services/QuickOpen/FinderProcess.ts index 104ff26546..768dfb3f3b 100644 --- a/browser/src/Services/QuickOpen/FinderProcess.ts +++ b/browser/src/Services/QuickOpen/FinderProcess.ts @@ -16,9 +16,9 @@ export class FinderProcess { private _lastData: string = "" - private _onData = new Event() - private _onError = new Event() - private _onComplete = new Event() + private _onData = new Event("FinderProcess::onData") + private _onError = new Event("FinderProcess::onError") + private _onComplete = new Event("FinderProcess::onComplete") private _workspace = getInstance() public get onData(): IEvent { diff --git a/browser/src/Services/Search/SearchProvider.ts b/browser/src/Services/Search/SearchProvider.ts index 1e22abd37a..24d7883098 100644 --- a/browser/src/Services/Search/SearchProvider.ts +++ b/browser/src/Services/Search/SearchProvider.ts @@ -91,8 +91,10 @@ export const ripGrepLineToSearchResultItem = (ripGrepResult: string): ISearchRes } export class RipGrepSearchQuery { - private _onSearchStartedEvent = new Event() - private _onSearchCompletedEvent = new Event() + private _onSearchStartedEvent = new Event("SearchProvider::onSearchStartedEvent") + private _onSearchCompletedEvent = new Event( + "SearchProvider::onSearchCompletedEvent", + ) private _finderProcess: FinderProcess private _items: ISearchResultItem[] = [] diff --git a/browser/src/Services/Search/index.tsx b/browser/src/Services/Search/index.tsx index 45e95c8176..771edbecd5 100644 --- a/browser/src/Services/Search/index.tsx +++ b/browser/src/Services/Search/index.tsx @@ -30,10 +30,10 @@ import { SearchPaneView } from "./SearchPaneView" import { SearchResultSpinnerView } from "./SearchResultsSpinnerView" export class SearchPane { - private _onEnter = new Event() - private _onLeave = new Event() - private _onSearchStarted = new Event() - private _onSearchCompleted = new Event() + private _onEnter = new Event("Search::onEnter") + private _onLeave = new Event("Search::onLeave") + private _onSearchStarted = new Event("Search::onSearchStarted") + private _onSearchCompleted = new Event("Search::onSearchCompleted") private _shouldFocusAutomatically: boolean = false private _searchProvider: ISearchProvider @@ -131,7 +131,7 @@ export const activate = ( sidebarManager: SidebarManager, workspace: Workspace, ) => { - const onFocusEvent = new Event() + const onFocusEvent = new Event("Search::onFocusEvent") sidebarManager.add("search", new SearchPane(editorManager, workspace, onFocusEvent)) const searchAllFiles = () => { diff --git a/browser/src/Services/Sidebar/SidebarContentSplit.tsx b/browser/src/Services/Sidebar/SidebarContentSplit.tsx index 0171097e79..1d54b4e565 100644 --- a/browser/src/Services/Sidebar/SidebarContentSplit.tsx +++ b/browser/src/Services/Sidebar/SidebarContentSplit.tsx @@ -24,8 +24,8 @@ export const getActiveEntry = (state: ISidebarState): ISidebarEntry => { * Split that is the container for the active sidebar item */ export class SidebarContentSplit { - private _onEnterEvent = new Event() - private _onLeaveEvent = new Event() + private _onEnterEvent = new Event("SidebarContentSplit::onEnterEvent") + private _onLeaveEvent = new Event("SidebarContentSplit::onLeaveEvent") public get activePane(): SidebarPane { const entry = getActiveEntry(this._sidebarManager.store.getState()) diff --git a/browser/src/Services/Sneak/Sneak.tsx b/browser/src/Services/Sneak/Sneak.tsx index df921e2952..b556f7e637 100644 --- a/browser/src/Services/Sneak/Sneak.tsx +++ b/browser/src/Services/Sneak/Sneak.tsx @@ -26,7 +26,7 @@ export class Sneak { private _activeOverlay: Overlay private _providers: SneakProvider[] = [] private _store: Store - private _onSneakCompleted = new Event() + private _onSneakCompleted = new Event("Sneak::onSneakCompleted") public get onSneakCompleted(): IEvent { return this._onSneakCompleted diff --git a/browser/src/Services/Snippets/SnippetSession.ts b/browser/src/Services/Snippets/SnippetSession.ts index e1202a1bd5..e711981eeb 100644 --- a/browser/src/Services/Snippets/SnippetSession.ts +++ b/browser/src/Services/Snippets/SnippetSession.ts @@ -79,10 +79,10 @@ export class SnippetSession { private _buffer: IBuffer private _snippet: OniSnippet private _position: types.Position - private _onCancelEvent: Event = new Event() + private _onCancelEvent: Event = new Event("SnippetSession::onCancelEvent") private _onCursorMovedEvent: Event = new Event< IMirrorCursorUpdateEvent - >() + >("SnippetSession::onCursorMovedEvent") // Get state of line where we inserted private _prefix: string diff --git a/browser/src/Services/Themes/ThemeManager.ts b/browser/src/Services/Themes/ThemeManager.ts index 9b71d9d513..7741e0d889 100644 --- a/browser/src/Services/Themes/ThemeManager.ts +++ b/browser/src/Services/Themes/ThemeManager.ts @@ -303,7 +303,7 @@ export const DefaultTheme: IThemeMetadata = { } export class ThemeManager { - private _onThemeChangedEvent: Event = new Event() + private _onThemeChangedEvent: Event = new Event("ThemeManager::onThemeChangedEvent") private _activeTheme: IThemeMetadata = DefaultTheme diff --git a/browser/src/Services/TokenColors.ts b/browser/src/Services/TokenColors.ts index 951010dcf7..812347cd9f 100644 --- a/browser/src/Services/TokenColors.ts +++ b/browser/src/Services/TokenColors.ts @@ -27,7 +27,9 @@ import { ThemeManager } from "./Themes" export class TokenColors implements IDisposable { private _subscriptions: IDisposable[] = [] private _tokenColors: TokenColor[] = [] - private _onTokenColorsChangedEvent: Event = new Event() + private _onTokenColorsChangedEvent: Event = new Event( + "TokenColors::onTokenColorsChangedEvent", + ) private _defaultTokenColors: TokenColor[] = [] diff --git a/browser/src/Services/TypingPredictionManager.ts b/browser/src/Services/TypingPredictionManager.ts index a3a2997a3b..e9885a02c1 100644 --- a/browser/src/Services/TypingPredictionManager.ts +++ b/browser/src/Services/TypingPredictionManager.ts @@ -21,7 +21,9 @@ export interface ITypingPrediction { } export class TypingPredictionManager { - private _predictionsChanged: Event = new Event() + private _predictionsChanged: Event = new Event( + "TypingPredictionManager::predictionsChanged", + ) private _predictions: IPredictedCharacter[] = [] private _backgroundColor: string private _foregroundColor: string diff --git a/browser/src/Services/UnhandledErrorMonitor.ts b/browser/src/Services/UnhandledErrorMonitor.ts index c4824ff2fa..ba803d6bd6 100644 --- a/browser/src/Services/UnhandledErrorMonitor.ts +++ b/browser/src/Services/UnhandledErrorMonitor.ts @@ -12,8 +12,12 @@ import { Notifications } from "./Notifications" import * as Log from "oni-core-logging" export class UnhandledErrorMonitor { - private _onUnhandledErrorEvent = new Event() - private _onUnhandledRejectionEvent = new Event() + private _onUnhandledErrorEvent = new Event( + "UnhandledErrorMonitor::onUnhandledErrorEvent", + ) + private _onUnhandledRejectionEvent = new Event( + "UnhandledErrorMonitor::onUnhandledRejectionEvent", + ) private _queuedErrors: Error[] = [] private _queuedRejections: string[] = [] diff --git a/browser/src/Services/WindowManager/WindowManager.ts b/browser/src/Services/WindowManager/WindowManager.ts index f09b93fd64..68ea2c0068 100644 --- a/browser/src/Services/WindowManager/WindowManager.ts +++ b/browser/src/Services/WindowManager/WindowManager.ts @@ -109,7 +109,7 @@ export class WindowManager { private _lastId: number = 0 private _idToSplit: { [key: string]: IAugmentedSplitInfo } = {} - private _onUnhandledMoveEvent = new Event() + private _onUnhandledMoveEvent = new Event("WindowManager::onUnhandledMoveEvent") private _leftDock: WindowDockNavigator = null private _primarySplit: LinearSplitProvider @@ -125,7 +125,9 @@ export class WindowManager { return this._onUnhandledMoveEvent } - private _onFocusChanged = new Event>() + private _onFocusChanged = new Event>( + "WindowManager::onFocusChanged", + ) public get onFocusChanged(): IEvent> { return this._onFocusChanged diff --git a/browser/src/Services/Workspace/Workspace.ts b/browser/src/Services/Workspace/Workspace.ts index c87764520f..97f5e1af82 100644 --- a/browser/src/Services/Workspace/Workspace.ts +++ b/browser/src/Services/Workspace/Workspace.ts @@ -38,9 +38,9 @@ export interface IWorkspace extends Oni.Workspace.Api { } export class Workspace implements IWorkspace { - private _onDirectoryChangedEvent = new Event() - private _onFocusGainedEvent = new Event() - private _onFocusLostEvent = new Event() + private _onDirectoryChangedEvent = new Event("Workspace::onDirectoryChangedEvent") + private _onFocusGainedEvent = new Event("Workspace::onFocusGainedEvent") + private _onFocusLostEvent = new Event("Workspace::onFocusLostEvent") private _mainWindow = remote.getCurrentWindow() private _lastActiveBuffer: Oni.Buffer private _activeWorkspace: string diff --git a/browser/src/UI/components/VimNavigator.tsx b/browser/src/UI/components/VimNavigator.tsx index b4711f9243..2867f78496 100644 --- a/browser/src/UI/components/VimNavigator.tsx +++ b/browser/src/UI/components/VimNavigator.tsx @@ -43,7 +43,7 @@ export interface IVimNavigatorState { export class VimNavigator extends React.PureComponent { private _activeBinding: IMenuBinding = null - private _activateEvent = new Event() + private _activateEvent = new Event("VimNavigator::activateEvent") constructor(props: IVimNavigatorProps) { super(props) diff --git a/browser/src/neovim/NeovimAutoCommands.ts b/browser/src/neovim/NeovimAutoCommands.ts index 2d99cd1341..f2440ebfdf 100644 --- a/browser/src/neovim/NeovimAutoCommands.ts +++ b/browser/src/neovim/NeovimAutoCommands.ts @@ -30,17 +30,31 @@ export interface INeovimAutoCommands { export class NeovimAutoCommands { // Autocommand events private _nameToEvent: { [key: string]: Event } - private _onBufEnterEvent = new Event() - private _onBufWritePostEvent = new Event() - private _onBufWipeoutEvent = new Event() - private _onBufDeleteEvent = new Event() - private _onBufUnloadEvent = new Event() - private _onBufWinEnterEvent = new Event() - private _onFileTypeChangedEvent = new Event() - private _onWinEnterEvent = new Event() - private _onCursorMovedEvent = new Event() - private _onCursorMovedIEvent = new Event() - private _onVimResizedEvent = new Event() + private _onBufEnterEvent = new Event("NeovimAutoCommands::onBufEnterEvent") + private _onBufWritePostEvent = new Event( + "NeovimAutoCommands::onBufWritePostEvent", + ) + private _onBufWipeoutEvent = new Event( + "NeovimAutoCommands::onBufWipeoutEvent", + ) + private _onBufDeleteEvent = new Event( + "NeovimAutoCommands::onBufDeleteEvent", + ) + private _onBufUnloadEvent = new Event( + "NeovimAutoCommands::onBufUnloadEvent", + ) + private _onBufWinEnterEvent = new Event( + "NeovimAutoCommands::onBufWinEnterEvent", + ) + private _onFileTypeChangedEvent = new Event( + "NeovimAutoCommands::onFileTypeChangedEvent", + ) + private _onWinEnterEvent = new Event("NeovimAutoCommands::onWinEnterEvent") + private _onCursorMovedEvent = new Event("NeovimAutoCommands::onCursorMovedEvent") + private _onCursorMovedIEvent = new Event( + "NeovimAutoCommands::onCursorMovedIEvent", + ) + private _onVimResizedEvent = new Event("NeovimAutoCommands::onVimResizedEvent") public get onBufEnter(): IEvent { return this._onBufEnterEvent diff --git a/browser/src/neovim/NeovimBufferUpdateManager.ts b/browser/src/neovim/NeovimBufferUpdateManager.ts index a9879e0550..5691c97e8f 100644 --- a/browser/src/neovim/NeovimBufferUpdateManager.ts +++ b/browser/src/neovim/NeovimBufferUpdateManager.ts @@ -20,7 +20,9 @@ export interface INeovimBufferUpdate { } export class NeovimBufferUpdateManager { - private _onBufferUpdateEvent = new Event() + private _onBufferUpdateEvent = new Event( + "NeovimBufferUpdateManager::onBufferUpdateEvent", + ) private _lastEventContext: EventContext private _lastMode: string diff --git a/browser/src/neovim/NeovimInstance.ts b/browser/src/neovim/NeovimInstance.ts index 6f4c9dbaf6..8ccfe05b6c 100644 --- a/browser/src/neovim/NeovimInstance.ts +++ b/browser/src/neovim/NeovimInstance.ts @@ -223,29 +223,37 @@ export class NeovimInstance extends EventEmitter implements INeovimInstance { private _marks: NeovimMarks private _initComplete: boolean - private _onDirectoryChanged = new Event() - private _onErrorEvent = new Event() - private _onYank = new Event() - private _onOniCommand = new Event() - private _onRedrawComplete = new Event() - private _onScroll = new Event() - private _onTitleChanged = new Event() - private _onModeChanged = new Event() - private _onHidePopupMenu = new Event() - private _onShowPopupMenu = new Event() - private _onSelectPopupMenu = new Event() - private _onLeave = new Event() - private _onMessage = new Event() - - private _onColorsChanged = new Event() - - private _onCommandLineShowEvent = new Event() - private _onCommandLineHideEvent = new Event() - private _onCommandLineSetCursorPositionEvent = new Event() - private _onVimEvent = new Event() - private _onWildMenuHideEvent = new Event() - private _onWildMenuSelectEvent = new Event() - private _onWildMenuShowEvent = new Event() + private _onDirectoryChanged = new Event("NeovimInstance::onDirectoryChanged") + private _onErrorEvent = new Event("NeovimInstance::onErrorEvent") + private _onYank = new Event("NeovimInstance::onYank") + private _onOniCommand = new Event("NeovimInstance::onOniCommand") + private _onRedrawComplete = new Event("NeovimInstance::onRedrawComplete") + private _onScroll = new Event("NeovimInstance::onScroll") + private _onTitleChanged = new Event("NeovimInstance::onTitleChanged") + private _onModeChanged = new Event("NeovimInstance::onModeChanged") + private _onHidePopupMenu = new Event("NeovimInstance::onHidePopupMenu") + private _onShowPopupMenu = new Event("NeovimInstance::onShowPopupMenu") + private _onSelectPopupMenu = new Event("NeovimInstance::onSelectPopupMenu") + private _onLeave = new Event("NeovimInstance::onLeave") + private _onMessage = new Event("NeovimInstance::onMessage") + + private _onColorsChanged = new Event("NeovimInstance::onColorsChanged") + + private _onCommandLineShowEvent = new Event( + "NeovimInstance::onCommandLineShowEvent", + ) + private _onCommandLineHideEvent = new Event("NeovimInstance::onCommandLineHideEvent") + private _onCommandLineSetCursorPositionEvent = new Event( + "NeovimInstance::onCommandLineSetCursorPositionEvent", + ) + private _onVimEvent = new Event("NeovimInstance::onVimEvent") + private _onWildMenuHideEvent = new Event("NeovimInstance::onWildMenuHideEvent") + private _onWildMenuSelectEvent = new Event( + "NeovimInstance::onWildMenuSelectEvent", + ) + private _onWildMenuShowEvent = new Event( + "NeovimInstance::onWildMenuShowEvent", + ) private _bufferUpdateManager: NeovimBufferUpdateManager private _tokenColorSynchronizer: NeovimTokenColorSynchronizer diff --git a/browser/src/neovim/NeovimMarks.ts b/browser/src/neovim/NeovimMarks.ts index 9fa68825f0..ca3a5be925 100644 --- a/browser/src/neovim/NeovimMarks.ts +++ b/browser/src/neovim/NeovimMarks.ts @@ -99,7 +99,7 @@ export const parseMarkLine = (markLine: string): INeovimMarkInfo => { } export class NeovimMarks { - private _onMarksUpdatedEvent = new Event() + private _onMarksUpdatedEvent = new Event("NeovimMarks::onMarksUpdatedEvent") private _isWatching: boolean = false public get onMarksUpdated(): IEvent { diff --git a/browser/src/neovim/NeovimWindowManager.ts b/browser/src/neovim/NeovimWindowManager.ts index 59294eacc5..bb8af40d09 100644 --- a/browser/src/neovim/NeovimWindowManager.ts +++ b/browser/src/neovim/NeovimWindowManager.ts @@ -54,7 +54,9 @@ export interface NeovimInactiveWindowState { export class NeovimWindowManager extends Utility.Disposable { private _scrollObservable: Subject - private _onWindowStateChangedEvent = new Event() + private _onWindowStateChangedEvent = new Event( + "NeovimWindowManager::onWindowStateChangedEvent", + ) public get onWindowStateChanged(): IEvent { return this._onWindowStateChangedEvent diff --git a/browser/src/neovim/SharedNeovimInstance.ts b/browser/src/neovim/SharedNeovimInstance.ts index a18cb3f5fa..e246088bbf 100644 --- a/browser/src/neovim/SharedNeovimInstance.ts +++ b/browser/src/neovim/SharedNeovimInstance.ts @@ -35,7 +35,7 @@ export interface IMenuBinding extends IBinding { } export class Binding implements IBinding { - private _onReleasedEvent: Event = new Event() + private _onReleasedEvent: Event = new Event("SharedNeovimInstance::onReleasedEvent") private _subscriptions: IDisposable[] = [] public get onReleased(): IEvent { @@ -68,7 +68,9 @@ export class Binding implements IBinding { export class MenuBinding extends Binding implements IMenuBinding { private _currentOptions: string[] = [] private _currentId: string = null - private _onCursorMovedEvent: Event = new Event() + private _onCursorMovedEvent: Event = new Event( + "SharedNeovimInstance::onCursorMovedEvent", + ) private _promiseQueue = new PromiseQueue() private _isUpdating: boolean = false diff --git a/browser/test/Mocks/index.ts b/browser/test/Mocks/index.ts index 1e9d656d2e..0a1bc0b272 100644 --- a/browser/test/Mocks/index.ts +++ b/browser/test/Mocks/index.ts @@ -52,7 +52,7 @@ import { MockBuffer } from "./MockBuffer" export class MockConfiguration { private _currentConfigurationFiles: string[] = [] - private _onConfigurationChanged = new Event() + private _onConfigurationChanged = new Event("Mocks::onConfigurationChanged") public get onConfigurationChanged(): IEvent { return this._onConfigurationChanged @@ -89,9 +89,9 @@ export class MockConfiguration { export class MockWorkspace implements IWorkspace { private _activeWorkspace: string = null - private _onDirectoryChangedEvent = new Event() - private _onFocusGainedEvent = new Event() - private _onFocusLostEvent = new Event() + private _onDirectoryChangedEvent = new Event("Mocks::onDirectoryChangedEvent") + private _onFocusGainedEvent = new Event("Mocks::onFocusGainedEvent") + private _onFocusLostEvent = new Event("Mocks::onFocusLostEvent") public get onDirectoryChanged(): IEvent { return this._onDirectoryChangedEvent diff --git a/browser/test/Services/Configuration/ConfigurationTests.ts b/browser/test/Services/Configuration/ConfigurationTests.ts index 372ac8c376..5e346eeb25 100644 --- a/browser/test/Services/Configuration/ConfigurationTests.ts +++ b/browser/test/Services/Configuration/ConfigurationTests.ts @@ -25,6 +25,7 @@ describe("Configuration", () => { configuration.addConfigurationProvider(configProvider) assert.strictEqual(configuration.getValue("test.config"), 2) + configuration.removeConfigurationProvider(configProvider) }) it("triggers error event when provider has an error", () => { @@ -41,6 +42,7 @@ describe("Configuration", () => { configProvider.simulateError(new Error("test error")) assert.strictEqual(errors.length, 1, "Validate an error was captured") + configuration.removeConfigurationProvider(configProvider) }) it("triggers change event when provider has an update", () => { @@ -62,6 +64,7 @@ describe("Configuration", () => { 3, "Validate configuration was updated", ) + configuration.removeConfigurationProvider(configProvider) }) it("triggers updated event with requireReload true", () => { @@ -310,8 +313,12 @@ export class MockPersistedConfiguration implements IPersistedConfiguration { } export class MockConfigurationProvider implements IConfigurationProvider { - private _onConfigurationChangedEvent = new Event() - private _onConfigurationErrorEvent = new Event() + private _onConfigurationChangedEvent = new Event( + "ConfigurationTests::onConfigurationChangedEvent", + ) + private _onConfigurationErrorEvent = new Event( + "ConfigurationTests::onConfigurationErrorEvent", + ) private _values: GenericConfigurationValues = {} private _lastError: Error | null = null diff --git a/browser/test/Services/TokenColorsTests.ts b/browser/test/Services/TokenColorsTests.ts index f48fdff5fe..62cbddcee8 100644 --- a/browser/test/Services/TokenColorsTests.ts +++ b/browser/test/Services/TokenColorsTests.ts @@ -31,25 +31,28 @@ describe("TokenColors", () => { await themeManager.setTheme("testTheme") assert.strictEqual(hitCount, 1, "Validate onTokenColorsChanged was fired") + tokenColors.dispose() }) - it("if configuration is updated, but 'editor.tokenColors' isn't there, onTokenColorsChanged should not be triggered", () => { + it("if 'editor.tokenColors' is updated from the config, onTokenColorsChanged event should be triggered", () => { const tokenColors = new TokenColors(mockConfiguration as any, themeManager) let hitCount = 0 tokenColors.onTokenColorsChanged.subscribe(() => hitCount++) - mockConfiguration.simulateConfigurationChangedEvent({ someConfigValue: 2 }) - assert.strictEqual(hitCount, 0, "Validate onTokenColorsChanged was fired") + mockConfiguration.simulateConfigurationChangedEvent({ "editor.tokenColors": [] }) + assert.strictEqual(hitCount, 1, "Validate onTokenColorsChanged was fired") + tokenColors.dispose() }) - it("if 'editor.tokenColors' is updated from the config, onTokenColorsChanged event should be triggered", () => { + it("if configuration is updated, but 'editor.tokenColors' isn't there, onTokenColorsChanged should not be triggered", () => { const tokenColors = new TokenColors(mockConfiguration as any, themeManager) let hitCount = 0 tokenColors.onTokenColorsChanged.subscribe(() => hitCount++) - mockConfiguration.simulateConfigurationChangedEvent({ "editor.tokenColors": [] }) - assert.strictEqual(hitCount, 1, "Validate onTokenColorsChanged was fired") + mockConfiguration.simulateConfigurationChangedEvent({ someConfigValue: 2 }) + assert.strictEqual(hitCount, 0, "Validate onTokenColorsChanged was fired") + tokenColors.dispose() }) }) diff --git a/ui-tests/BrowserView.test.tsx b/ui-tests/BrowserView.test.tsx index a406367312..1afdd3b887 100644 --- a/ui-tests/BrowserView.test.tsx +++ b/ui-tests/BrowserView.test.tsx @@ -11,7 +11,7 @@ import { } from "../browser/src/Services/Browser/BrowserView" import { Configuration } from "../browser/src/Services/Configuration" -const mockEvent = new Event() +const mockEvent = new Event("BrowserView::mockEvent") const dispatch = () => mockEvent.dispatch() const MockWebviewElement = (spy: (args?: any) => void) =>