This repository has been archived by the owner on Apr 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
263 changed files
with
37,192 additions
and
20,896 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,3 +141,5 @@ $RECYCLE.BIN/ | |
|
||
# OCaml / Reason | ||
.merlin | ||
|
||
yarn.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -31,6 +36,9 @@ artifacts: | |
- path: dist/*.zip | ||
name: ProductZip | ||
|
||
- path: dist/media/screenshot-win32.png | ||
name: DemoScreenshot | ||
|
||
deploy: | ||
provider: GitHub | ||
repository: onivim/oni | ||
|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.