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

Commit

Permalink
Merge branch 'master' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
bryphe committed Apr 28, 2018
2 parents c0d5160 + ecb0a76 commit 3569110
Show file tree
Hide file tree
Showing 144 changed files with 31,953 additions and 1,516 deletions.
4 changes: 4 additions & 0 deletions .github/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ backers:
- 10263
- 3117205
- 5697723
- 6803419
- 1718128
- 2042893
- 14060883
12 changes: 12 additions & 0 deletions BACKERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Oni is an MIT-licensed open-source project. It's an independent project without

If you use Oni, please consider joining them via the following options:

* Become a backer on [Patreon](https://patreon.com/onivim)
* Become a backer on [OpenCollective](https://opencollective.com/oni#backer)
* Become a backer on [Bountysource](https://salt.bountysource.com/teams/oni)
* Make a donation via [PayPal](https://www.paypal.me/bryphe/25)
Expand Down Expand Up @@ -78,10 +79,13 @@ Thanks you to all our backers for making Oni possible!
* @city41
* @nithesh
* @erandac
* @appelgriebsch

## Backers via PayPal

* @mchalkley
* @am2605
* Nathan Ensmenger

## Backers via OpenCollective

Expand All @@ -101,6 +105,14 @@ Thanks you to all our backers for making Oni possible!
* Ryan Campbell
* Balint Fulop
* Quasar Jarosz
* Channing Conger
* Clinton Bloodworth
* Lex Song
* Paul Baumgart
* Kaiden Sin
* Troy Vitullo
* Leo Critchley
* Patrick Massot

<a href="https://opencollective.com/oni/tiers/backer/0/website" target="_blank"><img src="https://opencollective.com/oni/tiers/backer/0/avatar.png"></a>
<a href="https://opencollective.com/oni/tiers/backer/1/website" target="_blank"><img src="https://opencollective.com/oni/tiers/backer/1/avatar.png"></a>
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Anyone can file an expense. If the expense makes sense for the development of th

### Bounties

The primary allotment of our [open collective](https://opencollective.com/oni) budget is dedicated to bounties. Developing features and fixing bugs is a loit of work, and those go directly to the developers doing this work via bounties. It is the role of the _maintainer_ to set bounties and clear completion criteria. Issues that have a bounty associated with them will have a `bounty` label as well as an amount, ie, `bounty-50` means a $50 bounty.
The primary allotment of our [open collective](https://opencollective.com/oni) budget is dedicated to bounties. Developing features and fixing bugs is a lot of work, and those go directly to the developers doing this work via bounties. It is the role of the _maintainer_ to set bounties and clear completion criteria. Issues that have a bounty associated with them will have a `bounty` label as well as an amount, ie, `bounty-50` means a $50 bounty.

* Guidelines:
* The fix for the bug/feature/issue _MUST_ be complete and _MUST_ be covered by tests to be eligible for a bounty.
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,20 @@ Check out [Releases](https://github.com/onivim/oni/releases) for the latest bina

Oni brings several IDE-like integrations to neovim:

* [Embedded Browser](https://github.com/onivim/oni/wiki/Features#embedded-browser)
* [Quick Info](https://github.com/onivim/oni/wiki/Features#quick-info)
* [Code Completion](https://github.com/onivim/oni/wiki/Features#code-completion)
* [Syntax / Compilation Errors](https://github.com/onivim/oni/wiki/Features#syntax--compilation-errors)
* [Fuzzy Finding](https://github.com/onivim/oni/wiki/Features#fuzzy-finder)
* [Status Bar](https://github.com/onivim/oni/wiki/Features#status-bar)
* [Interactive Tutorial](https://github.com/onivim/oni/wiki/Features#interactive-tutorial)

And more coming - check out our [Roadmap](https://github.com/onivim/oni/wiki/Roadmap)

Oni is cross-platform and supports Windows, Mac, and Linux.

> If you're a Vim power user, and don't need all these features, check out our [minimal configuration](https://github.com/onivim/oni/wiki/How-To:-Minimal-Oni-Configuration).
## Installation

We have installation guides for each platform:
Expand Down Expand Up @@ -112,7 +116,10 @@ The goal of this project is to give an editor that gives the best of both worlds

There many ways to get involved & contribute to Oni:

* Support Oni financially by making a donation via [OpenCollective](https://opencollective.com/oni) or [Bountysource](https://salt.bountysource.com/teams/oni)
* Support Oni financially by making a donation via:
* [Patreon](https://patreon.com/onivim)
* [OpenCollective](https://opencollective.com/oni)
* [Bountysource](https://salt.bountysource.com/teams/oni)
* Thumbs up existing [issues](https://github.com/onivim/oni/issues) if they impact you.
* [Create an issue](https://github.com/onivim/oni/issues) for bugs or new features.
* Review and update our [documentation](https://github.com/onivim/oni/wiki).
Expand All @@ -121,6 +128,8 @@ There many ways to get involved & contribute to Oni:
* Review [PRs](https://github.com/onivim/oni/pulls)
* Submit a bug fix or feature
* Add test cases
* Create a blog post or YouTube video
* Follow us on [Twitter](https://twitter.com/oni_vim)

## Acknowledgements

Expand Down
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ branches:
- master
- /^release.*/

cache:
- .oni_build_cache -> package.json

platform:
- x86
- x64
Expand All @@ -25,6 +28,7 @@ install:
- npm --version
# install modules
- yarn install --verbose
- npm run check-cached-binaries

artifacts:
- path: dist/*.exe
Expand Down
1 change: 0 additions & 1 deletion browser/src/CSS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const activate = () => {

require("./Services/Menu/Menu.less")

require("./UI/components/Error.less")
require("./UI/components/InstallHelp.less")
require("./UI/components/QuickInfo.less")
require("./UI/components/Tabs.less")
Expand Down
28 changes: 21 additions & 7 deletions browser/src/Editor/BufferManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import "rxjs/add/operator/concatMap"

import { Store } from "redux"

import * as detectIndent from "detect-indent"

import * as Oni from "oni-api"

import {
Expand Down Expand Up @@ -88,6 +90,7 @@ export class Buffer implements IBuffer {
private _filePath: string
private _language: string
private _cursor: Oni.Cursor
private _cursorOffset: number
private _version: number
private _modified: boolean
private _lineCount: number
Expand All @@ -111,6 +114,10 @@ export class Buffer implements IBuffer {
return this._cursor
}

public get cursorOffset(): number {
return this._cursorOffset
}

public get version(): number {
return this._version
}
Expand Down Expand Up @@ -146,6 +153,18 @@ export class Buffer implements IBuffer {
this._actions.removeBufferLayer(parseInt(this._id, 10), layer)
}

/**
* convertOffsetToLineColumn
*/
public async convertOffsetToLineColumn(
cursorOffset = this._cursorOffset,
): Promise<types.Position> {
const line: number = await this._neovimInstance.callFunction("byte2line", [cursorOffset])
const countFromLine: number = await this._neovimInstance.callFunction("line2byte", [line])
const column = cursorOffset - countFromLine
return types.Position.create(line - 1, column)
}

public async getCursorPosition(): Promise<types.Position> {
const pos = await this._neovimInstance.callFunction("getpos", ["."])
const [, oneBasedLine, oneBasedColumn] = pos
Expand Down Expand Up @@ -210,13 +229,7 @@ export class Buffer implements IBuffer {
}

public async detectIndentation(): Promise<BufferIndentationInfo> {
const bufferLinesPromise = this.getLines(0, 1024)
const detectIndentPromise = import("detect-indent")

await Promise.all([bufferLinesPromise, detectIndentPromise])

const bufferLines = await bufferLinesPromise
const detectIndent = await detectIndentPromise
const bufferLines = await this.getLines(0, 1024)

const ret = detectIndent(bufferLines.join("\n"))

Expand Down Expand Up @@ -414,6 +427,7 @@ export class Buffer implements IBuffer {
this._version = evt.version
this._modified = evt.modified
this._lineCount = evt.bufferTotalLines
this._cursorOffset = evt.byte

this._cursor = {
line: evt.line - 1,
Expand Down
82 changes: 73 additions & 9 deletions browser/src/Editor/NeovimEditor/NeovimEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
NeovimScreen,
NeovimWindowManager,
} from "./../../neovim"
import { CanvasRenderer, INeovimRenderer } from "./../../Renderer"
import { INeovimRenderer } from "./../../Renderer"

import { PluginManager } from "./../../Plugins/PluginManager"

Expand Down Expand Up @@ -61,7 +61,7 @@ import {
} from "./../../Services/SyntaxHighlighting"

import { MenuManager } from "./../../Services/Menu"
import { ThemeManager } from "./../../Services/Themes"
import { IThemeMetadata, ThemeManager } from "./../../Services/Themes"
import { TypingPredictionManager } from "./../../Services/TypingPredictionManager"
import { Workspace } from "./../../Services/Workspace"

Expand Down Expand Up @@ -94,6 +94,8 @@ import WildMenu from "./../../UI/components/WildMenu"

import { WelcomeBufferLayer } from "./WelcomeBufferLayer"

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 {
Expand Down Expand Up @@ -122,6 +124,7 @@ export class NeovimEditor extends Editor implements IEditor {
private _windowManager: NeovimWindowManager

private _currentColorScheme: string = ""
private _currentBackground: string = ""
private _isFirstRender: boolean = true

private _lastBufferId: string = null
Expand Down Expand Up @@ -242,9 +245,9 @@ export class NeovimEditor extends Editor implements IEditor {
this._toolTipsProvider,
)

const notificationManager = getNotificationsInstance()
this._neovimInstance.onMessage.subscribe(messageInfo => {
// TODO: Hook up real notifications
const notificationManager = getNotificationsInstance()
const notification = notificationManager.createItem()
notification.setLevel("error")
notification.setContents(messageInfo.title, messageInfo.details)
Expand All @@ -254,7 +257,47 @@ export class NeovimEditor extends Editor implements IEditor {
notification.show()
})

this._renderer = new CanvasRenderer()
const initVimPath = this._neovimInstance.doesInitVimExist()
const initVimInUse = this._configuration.getValue("oni.loadInitVim")
const hasCheckedInitVim = this._configuration.getValue("_internal.hasCheckedInitVim")

if (initVimPath && !initVimInUse && !hasCheckedInitVim) {
const initVimNotification = notificationManager.createItem()
initVimNotification.setLevel("info")
initVimNotification.setContents(
"init.vim found",
`We found an init.vim file would you like Oni to use it?
This will result in Oni being reloaded`,
)

initVimNotification.setButtons([
{
title: "Yes",
callback: () => {
this._configuration.setValues(
{ "_internal.hasCheckedInitVim": true, "oni.loadInitVim": true },
true,
)
commandManager.executeCommand("oni.debug.reload")
},
},
{
title: "No",
callback: () => {
this._configuration.setValues(
{ "oni.loadInitVim": false, "_internal.hasCheckedInitVim": true },
true,
)
},
},
])
initVimNotification.show()
}

this._renderer =
this._configuration.getValue("editor.renderer") === "webgl"
? new WebGLRenderer()
: new CanvasRenderer()

this._rename = new Rename(
this,
Expand Down Expand Up @@ -707,6 +750,7 @@ export class NeovimEditor extends Editor implements IEditor {

document.body.ondrop = ev => {
ev.preventDefault()
// TODO: the following line currently breaks explorer drag and drop functionality
ev.stopPropagation()

const { files } = ev.dataTransfer
Expand Down Expand Up @@ -934,15 +978,17 @@ export class NeovimEditor extends Editor implements IEditor {
this._themeManager.onThemeChanged.subscribe(() => {
const newTheme = this._themeManager.activeTheme

if (newTheme.baseVimTheme && newTheme.baseVimTheme !== this._currentColorScheme) {
this._neovimInstance.command(":color " + newTheme.baseVimTheme)
if (
newTheme.baseVimTheme &&
(newTheme.baseVimTheme !== this._currentColorScheme ||
newTheme.baseVimBackground !== this._currentBackground)
) {
this.setColorSchemeFromTheme(newTheme)
}
})

if (this._themeManager.activeTheme && this._themeManager.activeTheme.baseVimTheme) {
await this._neovimInstance.command(
":color " + this._themeManager.activeTheme.baseVimTheme,
)
await this.setColorSchemeFromTheme(this._themeManager.activeTheme)
}

if (filesToOpen && filesToOpen.length > 0) {
Expand All @@ -961,6 +1007,18 @@ export class NeovimEditor extends Editor implements IEditor {
this._scheduleRender()
}

public async setColorSchemeFromTheme(theme: IThemeMetadata): Promise<void> {
if (
(theme.baseVimBackground === "dark" || theme.baseVimBackground === "light") &&
theme.baseVimBackground !== this._currentBackground
) {
await this._neovimInstance.command(":set background=" + theme.baseVimBackground)
this._currentBackground = theme.baseVimBackground
}

await this._neovimInstance.command(":color " + theme.baseVimTheme)
}

public getBuffers(): Array<Oni.Buffer | Oni.InactiveBuffer> {
return this._bufferManager.getBuffers()
}
Expand Down Expand Up @@ -1179,6 +1237,12 @@ export class NeovimEditor extends Editor implements IEditor {

private async _onColorsChanged(): Promise<void> {
const newColorScheme = await this._neovimInstance.eval<string>("g:colors_name")

// In error cases, the neovim API layer returns an array
if (typeof newColorScheme !== "string") {
return
}

this._currentColorScheme = newColorScheme
const backgroundColor = this._screen.backgroundColor
const foregroundColor = this._screen.foregroundColor
Expand Down
3 changes: 1 addition & 2 deletions browser/src/Editor/NeovimEditor/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import * as marked from "marked"
import * as Log from "./../../Log"
import { IGrammarPerLine, IGrammarToken } from "./../../Services/SyntaxHighlighting/TokenGenerator"

// tslint:disable-next-line
const { default: DOMPurify } = require("dompurify")
import * as DOMPurify from "dompurify"

const renderer = new marked.Renderer()
interface IRendererArgs {
Expand Down
Loading

0 comments on commit 3569110

Please sign in to comment.