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

Commit

Permalink
Merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
bryphe committed Dec 3, 2017
2 parents 882f1ad + cf531a4 commit 391d1a3
Show file tree
Hide file tree
Showing 263 changed files with 37,192 additions and 20,896 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,5 @@ $RECYCLE.BIN/

# OCaml / Reason
.merlin

yarn.lock
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[submodule "vim/default/bundle/targets.vim"]
path = vim/default/bundle/targets.vim
url = https://github.com/wellle/targets.vim
[submodule "vim/default/bundle/vim-commentary"]
path = vim/default/bundle/vim-commentary
url = https://github.com/tpope/vim-commentary
[submodule "vim/default/bundle/vim-unimpaired"]
path = vim/default/bundle/vim-unimpaired
url = https://github.com/tpope/vim-unimpaired
[submodule "vim/core/typescript-vim"]
path = vim/core/typescript-vim
url = https://github.com/leafgarland/typescript-vim
55 changes: 32 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,48 @@
sudo: required
dist: trusty

language: node_js

cache:
yarn: true
directories:
- node_modules

matrix:
include:
- os: linux
sudo: required
dist: trusty
node_js: 8
- os: osx
node_js: 8

include:
- os: linux
sudo: required
dist: trusty
node_js: 8
- os: osx
node_js: 8
addons:
apt:
packages:
- libxkbfile-dev
- libgnome-keyring-dev
- icnsutils
- graphicsmagick
- xz-utils
- rpm
- bsdtar

apt:
packages:
- libxkbfile-dev
- libgnome-keyring-dev
- icnsutils
- graphicsmagick
- xz-utils
- rpm
- bsdtar
install:
- npm install

- npm install -g yarn
- yarn install
script:
- ./build/script/travis-build.sh

- ./build/script/travis-build.sh
deploy:
- provider: s3
access_key_id: AKIAIPVCKNWKWB2XULQQ
secret_access_key:
secure: IKLeZsM1R8pq/eBqBCnsFe6iSF+ZHaokY6yBf6FtxaqHw7qJR3RQ9XI9N7mooKXOAsp7prDBNW6sdciGmzXpDW7myDz5eEfmVOIZxb6zq0XUwsikkgrzgS22bMkj32CZuRzR8agzF7US+G6OfVo+MIhChOPKBfqkbUbQdWm0tYX0NJsNyt8Ax8GdyzAj98cazw5tV2HWT7M11EKQCssc1CiFWqR51Zqmy34d/jEWJEe+P3avRDpNCJf6uuzfrtpn1swCb0EY7aZGDischXwRJDyZ6GXrjECxazN2T7JwcwKw/Y+XOeiwp5H+ell+1C/tZMXcn8OyOZurVQdG7MNGHil0Jt/t4QL6XpNXXF8I1k1LQDty7SPnZRKaAYo8rNyDFqGt5oVLvTm8GD9KjI4rGPt7VvzUQS5SITRnI1m6wq0YDdVqcR9/Z2cLmXHmzhOmB3FLCTKQXXCMaG1dAzlYQDOspo9RKr+nuDpherNMSiqSeVUM97UrfRQ2pC/JfoL/f6j2jt88Y7XfF9x48h+6Pm8ny5rlSaU4otnVpgAeoMEMED5s93zZrVxF7ydyZ0ZvBLKfK13mJwleCq3R1DbYStp1bor0MFwVoVRRRLcxIo6bhlmJsd0qhIFXL8BcE1wLzDITnXVxAxg9izRPYPcSgRLyjJ1SqaxoT89cO0YlNEU=
bucket: oni-media
local-dir: dist/media
acl: public_read
region: us-west-2
skip_cleanup: true
on:
condition: $TRAVIS_OS_NAME = osx
repo: onivim/oni
- provider: releases
api_key:
secure: AjQUeQNockqkBrVQCOQGyKq+sZ9C4SabSqp/bmXayKTB+7AmM8oohenxC09Sc4/dmIW1PQnDYL/4fjclJSRaywV5oiPqUnfhTveALkKFErmYnhA8oFi3VJYg4Tbszb2lYGITLOluuuAZGw67JZIuuiXzw/yOUfdWTmRCAVGzTmqkPsusYg56L4iRBWDwYQ3mhHsuNKFO7SIx1nJatj5hK9AkDJlcVilpA5IuWLWOHLY7nplFPUPUwMkRd99nifB7ITycbaAX4zLwp2U2wCb2uSTOzsFNfXykksf8AlreH0615Jb+T39/dDwQurDAQE3h+KUH5QhEvRJ1uphkGvx/x6Vn0LkJuSqS5DLeSATmVOVRK2f6AXcymvn/64qxizjlBR7bBoUxM55311qWJNKKk2FYFTAIW5fMzN0MRbaulpnpBwmhnBvd03rOMIghnvClHv2m8Eh5A6ppPnLcl2Vn7jsrqTmMm+PM1ppIWhCpvC7xn4digx1GGHXlYzfHkDxtnHwHcbj+WOkc+j4ha8Os+1ctdT3OJXz5rwW4viorSIhWryK+G36beguXe5YaoeMcK9Vzmb+S0lHdA7RuCWiJ31i/9ZMbzBhLkdcf/wfj9n3mkqmzvc4Uc1NM8FHQ23URsodSHpTdDi7q25Eqge/JP82AqJ2zAWA+QKVg54xCQQc=
Expand Down
4 changes: 4 additions & 0 deletions BACKERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,8 @@ Thanks you to all our backers for making Oni possible!

