Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
8a8e6dc
Revert "Refocus previously open menu on reactivating Oni (#2472)"
akinsho Jul 29, 2018
6f6464e
Merge branch 'master' of https://github.com/onivim/oni
akinsho Jul 31, 2018
7c10e8c
Merge branch 'master' of https://github.com/onivim/oni
akinsho Aug 2, 2018
52f3252
add initial git blame layer implementation
akinsho Jul 26, 2018
430db6b
make component absolute and pass position to component
akinsho Jul 26, 2018
76cd76e
add cursor to layer context and use it render positional blame
akinsho Jul 26, 2018
a815bad
render blame inline if possible otherwise render above
akinsho Jul 26, 2018
8cd9146
format blame date str and add format date to utils
akinsho Jul 26, 2018
79e3a93
change ordering of blame message
akinsho Jul 27, 2018
71ae13d
format time as time since and update styles for blame
akinsho Jul 27, 2018
6e30640
separate out inline and hover styles
akinsho Jul 27, 2018
c361009
rename inline var
akinsho Jul 27, 2018
82dbfc2
add out of bounds checking
akinsho Jul 27, 2018
16d2d1a
add more error handling to out of bounds check dar
akinsho Jul 27, 2018
a1ae69b
darken text in blame
akinsho Jul 27, 2018
eaac952
fix lint error in blame layer
akinsho Jul 27, 2018
24e2570
fix existing broken tests
akinsho Jul 27, 2018
aff09e0
add config options and experimental flag
akinsho Jul 27, 2018
6535c5d
fix lint errors
akinsho Jul 27, 2018
dfc2559
fix cursor line variants naming
akinsho Jul 27, 2018
e95ffa6
fix comment change order of updateBlameCall
akinsho Jul 27, 2018
e3a4c2f
use get derived props from state to prevent initial render flicker
akinsho Jul 27, 2018
7e2ded3
switch back to concurrently for start
akinsho Jul 27, 2018
95bdefd
remove unsed var in blame container
akinsho Jul 27, 2018
b34889f
prevent layer from rendering if vcs.blame is not enabled
akinsho Jul 27, 2018
0f8037d
add recursive truncation of summary message
akinsho Jul 27, 2018
ad72365
add check if shortened all the way to the bottom just render the auth…
akinsho Jul 27, 2018
3258424
fix comment typo
akinsho Jul 27, 2018
1402650
only append ellipsis is shortened summary has content
akinsho Jul 27, 2018
eb1aed1
remove hover style as it is hard to manage improve fit checking
akinsho Jul 27, 2018
4e3921b
position blame in first empty white space above is cant fit
akinsho Jul 28, 2018
3724b53
remove unused arguments
akinsho Jul 28, 2018
3067d09
increase default timeout, add exiting to transitionStyles
akinsho Jul 28, 2018
ba38413
move opacity in hope of making animation more pronounced
akinsho Jul 28, 2018
433b134
check line position at start of reset timer matches current one befor…
akinsho Jul 28, 2018
414b047
fix position related crash
akinsho Jul 28, 2018
de2bef4
prettier fix
akinsho Jul 28, 2018
44417e2
mount the component ffs, add more tests
akinsho Jul 28, 2018
0f6726e
moar test for blame layer
akinsho Jul 28, 2018
0b8c8da
fix failing test
akinsho Jul 28, 2018
03e45b2
add overflow component and re-arrange comments
akinsho Jul 28, 2018
585d7ac
fix lint errors
akinsho Jul 28, 2018
f3e4f5c
add component did catch method
akinsho Jul 28, 2018
3cd6354
fix broken truncation assertion
akinsho Jul 28, 2018
43a1aaa
change check in git blame layer to use currentLine content
akinsho Jul 29, 2018
ea19dcc
fix configuration to use _oni.configuration
akinsho Aug 2, 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
7 changes: 7 additions & 0 deletions browser/src/Editor/NeovimEditor/BufferLayerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ export class BufferLayerManager {
}
}

