提交 901810dc 编写于 作者: J Joao Moreno

git: dirty diff first steps

上级 cf203e09
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Event, TextEditor, window } from 'vscode';
import { IDisposable, dispose, mapEvent } from './util';
type TextEditorsEvent = Event<TextEditor[]>;
export class DirtyDiffDecorator implements IDisposable {
private disposables: IDisposable[] = [];
constructor() {
mapEvent(window.onDidChangeActiveTextEditor, () => window.visibleTextEditors)
(this.onDidVisibleEditorsChange, this, this.disposables);
}
private onDidVisibleEditorsChange(textEditors: TextEditor[]) {
// TODO
}
dispose(): void {
this.disposables = dispose(this.disposables);
}
}
\ No newline at end of file
......@@ -5,7 +5,15 @@
'use strict';
import * as vscode from 'vscode';
import { ExtensionContext } from 'vscode';
import { DirtyDiffDecorator } from './dirtydiff';
export function activate(context: vscode.ExtensionContext) { }
export function deactivate() { }
\ No newline at end of file
export function activate(context: ExtensionContext) {
context.subscriptions.push(
new DirtyDiffDecorator()
);
}
export function deactivate() {
}
\ No newline at end of file
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { Event } from 'vscode';
export interface IDisposable {
dispose(): void;
}
export function dispose<T extends IDisposable>(disposables: T[]): T[] {
disposables.forEach(d => d.dispose());
return [];
}
export function mapEvent<I, O>(event: Event<I>, map: (i: I) => O): Event<O> {
return (listener, thisArgs = null, disposables?) => event(i => listener.call(thisArgs, map(i)), null, disposables);
}
export function filterEvent<T>(event: Event<T>, filter: (e: T) => boolean): Event<T> {
return (listener, thisArgs = null, disposables?) => event(e => filter(e) && listener.call(thisArgs, e), null, disposables);
}
\ No newline at end of file
{
"compilerOptions": {
"noLib": true,
"target": "es5",
"module": "commonjs",
"target": "es6",
"outDir": "out",
"lib": [
"es6"
],
"sourceMap": true,
"rootDir": "."
"outDir": "./out"
},
"exclude": [
"node_modules",
".vscode-test"
"node_modules"
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册