## Backers via OpenCollective

- @TalAmuyal

## Backers via OpenCollective

<a href="https://opencollective.com/oni#backers" target="_blank"><img src="https://opencollective.com/oni/backers.svg?width=890"></a>
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### IDE powered by Neovim + React + Electron

[![Build Status](https://travis-ci.org/onivim/oni.svg?branch=master)](https://travis-ci.org/onivim/oni) [![Build Status](https://ci.appveyor.com/api/projects/status/gum9hty9hm65o7ae/branch/master?svg=true)](https://ci.appveyor.com/project/onivim/oni/branch/master)
[![Join the chat at https://gitter.im/extr0py/Lobby](https://badges.gitter.im/onivim/Lobby.svg)](https://gitter.im/onivim/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Backers on Open Collective](https://opencollective.com/oni/backers/badge.svg)](#backers) [![Sponsors on Open Collective](https://opencollective.com/oni/sponsors/badge.svg)](#sponsors) [![BountySource Active Bounties](https://api.bountysource.com/badge/tracker?tracker_id=48462304)](https://www.bountysource.com/teams/oni)
[![Join the chat at https://gitter.im/onivim/Lobby](https://badges.gitter.im/onivim/Lobby.svg)](https://gitter.im/onivim/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Backers on Open Collective](https://opencollective.com/oni/backers/badge.svg)](https://opencollective.com/oni#backer) [![Sponsors on Open Collective](https://opencollective.com/oni/sponsors/badge.svg)](https://opencollective.com/oni#sponsor) [![BountySource Active Bounties](https://api.bountysource.com/badge/tracker?tracker_id=48462304)](https://www.bountysource.com/teams/oni)
[![Total Downloads](https://img.shields.io/github/downloads/onivim/oni/total.svg)](https://github.com/onivim/oni/releases)

<h2 align="center">Supporting Oni</h2>
Expand All @@ -15,7 +15,7 @@ Oni is an MIT-licensed open source project. Please consider supporting Oni by:

<h3 align="center">Sponsors via OpenCollective</h3>

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/oni#sponsor)]
Support this project by [becoming a sponsor](https://opencollective.com/oni#sponsor). Your logo will show up here with a link to your website.

<a href="https://opencollective.com/oni/sponsor/0/website" target="_blank"><img src="https://opencollective.com/oni/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/oni/sponsor/1/website" target="_blank"><img src="https://opencollective.com/oni/sponsor/1/avatar.svg"></a>
Expand Down Expand Up @@ -59,17 +59,17 @@ Oni is cross-platform and supports Windows, OS X, and Linux.
### Windows

- Download the [Oni installer](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-ia32-win.exe) for Windows
- Download the [Oni installer](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-ia32-win.exe) for Windows
- Once it is downloaded, run the installer. This will only take a minute.
- By default, Oni is installed under `C:\Program Files (x86)\Oni` for a 64-bit machine.
- By default, Oni is installed under `C:\Program Files (x86)\Oni` for a 64-bit machine.

You can also find install via a [zip archive](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-ia32-win.zip)
You can also find install via a [zip archive](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-ia32-win.zip)

> You may want to add Oni to your `%PATH%`, so that from the console, you can open Oni via `oni`
### Mac

- Download [Oni](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-osx.dmg) for Mac
- Download [Oni](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-osx.dmg) for Mac
- Double-click on the archive to expand
- Drag `Oni.app` to the `Applications` folder

Expand All @@ -79,26 +79,26 @@ You can also find install via a [zip archive](https://github.com/onivim/oni/rele

> If you do not have Neovim, follow the instructions to [Install Neovim](https://github.com/neovim/neovim/wiki/Installing-Neovim) and ensure the 'nvim' binary is available. Version `0.2.1` is required..
- Download the [.deb package (64-bit)](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-amd64-linux.deb)
- Download the [.deb package (64-bit)](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-amd64-linux.deb)
- Install the package with `sudo dpkg -i <file>.deb`

A [tar.gz](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-linux.tar.gz) is also available.
A [tar.gz](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-linux.tar.gz) is also available.

#### Red Hat based distributions (Fedora, CentOS)

> If you do not have Neovim, follow the instructions to [Install Neovim](https://github.com/neovim/neovim/wiki/Installing-Neovim) and ensure the 'nvim' binary is available. Version `0.2.1` is required..
- Download the [.rpm package](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-x86_64-linux.rpm)
- Download the [.rpm package](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-x86_64-linux.rpm)
- Install the package with `sudo dnf install <file>.rpm`

A [tar.gz](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-linux.tar.gz) is also available.
A [tar.gz](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-linux.tar.gz) is also available.

#### Arch based distributions

- Available via the [AUR](https://aur.archlinux.org/packages/oni/)
- Install the package with `yaourt -S oni`

A [tar.gz](https://github.com/onivim/oni/releases/download/v0.2.16/Oni-0.2.16-linux.tar.gz) is also available.
A [tar.gz](https://github.com/onivim/oni/releases/download/v0.2.17/Oni-0.2.17-linux.tar.gz) is also available.

## Goals

Expand Down Expand Up @@ -129,9 +129,9 @@ There many ways to contribute to Oni:

- Support Oni financially by making a donation via [Bountysource](https://salt.bountysource.com/teams/oni)
- [Submit bugs](https://github.com/onivim/oni/issues) or propose new features.
- Review and and upate our [documentation](https://github.com/onivim/oni/wiki)
- Review and upate our [documentation](https://github.com/onivim/oni/wiki)
- Try out the latest [released build](https://github.com/onivim/oni/releases)
- Contribute a bug fix or code change - start by checking our [Debugging Page](https://github.com/onivim/oni/wiki/Debugging)
- Contribute a bug fix or code change - start by checking our [Development Page](https://github.com/onivim/oni/wiki/Development)

## Acknowledgements

Expand Down
13 changes: 11 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@ branches:
- master
- /^release.*/

cache:
- "%LOCALAPPDATA%\\Yarn"

platform:
- x86
- x64

# Install scripts. (runs after repo cloning)
install:
# Ensure the Git Submoduldes have been pulled down too
- git submodule update --init --recursive
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# Workaround https://github.com/npm/npm/issues/18380
- npm install [email protected] -g
- npm install -g yarn
- node --version
- npm --version
# install modules
- npm install
- yarn install

artifacts:
- path: dist/*.exe
Expand All @@ -31,6 +36,9 @@ artifacts:
- path: dist/*.zip
name: ProductZip

- path: dist/media/screenshot-win32.png
name: DemoScreenshot

deploy:
provider: GitHub
repository: onivim/oni
Expand All @@ -57,6 +65,7 @@ test_script:
- npm run pack:win
# run integration tests
- npm run test:integration
- npm run demo

# Don't actually build.
build: off
77 changes: 77 additions & 0 deletions browser/src/Editor/BufferHighlights.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* BufferHighlights.ts
*
* Helpers to manage buffer highlight state
*/

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

import { NeovimInstance } from "./../neovim"

// Line number to highlight src id, for clearing
export type HighlightSourceId = number
export interface BufferHighlightState { [key: number]: HighlightSourceId }

export interface IBufferHighlightsUpdater {
setHighlightsForLine(line: number, highlights: SyntaxHighlighting.HighlightInfo[]): void
clearHighlightsForLine(line: number): void
}

// Helper class to efficiently update
// buffer highlights in a batch.
export class BufferHighlightsUpdater implements IBufferHighlightsUpdater {

private _newSrcId: number
private _calls: any[] = []
private _newState: BufferHighlightState

constructor(
private _bufferId: number,
private _neovimInstance: NeovimInstance,
private _previousState: BufferHighlightState,
) {}

public async start(): Promise<void> {
this._newState = {
...this._previousState,
}

this._newSrcId = await this._neovimInstance.request<number>("nvim_buf_add_highlight", [this._bufferId, 0, "", 0, 0, 0])
}

public setHighlightsForLine(line: number, highlights: SyntaxHighlighting.HighlightInfo[]): void {
this.clearHighlightsForLine(line)

if (!highlights || !highlights.length) {
return
}

const addHighlightCalls = highlights.map((hl) => {
return ["nvim_buf_add_highlight", [this._bufferId, this._newSrcId, hl.highlightGroup,
hl.range.start.line, hl.range.start.character, hl.range.end.character]]
})

this._newState[line] = this._newSrcId

this._calls = this._calls.concat(addHighlightCalls)
}
public clearHighlightsForLine(line: number): void {
const previousLine = this._previousState[line]

if (!previousLine) {
return
}

const oldSrcId = this._previousState[line]
this._newState[line] = null

this._calls.push(["nvim_buf_clear_highlight", [this._bufferId, oldSrcId, line, line + 1]])
}

public async apply(): Promise<BufferHighlightState> {
if (this._calls.length > 0) {
await this._neovimInstance.request<void>("nvim_call_atomic", [this._calls])
}
return this._newState
}
}
39 changes: 35 additions & 4 deletions browser/src/Editor/BufferManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ import "rxjs/add/observable/defer"
import "rxjs/add/observable/from"
import "rxjs/add/operator/concatMap"

import { NeovimInstance } from "./../neovim"
import * as Oni from "oni-api"

import { EventContext, NeovimInstance } from "./../neovim"
import { languageManager, sortTextEdits } from "./../Services/Language"
import { PromiseQueue } from "./../Services/Language/PromiseQueue"

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

import { BufferHighlightState, BufferHighlightsUpdater, IBufferHighlightsUpdater } from "./BufferHighlights"

import * as Constants from "./../Constants"
import * as Log from "./../Log"
Expand All @@ -32,6 +39,9 @@ export class Buffer implements Oni.Buffer {
private _bufferLines: string[] = null
private _lastBufferLineVersion: number = -1

private _promiseQueue = new PromiseQueue()
private _previousHighlightState: BufferHighlightState = {}

public get filePath(): string {
return this._filePath
}
Expand Down Expand Up @@ -61,7 +71,7 @@ export class Buffer implements Oni.Buffer {
}

constructor(private _neovimInstance: NeovimInstance,
evt: Oni.EventContext) {
evt: EventContext) {
this.updateFromEvent(evt)
}

Expand Down Expand Up @@ -122,6 +132,27 @@ export class Buffer implements Oni.Buffer {
.toPromise()
}

public async getOrCreateHighlightGroup(highlight: SyntaxHighlighting.IHighlight | string): Promise<SyntaxHighlighting.HighlightGroupId> {
if (typeof highlight === "string") {
return highlight
} else {
// TODO: needed for theming integration!
return null
}
}

public async updateHighlights(updateFunction: (highlightsUpdater: IBufferHighlightsUpdater) => void): Promise<void> {
this._promiseQueue.enqueuePromise(async () => {
const bufferId = parseInt(this._id, 10)
const bufferUpdater = new BufferHighlightsUpdater(bufferId, this._neovimInstance, this._previousHighlightState)
await bufferUpdater.start()

updateFunction(bufferUpdater)

this._previousHighlightState = await bufferUpdater.apply()
})
}

public async setLines(start: number, end: number, lines: string[]): Promise<void> {
// Clear buffer lines, so that if we make subsequent edits, we are always getting the freshest line
// TODO: Speed this up by updating the `_bufferLines` cache instead
Expand Down Expand Up @@ -186,7 +217,7 @@ export class Buffer implements Oni.Buffer {
return getToken(result[0], column)
}

public updateFromEvent(evt: Oni.EventContext): void {
public updateFromEvent(evt: EventContext): void {
this._id = evt.bufferNumber.toString()
this._filePath = evt.bufferFullPath
this._language = evt.filetype
Expand Down Expand Up @@ -220,7 +251,7 @@ export class BufferManager {

constructor(private _neovimInstance: NeovimInstance) { }

public updateBufferFromEvent(evt: Oni.EventContext): Buffer {
public updateBufferFromEvent(evt: EventContext): Buffer {
const id = evt.bufferNumber.toString()
const currentBuffer = this.getBufferById(id)

Expand Down
2 changes: 2 additions & 0 deletions browser/src/Editor/BufferUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import * as os from "os"

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

import * as Oni from "oni-api"

import * as Log from "./../Log"

import { Observable } from "rxjs/Observable"
Expand Down
Loading

0 comments on commit 391d1a3

Please sign in to comment.