const getInstance = (() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - why is this wrapped in an IIFE? Is there a functionaility reason for it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's to encapsulate the instance inside of the function and just return a function that provides access to it,

So rather than

	let instance = new BufferLayerManager() // global variable
	export getInstance = () => instance

	const getInstance = (() => {
		const instance = new Manager() // scoped to the IIFE and accessed via the closure
		return () => {
			return instance
		}

Its a very small distinction I've just been bitten by global vars previously and try to always find ways around them.

const instance = new BufferLayerManager()
return () => instance
})()

export default getInstance

export const wrapReactComponentWithLayer = (
id: string,
component: JSX.Element,
Expand Down
9 changes: 8 additions & 1 deletion browser/src/Editor/NeovimEditor/NeovimBufferLayersView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,17 @@ const InnerLayer = styled.div`
overflow: hidden;
`

export interface LayerContextWithCursor extends Oni.BufferLayerRenderContext {
cursorLine: number
cursorColumn: number
}

export class NeovimBufferLayersView extends React.PureComponent<NeovimBufferLayersViewProps, {}> {
public render(): JSX.Element {
const containers = this.props.windows.map(windowState => {
const layers: Oni.BufferLayer[] = this.props.layers[windowState.bufferId] || []

const layerContext: Oni.BufferLayerRenderContext = {
const layerContext: LayerContextWithCursor = {
isActive: windowState.windowId === this.props.activeWindowId,
windowId: windowState.windowId,
fontPixelWidth: this.props.fontPixelWidth,
Expand All @@ -50,6 +55,8 @@ export class NeovimBufferLayersView extends React.PureComponent<NeovimBufferLaye
visibleLines: windowState.visibleLines,
topBufferLine: windowState.topBufferLine,
bottomBufferLine: windowState.bottomBufferLine,
cursorColumn: windowState.column,
cursorLine: windowState.line,
}

const layerElements = layers.map(layer => {
Expand Down
8 changes: 3 additions & 5 deletions browser/src/Editor/NeovimEditor/NeovimEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import { asObservable, normalizePath, sleep } from "./../../Utility"

import * as VimConfigurationSynchronizer from "./../../Services/VimConfigurationSynchronizer"

import { BufferLayerManager } from "./BufferLayerManager"
import getLayerManagerInstance from "./BufferLayerManager"
import { Definition } from "./Definition"
import * as ActionCreators from "./NeovimEditorActions"
import { NeovimEditorCommands } from "./NeovimEditorCommands"
Expand Down Expand Up @@ -142,7 +142,7 @@ export class NeovimEditor extends Editor implements Oni.Editor {
private _toolTipsProvider: IToolTipsProvider
private _commands: NeovimEditorCommands
private _externalMenuOverlay: Overlay
private _bufferLayerManager: BufferLayerManager
private _bufferLayerManager = getLayerManagerInstance()
private _screenWithPredictions: ScreenWithPredictions

private _onNeovimQuit: Event<void> = new Event<void>()
Expand All @@ -162,7 +162,7 @@ export class NeovimEditor extends Editor implements Oni.Editor {
return this._neovimInstance
}

public get bufferLayers(): BufferLayerManager {
public get bufferLayers() {
return this._bufferLayerManager
}

Expand Down Expand Up @@ -201,8 +201,6 @@ export class NeovimEditor extends Editor implements Oni.Editor {
this._actions = bindActionCreators(ActionCreators as any, this._store.dispatch)
this._toolTipsProvider = new NeovimEditorToolTipsProvider(this._actions)

this._bufferLayerManager = new BufferLayerManager()

this._contextMenuManager = new ContextMenuManager(this._toolTipsProvider, this._colors)

this._neovimInstance = new NeovimInstance(100, 100, this._configuration)
Expand Down
3 changes: 3 additions & 0 deletions browser/src/Services/Configuration/DefaultConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const BaseConfiguration: IConfigurationValues = {
"experimental.particles.enabled": false,
"experimental.preview.enabled": false,
"experimental.welcome.enabled": false,
"experimental.vcs.blame.enabled": false,
"experimental.vcs.blame.mode": "auto",
"experimental.vcs.blame.timeout": 800,

"experimental.colorHighlight.enabled": false,
"experimental.colorHighlight.filetypes": [
Expand Down
7 changes: 7 additions & 0 deletions browser/src/Services/Configuration/IConfigurationValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export interface IConfigurationValues {
"experimental.indentLines.color": string
// Filetypes the indent lines are not shown for
"experimental.indentLines.bannedFiletypes": string[]
// Whether or not the vcs blame layer is enabled
"experimental.vcs.blame.enabled": boolean
// Whether or not the blame shows up automatically following a timeout or is manually
// triggered
"experimental.vcs.blame.mode": "auto" | "manual"
// Amount of millisenconds to delay before showing blame per line
"experimental.vcs.blame.timeout": number
// Whether the markdown preview pane should be shown
"experimental.markdownPreview.enabled": boolean
"experimental.markdownPreview.autoScroll": boolean
Expand Down
Loading