Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

[WIP] Bugfix/vcs deactivation race condition #2453

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
52e82ba
add p-queue and wait till queue is idle before calling deactivateProv…
akinsho Jul 23, 2018
a691b1a
correctly return deactivation promise and await it
akinsho Jul 24, 2018
e87bf78
fix vcs deregistering test
akinsho Jul 24, 2018
02e94bc
Merge branch 'master' of https://github.com/onivim/oni into feature/a…
akinsho Jul 24, 2018
32c6e7d
convert deactivateProvider to async/await
akinsho Jul 25, 2018
c667874
Move API out (#2459)
TalAmuyal Jul 25, 2018
c465082
Feature/ Indent lines improvements (#2446)
akinsho Jul 25, 2018
d471144
Fix + tidy descriptions of Explorer commands (#2460)
feltech Jul 26, 2018
06f476c
Add Lennaert Meijvogel as a backer - thank you! :)
bryphe Jul 26, 2018
97f643e
remove cursor moved audit time add scroll observable to close signatu…
akinsho Jul 26, 2018
0d20916
Bump oni-neovim-binaries version. (#2461)
CrossR Jul 26, 2018
759918d
Ignore Yarn from Linguist. (#2462)
CrossR Jul 26, 2018
b901ecd
Markdown Syntax Highlights (#2332)
CrossR Jul 26, 2018
e2c3fef
Feature/uncommit unstage functionality (#2457)
akinsho Jul 26, 2018
b6bdb4b
Explorer: Locate Current Buffer (#2429)
feltech Jul 26, 2018
b2ef17f
Jump to files/directories created in the Explorer (#2468)
feltech Jul 27, 2018
b921412
Add the CLI scripts back to the build command. (#2463)
CrossR Jul 27, 2018
97f0c61
Refocus previously open menu on reactivating Oni (#2472)
feltech Jul 29, 2018
25ab4a2
Revert "Refocus previously open menu on reactivating Oni" (#2478)
akinsho Jul 30, 2018
70388b1
Add Jonas Strømsodd as a backer - thank you! :)
bryphe Aug 1, 2018
2c03e73
Move API to oni-api and use it in preparetion for pluginization (#2473)
TalAmuyal Aug 2, 2018
66a13f5
Feature/git blame layer (#2469)
akinsho Aug 2, 2018
60c647e
Fix sidebar search (#2489)
TalAmuyal Aug 5, 2018
a54bb2c
Fix local building issue (#2488)
TalAmuyal Aug 9, 2018
795636c
Bugfix/commit loading (#2492)
akinsho Aug 16, 2018
127a2bc
Bugfix/buffer scrollbar fixes (#2495)
akinsho Aug 19, 2018
dd4b33d
Fix for 2272 - <f12> opens in current tab (#2504)
psxpaul Aug 19, 2018
910559c
Changed spacing of elements in the explorer sidebar to be more readab…
g-erson Aug 20, 2018
2fd82f3
Feature/Color-highlight improvements (#2447)
akinsho Aug 21, 2018
e3f65e6
Feature/oni sessions (#2479)
akinsho Aug 22, 2018
e482ae8
Fix for #2414 - truncated copy/paste (#2515)
psxpaul Aug 27, 2018
e612eb8
Bugfix/fix welcome buffer layer (#2522)
akinsho Aug 28, 2018
4ce6b22
Fix bug when pasting in command line mode (#2528)
psxpaul Aug 29, 2018
a396537
Add commands to jump to previous/next error (#2526)
psxpaul Aug 29, 2018
5beff5f
Feature/add sessions to welcome (#2527)
akinsho Aug 30, 2018
b17bac2
add p-queue and wait till queue is idle before calling deactivateProv…
akinsho Jul 23, 2018
5afbf17
correctly return deactivation promise and await it
akinsho Jul 24, 2018
28ba31c
fix vcs deregistering test
akinsho Jul 24, 2018
faa26b6
convert deactivateProvider to async/await
akinsho Jul 25, 2018
436ab91
fix any typing of unhandledrejection handler
akinsho Aug 31, 2018
be21fe1
Use utility attempt function to call vcs methods
akinsho Aug 31, 2018
74966ad
move call to initialize to after activate :shrug:"
akinsho Aug 31, 2018
7e9ef86
merge remote version fix conflicts
akinsho Aug 31, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Move API out (#2459)
Thanks, @Akin909 :)
  • Loading branch information
TalAmuyal authored Jul 25, 2018
commit c66787474ca09ebe6f3445fbef66f465ce12f08c
17 changes: 8 additions & 9 deletions browser/src/Editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,10 @@ import * as types from "vscode-languageserver-types"

import { Disposable } from "./../Utility"

export interface IEditor extends Oni.Editor {
// Methods
init(filesToOpen: string[]): void
render(): JSX.Element

setSelection(selectionRange: types.Range): Promise<void>
}

/**
* Base class for Editor implementations
*/
export class Editor extends Disposable implements Oni.Editor {
export abstract class Editor extends Disposable implements Oni.Editor {
private _currentMode: string
private _onBufferEnterEvent = new Event<Oni.EditorBufferEventArgs>()
private _onBufferLeaveEvent = new Event<Oni.EditorBufferEventArgs>()
Expand All @@ -44,7 +36,10 @@ export class Editor extends Disposable implements Oni.Editor {
return this._onCursorMoved
}

public abstract init(filesToOpen: string[]): void

// Events

public get onModeChanged(): IEvent<Oni.Vim.Mode> {
return this._onModeChangedEvent
}
Expand Down Expand Up @@ -90,6 +85,10 @@ export class Editor extends Disposable implements Oni.Editor {
return Promise.reject("Not implemented")
}

public abstract render(): JSX.Element

public abstract setSelection(selectionRange: types.Range): Promise<void>

protected setMode(mode: Oni.Vim.Mode): void {
if (mode !== this._currentMode) {
this._currentMode = mode
Expand Down
6 changes: 3 additions & 3 deletions browser/src/Editor/NeovimEditor/NeovimEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* NeovimEditor.ts
*
* IEditor implementation for Neovim
* Editor implementation for Neovim
*/

import * as os from "os"
Expand Down Expand Up @@ -66,7 +66,7 @@ import { IThemeMetadata, ThemeManager } from "./../../Services/Themes"
import { TypingPredictionManager } from "./../../Services/TypingPredictionManager"
import { Workspace } from "./../../Services/Workspace"

import { Editor, IEditor } from "./../Editor"
import { Editor } from "./../Editor"

import { BufferManager, IBuffer } from "./../BufferManager"
import { CompletionMenu } from "./CompletionMenu"
Expand Down Expand Up @@ -99,7 +99,7 @@ import { CanvasRenderer } from "../../Renderer/CanvasRenderer"
import { WebGLRenderer } from "../../Renderer/WebGL/WebGLRenderer"
import { getInstance as getNotificationsInstance } from "./../../Services/Notifications"

export class NeovimEditor extends Editor implements IEditor {
export class NeovimEditor extends Editor implements Oni.Editor {
private _bufferManager: BufferManager
private _neovimInstance: NeovimInstance
private _renderer: INeovimRenderer
Expand Down
6 changes: 2 additions & 4 deletions browser/src/Editor/OniEditor/OniEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* OniEditor.ts
*
* IEditor implementation for Oni
* Editor implementation for Oni
*
* Extends the capabilities of the NeovimEditor
*/
Expand Down Expand Up @@ -41,8 +41,6 @@ import { ThemeManager } from "./../../Services/Themes"
import { TokenColors } from "./../../Services/TokenColors"
import { Workspace } from "./../../Services/Workspace"

import { IEditor } from "./../Editor"

import { BufferScrollBarContainer } from "./containers/BufferScrollBarContainer"
import { DefinitionContainer } from "./containers/DefinitionContainer"
import { ErrorsContainer } from "./containers/ErrorsContainer"
Expand All @@ -64,7 +62,7 @@ const wrapReactComponentWithLayer = (id: string, component: JSX.Element): Oni.Bu
}
}

export class OniEditor extends Utility.Disposable implements IEditor {
export class OniEditor extends Utility.Disposable implements Oni.Editor {
private _neovimEditor: NeovimEditor

public get mode(): string {
Expand Down
40 changes: 5 additions & 35 deletions browser/src/Plugins/Api/Oni.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ import { inputManager } from "./../../Services/InputManager"
import * as LanguageManager from "./../../Services/Language"
import { getTutorialManagerInstance } from "./../../Services/Learning"
import { getInstance as getAchievementsInstance } from "./../../Services/Learning/Achievements"
import {
getInstance as getMenuManagerInstance,
IMenuOptionWithHighlights,
} from "./../../Services/Menu"
import { getInstance as getMenuManagerInstance } from "./../../Services/Menu"
import { getInstance as getFiltersInstance } from "./../../Services/Menu/Filter"
import { getInstance as getNotificationsInstance } from "./../../Services/Notifications"
import { getInstance as getOverlayInstance } from "./../../Services/Overlay"
Expand All @@ -47,35 +44,8 @@ import { Search } from "./../../Services/Search/SearchProvider"

import * as throttle from "lodash/throttle"

import { ISearch } from "./Search" // TODO: Move to oni-api

const react = require("react") // tslint:disable-line no-var-requires

// TODO: Move to oni-api
export interface QuickFixEntry {
filename: string
lnum: number
col: number
text: string
}

// TODO: Move to oni-api under `menu`
export type IMenuFilter = (options: any[], searchString: string) => IMenuOptionWithHighlights[]

// TODO: Move to oni-api under `menu`
export interface IMenuFilters {
getDefault(): IMenuFilter
getByName(name: string): IMenuFilter
}

export interface ApiNext {
search: ISearch
ui: Ui
filter: IMenuFilters // TODO: Move to oni-api under menu

populateQuickFix(entries: QuickFixEntry[]): void
}

export class Dependencies {
public get React(): any {
return react
Expand All @@ -89,7 +59,7 @@ const helpers = {
/**
* API instance for interacting with OniApi (and vim)
*/
export class Oni implements OniApi.Plugin.Api, ApiNext {
export class Oni implements OniApi.Plugin.Api {
private _dependencies: Dependencies
private _ui: Ui
private _services: Services
Expand Down Expand Up @@ -158,7 +128,7 @@ export class Oni implements OniApi.Plugin.Api, ApiNext {
return getMenuManagerInstance()
}

public get filter(): IMenuFilters {
public get filter(): OniApi.Menu.IMenuFilters {
return getFiltersInstance("") // TODO: Pass either "core" or plugin's name
}

Expand Down Expand Up @@ -218,7 +188,7 @@ export class Oni implements OniApi.Plugin.Api, ApiNext {
return helpers
}

public get search(): ISearch {
public get search(): OniApi.Search.ISearch {
return new Search()
}

Expand All @@ -228,7 +198,7 @@ export class Oni implements OniApi.Plugin.Api, ApiNext {
this._services = new Services()
}

public populateQuickFix(entries: QuickFixEntry[]): void {
public populateQuickFix(entries: OniApi.QuickFixEntry[]): void {
const neovim: any = editorManager.activeEditor.neovim
neovim.quickFix.setqflist(entries, "Search Results")
neovim.command(":copen")
Expand Down
32 changes: 0 additions & 32 deletions browser/src/Plugins/Api/Search.ts

This file was deleted.

4 changes: 3 additions & 1 deletion browser/src/Plugins/Api/Ui.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as Oni from "oni-api"

import { getFileIcon } from "../../Services/FileIcon"
import { getInstance } from "../../Services/IconThemes"
import { Icon, IconProps, IconSize } from "../../UI/Icon"

export class Ui {
export class Ui implements Oni.Ui.IUi {
constructor(private _react: any) {}

public createIcon(props: IconProps): any {
Expand Down
26 changes: 26 additions & 0 deletions browser/src/Services/EditorManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import * as Oni from "oni-api"
import { Event, IDisposable, IEvent } from "oni-types"

import * as types from "vscode-languageserver-types"

import { remote } from "electron"

export class EditorManager implements Oni.EditorManager {
Expand Down Expand Up @@ -123,6 +125,14 @@ class AnyEditorProxy implements Oni.Editor {
return this._activeEditor.activeBuffer
}

public init(filesToOpen: string[]): void {
if (!this._activeEditor) {
return
}

this._activeEditor.init(filesToOpen)
}

public get neovim(): Oni.NeovimEditorCapability {
if (!this._activeEditor) {
return null
Expand Down Expand Up @@ -181,6 +191,22 @@ class AnyEditorProxy implements Oni.Editor {
return this._activeEditor.setTextOptions(options)
}

public render(): JSX.Element {
if (!this._activeEditor) {
return null
}

return this._activeEditor.render()
}

public setSelection(selectionRange: types.Range): Promise<void> {
if (!this._activeEditor) {
return null
}

return this._activeEditor.setSelection(selectionRange)
}

/**
* Internal methods
*/
Expand Down
13 changes: 6 additions & 7 deletions browser/src/Services/Menu/Filter/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
// import * as Oni from "oni-api"
import * as OniNext from "../../../Plugins/Api/Oni"
import * as Oni from "oni-api"

import { filter as fuseFilter } from "./FuseFilter"
import { filter as noFilter } from "./NoFilter"
import { filter as RegExFilter } from "./RegExFilter"
import { filter as vscodeFilter } from "./VSCodeFilter"

class Filters implements OniNext.IMenuFilters {
private _filters = new Map<string, OniNext.IMenuFilter>()
class Filters implements Oni.Menu.IMenuFilters {
private _filters = new Map<string, Oni.Menu.IMenuFilter>()

constructor() {
this._filters
Expand All @@ -18,11 +17,11 @@ class Filters implements OniNext.IMenuFilters {
.set("vscode", vscodeFilter)
}

public getDefault(): OniNext.IMenuFilter {
public getDefault(): Oni.Menu.IMenuFilter {
return this.getByName("default")
}

public getByName(name: string): OniNext.IMenuFilter {
public getByName(name: string): Oni.Menu.IMenuFilter {
return this._filters.has(name) ? this._filters.get(name) : this.getDefault()
}

Expand All @@ -31,6 +30,6 @@ class Filters implements OniNext.IMenuFilters {

const _instance = new Filters()

export function getInstance(owner: string): OniNext.IMenuFilters {
export function getInstance(owner: string): Oni.Menu.IMenuFilters {
return _instance
}
5 changes: 2 additions & 3 deletions browser/src/Services/Search/SearchPaneView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Entry point for search-related features
*/

import * as Oni from "oni-api"
import * as React from "react"

import { IDisposable, IEvent } from "oni-types"
Expand All @@ -12,8 +13,6 @@ import { Workspace } from "./../Workspace"

export * from "./SearchProvider"

import * as SearchApi from "./../../Plugins/Api/Search" // TODO: Import oni-api instead

import styled from "styled-components"
import { SearchTextBox } from "./SearchTextBox"

Expand All @@ -31,7 +30,7 @@ export interface ISearchPaneViewProps {
onFocus: IEvent<void>
focusImmediately?: boolean

onSearchOptionsChanged: (opts: SearchApi.Options) => void
onSearchOptionsChanged: (opts: Oni.Search.Options) => void
}

export interface ISearchPaneViewState {
Expand Down
Loading