提交 74643fd1 编写于 作者: J Joao Moreno

remove git extension code

上级 eec57b4f
......@@ -10,23 +10,30 @@
"categories": [
"Other"
],
"activationEvents": [
"*"
],
"main": "./out/extension",
"contributes": {
"commands": [],
"languages": [
{
"id": "git-commit",
"aliases": ["Git Commit Message", "git-commit"],
"filenames": ["COMMIT_EDITMSG", "MERGE_MSG"],
"aliases": [
"Git Commit Message",
"git-commit"
],
"filenames": [
"COMMIT_EDITMSG",
"MERGE_MSG"
],
"configuration": "./git-commit.language-configuration.json"
},
{
"id": "git-rebase",
"aliases": ["Git Rebase Message", "git-rebase"],
"filenames": ["git-rebase-todo"],
"aliases": [
"Git Rebase Message",
"git-rebase"
],
"filenames": [
"git-rebase-todo"
],
"configuration": "./git-rebase.language-configuration.json"
}
],
......@@ -42,10 +49,5 @@
"path": "./syntaxes/git-rebase.tmLanguage"
}
]
},
"scripts": {
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install"
}
}
\ 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, TextEditor, window, workspace } from 'vscode';
import { IDisposable, dispose, mapEvent } from './util';
type TextEditorsEvent = Event<TextEditor[]>;
type IDecoration = void;
class ResourceDecorator implements IDisposable {
private textEditors: TextEditor[] = [];
constructor(private path: string) {
// console.log(`creating: ${this.path}`);
}
add(textEditor: TextEditor): void {
this.remove(textEditor);
this.textEditors.push(textEditor);
}
remove(textEditor: TextEditor): void {
this.textEditors = this.textEditors.filter(e => e !== textEditor);
}
get count(): number {
return this.textEditors.length;
}
dispose(): void {
// console.log(`disposing: ${this.path}`);
}
}
export class DirtyDiff implements IDisposable {
private textEditors: { editor: TextEditor; path: string; }[] = [];
private decorators: { [uri: string]: ResourceDecorator } = Object.create(null);
private disposables: IDisposable[] = [];
constructor() {
const onVisibleTextEditorsChange = mapEvent(window.onDidChangeActiveTextEditor, () => window.visibleTextEditors);
onVisibleTextEditorsChange(this.onDidVisibleEditorsChange, this, this.disposables);
this.onDidVisibleEditorsChange(window.visibleTextEditors);
const watcher = workspace.createFileSystemWatcher('**');
this.disposables.push(watcher);
}
private onDidVisibleEditorsChange(textEditors: TextEditor[]) {
const added = textEditors.filter(a => this.textEditors.every(({ editor }) => a !== editor)).map(editor => ({ editor, path: workspace.asRelativePath(editor.document.uri) }));
const removed = this.textEditors.filter(({ editor }) => textEditors.every(b => editor !== b));
this.textEditors = textEditors.map(editor => ({ editor, path: workspace.asRelativePath(editor.document.uri) }));
removed.forEach(({ editor, path }) => {
const decorator = this.decorators[path];
decorator.remove(editor);
if (decorator.count === 0) {
decorator.dispose();
delete this.decorators[path];
}
});
added.forEach(({ editor, path }) => {
const decorator = this.decorators[path] || (this.decorators[path] = new ResourceDecorator(path));
decorator.add(editor);
});
}
dispose(): void {
this.disposables = dispose(this.disposables);
}
}
\ 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 { ExtensionContext } from 'vscode';
export function activate(context: ExtensionContext) {
}
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.
*--------------------------------------------------------------------------------------------*/
/// <reference path='../../../../src/vs/vscode.d.ts'/>
/// <reference path='../../../../src/typings/mocha.d.ts'/>
/// <reference path='../../../../extensions/declares.d.ts'/>
/// <reference path='../../../../extensions/node.d.ts'/>
/// <reference path='../../../../extensions/lib.core.d.ts'/>
\ 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 combinedDisposable(disposables: IDisposable[]): IDisposable {
return { dispose: () => dispose(disposables) };
}
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);
}
export function any<T>(...events: Event<T>[]): Event<T> {
return (listener, thisArgs = null, disposables?) => combinedDisposable(events.map(event => event(i => listener.call(thisArgs, i), disposables)));
}
interface IListener<T> {
(e: T): any;
}
export class Emitter<T> {
private listeners: IListener<T>[];
get event(): Event<T> {
return (listener: IListener<T>, thisArgs = null, disposables?: IDisposable[]) => {
const _listener = thisArgs ? listener.bind(thisArgs) : listener;
this.listeners.push(_listener);
const dispose = () => { this.listeners = this.listeners.filter(l => l !== _listener); };
const result = { dispose };
if (disposables) {
disposables.push(result);
}
return result;
};
}
fire(e: T = null): void {
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册