mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Fixes #7 - missing lodash dependency
This commit is contained in:
@@ -43,6 +43,10 @@ Must be using Git and it must be in your path.
|
|||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
|
### 0.3.2
|
||||||
|
|
||||||
|
- Fixes issue with missing lodash dependency
|
||||||
|
|
||||||
### 0.3.1
|
### 0.3.1
|
||||||
|
|
||||||
- Adds new CodeLens visibility & location settings -- see **Extension Settings** above for details
|
- Adds new CodeLens visibility & location settings -- see **Extension Settings** above for details
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlens",
|
"name": "gitlens",
|
||||||
"version": "0.3.1",
|
"version": "0.3.2",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Eric Amodio",
|
"name": "Eric Amodio",
|
||||||
"email": "eamodio@gmail.com"
|
"email": "eamodio@gmail.com"
|
||||||
@@ -198,8 +198,9 @@
|
|||||||
"lodash.debounce": "^4.0.8",
|
"lodash.debounce": "^4.0.8",
|
||||||
"lodash.escaperegexp": "^4.1.2",
|
"lodash.escaperegexp": "^4.1.2",
|
||||||
"lodash.isequal": "^4.4.0",
|
"lodash.isequal": "^4.4.0",
|
||||||
|
"lodash.omit": "^4.5.0",
|
||||||
"moment": "^2.15.0",
|
"moment": "^2.15.0",
|
||||||
"spawn-rx": "^2.0.1",
|
"rxjs": "^5.0.0-beta.12",
|
||||||
"tmp": "^0.0.29"
|
"tmp": "^0.0.29"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@@ -209,6 +210,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"vscode:prepublish": "node ./node_modules/vscode/bin/compile && tsc",
|
"vscode:prepublish": "node ./node_modules/vscode/bin/compile && tsc",
|
||||||
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
|
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
|
||||||
"postinstall": "node ./node_modules/vscode/bin/install"
|
"postinstall": "node ./node_modules/vscode/bin/install",
|
||||||
|
"package": "git clean -xdf && npm install && vsce package",
|
||||||
|
"publish": "git clean -xdf && npm install && vsce publish"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,15 @@
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as tmp from 'tmp';
|
import * as tmp from 'tmp';
|
||||||
import {spawnPromise} from 'spawn-rx';
|
//import {spawnPromise} from 'spawn-rx';
|
||||||
|
const spawnRx = require('./spawn-rx');
|
||||||
|
|
||||||
export * from './gitEnrichment';
|
export * from './gitEnrichment';
|
||||||
//export * from './enrichers/blameRegExpEnricher';
|
//export * from './enrichers/blameRegExpEnricher';
|
||||||
export * from './enrichers/blameParserEnricher';
|
export * from './enrichers/blameParserEnricher';
|
||||||
|
|
||||||
function gitCommand(cwd: string, ...args) {
|
function gitCommand(cwd: string, ...args) {
|
||||||
return spawnPromise('git', args, { cwd: cwd })
|
return spawnRx.spawnPromise('git', args, { cwd: cwd })
|
||||||
.then(s => {
|
.then(s => {
|
||||||
console.log('[GitLens]', 'git', ...args);
|
console.log('[GitLens]', 'git', ...args);
|
||||||
return s;
|
return s;
|
||||||
@@ -37,7 +38,7 @@ export default class Git {
|
|||||||
return fileName.replace(/\\/g, '/');
|
return fileName.replace(/\\/g, '/');
|
||||||
}
|
}
|
||||||
|
|
||||||
static splitPath(fileName: string, repoPath?: string) {
|
static splitPath(fileName: string, repoPath?: string): [string, string] {
|
||||||
// if (!path.isAbsolute(fileName)) {
|
// if (!path.isAbsolute(fileName)) {
|
||||||
// console.error('[GitLens]', `Git.splitPath(${fileName}) is not an absolute path!`);
|
// console.error('[GitLens]', `Git.splitPath(${fileName}) is not an absolute path!`);
|
||||||
// debugger;
|
// debugger;
|
||||||
@@ -54,7 +55,7 @@ export default class Git {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static blame(format: GitBlameFormat, fileName: string, repoPath?: string, sha?: string) {
|
static blame(format: GitBlameFormat, fileName: string, repoPath?: string, sha?: string) {
|
||||||
const [file, root] = Git.splitPath(Git.normalizePath(fileName), repoPath);
|
const [file, root]: [string, string] = Git.splitPath(Git.normalizePath(fileName), repoPath);
|
||||||
|
|
||||||
if (sha) {
|
if (sha) {
|
||||||
return gitCommand(root, 'blame', format, '--root', `${sha}^`, '--', file);
|
return gitCommand(root, 'blame', format, '--root', `${sha}^`, '--', file);
|
||||||
|
|||||||
306
src/git/spawn-rx.js
Normal file
306
src/git/spawn-rx.js
Normal file
@@ -0,0 +1,306 @@
|
|||||||
|
//import * as _ from 'lodash';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as net from 'net';
|
||||||
|
import { Observable, Subscription, AsyncSubject } from 'rxjs';
|
||||||
|
import * as sfs from 'fs';
|
||||||
|
|
||||||
|
const omit = require('lodash.omit');
|
||||||
|
|
||||||
|
const spawnOg = require('child_process').spawn;
|
||||||
|
const isWindows = process.platform === 'win32';
|
||||||
|
|
||||||
|
// const d = require('debug-electron')('surf:promise-array');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stat a file but don't throw if it doesn't exist
|
||||||
|
*
|
||||||
|
* @param {string} file The path to a file
|
||||||
|
* @return {Stats} The stats structure
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function statSyncNoException(file) {
|
||||||
|
try {
|
||||||
|
return sfs.statSync(file);
|
||||||
|
} catch (e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search PATH to see if a file exists in any of the path folders.
|
||||||
|
*
|
||||||
|
* @param {string} exe The file to search for
|
||||||
|
* @return {string} A fully qualified path, or the original path if nothing
|
||||||
|
* is found
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
function runDownPath(exe) {
|
||||||
|
// NB: Windows won't search PATH looking for executables in spawn like
|
||||||
|
// Posix does
|
||||||
|
|
||||||
|
// Files with any directory path don't get this applied
|
||||||
|
if (exe.match(/[\\\/]/)) {
|
||||||
|
// d('Path has slash in directory, bailing');
|
||||||
|
return exe;
|
||||||
|
}
|
||||||
|
|
||||||
|
let target = path.join('.', exe);
|
||||||
|
if (statSyncNoException(target)) {
|
||||||
|
// d(`Found executable in currect directory: ${target}`);
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
let haystack = process.env.PATH.split(isWindows ? ';' : ':');
|
||||||
|
for (let p of haystack) {
|
||||||
|
let needle = path.join(p, exe);
|
||||||
|
if (statSyncNoException(needle)) return needle;
|
||||||
|
}
|
||||||
|
|
||||||
|
// d('Failed to find executable anywhere in path');
|
||||||
|
return exe;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds the actual executable and parameters to run on Windows. This method
|
||||||
|
* mimics the POSIX behavior of being able to run scripts as executables by
|
||||||
|
* replacing the passed-in executable with the script runner, for PowerShell,
|
||||||
|
* CMD, and node scripts.
|
||||||
|
*
|
||||||
|
* This method also does the work of running down PATH, which spawn on Windows
|
||||||
|
* also doesn't do, unlike on POSIX.
|
||||||
|
*
|
||||||
|
* @param {string} exe The executable to run
|
||||||
|
* @param {Array<string>} args The arguments to run
|
||||||
|
*
|
||||||
|
* @return {Object} The cmd and args to run
|
||||||
|
* @property {string} cmd The command to pass to spawn
|
||||||
|
* @property {Array<string>} args The arguments to pass to spawn
|
||||||
|
*/
|
||||||
|
export function findActualExecutable(exe, args) {
|
||||||
|
// POSIX can just execute scripts directly, no need for silly goosery
|
||||||
|
if (process.platform !== 'win32') return { cmd: runDownPath(exe), args: args };
|
||||||
|
|
||||||
|
if (!sfs.existsSync(exe)) {
|
||||||
|
// NB: When you write something like `surf-client ... -- surf-build` on Windows,
|
||||||
|
// a shell would normally convert that to surf-build.cmd, but since it's passed
|
||||||
|
// in as an argument, it doesn't happen
|
||||||
|
const possibleExts = ['.exe', '.bat', '.cmd', '.ps1'];
|
||||||
|
for (let ext of possibleExts) {
|
||||||
|
let possibleFullPath = runDownPath(`${exe}${ext}`);
|
||||||
|
|
||||||
|
if (sfs.existsSync(possibleFullPath)) {
|
||||||
|
return findActualExecutable(possibleFullPath, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exe.match(/\.ps1$/i)) {
|
||||||
|
let cmd = path.join(process.env.SYSTEMROOT, 'System32', 'WindowsPowerShell', 'v1.0', 'PowerShell.exe');
|
||||||
|
let psargs = ['-ExecutionPolicy', 'Unrestricted', '-NoLogo', '-NonInteractive', '-File', exe];
|
||||||
|
|
||||||
|
return { cmd: cmd, args: psargs.concat(args) };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exe.match(/\.(bat|cmd)$/i)) {
|
||||||
|
let cmd = path.join(process.env.SYSTEMROOT, 'System32', 'cmd.exe');
|
||||||
|
let cmdArgs = ['/C', `${exe} ${args.join(' ')}`];
|
||||||
|
|
||||||
|
return { cmd: cmd, args: cmdArgs };
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exe.match(/\.(js)$/i)) {
|
||||||
|
let cmd = process.execPath;
|
||||||
|
let nodeArgs = [exe];
|
||||||
|
|
||||||
|
return { cmd: cmd, args: nodeArgs.concat(args) };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dunno lol
|
||||||
|
return { cmd: exe, args: args };
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawns a process but detached from the current process. The process is put
|
||||||
|
* into its own Process Group that can be killed by unsubscribing from the
|
||||||
|
* return Observable.
|
||||||
|
*
|
||||||
|
* @param {string} exe The executable to run
|
||||||
|
* @param {Array<string>} params The parameters to pass to the child
|
||||||
|
* @param {Object} opts Options to pass to spawn.
|
||||||
|
*
|
||||||
|
* @return {Observable<string>} Returns an Observable that when subscribed
|
||||||
|
* to, will create a detached process. The
|
||||||
|
* process output will be streamed to this
|
||||||
|
* Observable, and if unsubscribed from, the
|
||||||
|
* process will be terminated early. If the
|
||||||
|
* process terminates with a non-zero value,
|
||||||
|
* the Observable will terminate with onError.
|
||||||
|
*/
|
||||||
|
export function spawnDetached(exe, params, opts=null) {
|
||||||
|
let { cmd, args } = findActualExecutable(exe, params);
|
||||||
|
|
||||||
|
if (!isWindows) return spawn(cmd, args, Object.assign({}, opts || {}, {detached: true }));
|
||||||
|
const newParams = [cmd].concat(args);
|
||||||
|
|
||||||
|
let target = path.join(__dirname, '..', 'vendor', 'jobber', 'jobber.exe');
|
||||||
|
let options = Object.assign({}, opts || {}, { detached: true, jobber: true });
|
||||||
|
|
||||||
|
// d(`spawnDetached: ${target}, ${newParams}`);
|
||||||
|
return spawn(target, newParams, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawns a process attached as a child of the current process.
|
||||||
|
*
|
||||||
|
* @param {string} exe The executable to run
|
||||||
|
* @param {Array<string>} params The parameters to pass to the child
|
||||||
|
* @param {Object} opts Options to pass to spawn.
|
||||||
|
*
|
||||||
|
* @return {Observable<string>} Returns an Observable that when subscribed
|
||||||
|
* to, will create a child process. The
|
||||||
|
* process output will be streamed to this
|
||||||
|
* Observable, and if unsubscribed from, the
|
||||||
|
* process will be terminated early. If the
|
||||||
|
* process terminates with a non-zero value,
|
||||||
|
* the Observable will terminate with onError.
|
||||||
|
*/
|
||||||
|
export function spawn(exe, params=[], opts=null) {
|
||||||
|
opts = opts || {};
|
||||||
|
let spawnObs = Observable.create((subj) => {
|
||||||
|
let proc = null;
|
||||||
|
|
||||||
|
let { cmd, args } = findActualExecutable(exe, params);
|
||||||
|
// d(`spawning process: ${cmd} ${args.join()}, ${JSON.stringify(opts)}`);
|
||||||
|
proc = spawnOg(cmd, args, omit(opts, 'jobber', 'split'));
|
||||||
|
|
||||||
|
let bufHandler = (source) => (b) => {
|
||||||
|
if (b.length < 1) return;
|
||||||
|
let chunk = "<< String sent back was too long >>";
|
||||||
|
try {
|
||||||
|
chunk = b.toString();
|
||||||
|
} catch (e) {
|
||||||
|
chunk = `<< Lost chunk of process output for ${exe} - length was ${b.length}>>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
subj.next({source: source, text: chunk});
|
||||||
|
};
|
||||||
|
|
||||||
|
let ret = new Subscription();
|
||||||
|
|
||||||
|
if (opts.stdin) {
|
||||||
|
if (proc.stdin) {
|
||||||
|
ret.add(opts.stdin.subscribe(
|
||||||
|
(x) => proc.stdin.write(x),
|
||||||
|
subj.error,
|
||||||
|
() => proc.stdin.end()
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
subj.error(new Error(`opts.stdio conflicts with provided spawn opts.stdin observable, 'pipe' is required`));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let stderrCompleted = null;
|
||||||
|
let stdoutCompleted = null;
|
||||||
|
let noClose = false;
|
||||||
|
|
||||||
|
if (proc.stdout) {
|
||||||
|
stdoutCompleted = new AsyncSubject();
|
||||||
|
proc.stdout.on('data', bufHandler('stdout'));
|
||||||
|
proc.stdout.on('close', () => { stdoutCompleted.next(true); stdoutCompleted.complete(); });
|
||||||
|
} else {
|
||||||
|
stdoutCompleted = Observable.of(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (proc.stderr) {
|
||||||
|
stderrCompleted = new AsyncSubject();
|
||||||
|
proc.stderr.on('data', bufHandler('stderr'));
|
||||||
|
proc.stderr.on('close', () => { stderrCompleted.next(true); stderrCompleted.complete(); });
|
||||||
|
} else {
|
||||||
|
stderrCompleted = Observable.of(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
proc.on('error', (e) => {
|
||||||
|
noClose = true;
|
||||||
|
subj.error(e);
|
||||||
|
});
|
||||||
|
|
||||||
|
proc.on('close', (code) => {
|
||||||
|
noClose = true;
|
||||||
|
let pipesClosed = Observable.merge(stdoutCompleted, stderrCompleted)
|
||||||
|
.reduce((acc) => acc, true);
|
||||||
|
|
||||||
|
if (code === 0) {
|
||||||
|
pipesClosed.subscribe(() => subj.complete());
|
||||||
|
} else {
|
||||||
|
pipesClosed.subscribe(() => subj.error(new Error(`Failed with exit code: ${code}`)));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ret.add(new Subscription(() => {
|
||||||
|
if (noClose) return;
|
||||||
|
|
||||||
|
// d(`Killing process: ${cmd} ${args.join()}`);
|
||||||
|
if (opts.jobber) {
|
||||||
|
// NB: Connecting to Jobber's named pipe will kill it
|
||||||
|
net.connect(`\\\\.\\pipe\\jobber-${proc.pid}`);
|
||||||
|
setTimeout(() => proc.kill(), 5*1000);
|
||||||
|
} else {
|
||||||
|
proc.kill();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
|
|
||||||
|
return opts.split ? spawnObs : spawnObs.pluck('text');
|
||||||
|
}
|
||||||
|
|
||||||
|
function wrapObservableInPromise(obs) {
|
||||||
|
return new Promise((res, rej) => {
|
||||||
|
let out = '';
|
||||||
|
|
||||||
|
obs.subscribe(
|
||||||
|
(x) => out += x,
|
||||||
|
(e) => rej(new Error(`${out}\n${e.message}`)),
|
||||||
|
() => res(out));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawns a process but detached from the current process. The process is put
|
||||||
|
* into its own Process Group.
|
||||||
|
*
|
||||||
|
* @param {string} exe The executable to run
|
||||||
|
* @param {Array<string>} params The parameters to pass to the child
|
||||||
|
* @param {Object} opts Options to pass to spawn.
|
||||||
|
*
|
||||||
|
* @return {Promise<string>} Returns an Promise that represents a detached
|
||||||
|
* process. The value returned is the process
|
||||||
|
* output. If the process terminates with a
|
||||||
|
* non-zero value, the Promise will resolve with
|
||||||
|
* an Error.
|
||||||
|
*/
|
||||||
|
export function spawnDetachedPromise(exe, params, opts=null) {
|
||||||
|
return wrapObservableInPromise(spawnDetached(exe, params, opts));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawns a process as a child process.
|
||||||
|
*
|
||||||
|
* @param {string} exe The executable to run
|
||||||
|
* @param {Array<string>} params The parameters to pass to the child
|
||||||
|
* @param {Object} opts Options to pass to spawn.
|
||||||
|
*
|
||||||
|
* @return {Promise<string>} Returns an Promise that represents a child
|
||||||
|
* process. The value returned is the process
|
||||||
|
* output. If the process terminates with a
|
||||||
|
* non-zero value, the Promise will resolve with
|
||||||
|
* an Error.
|
||||||
|
*/
|
||||||
|
export function spawnPromise(exe, params, opts=null) {
|
||||||
|
return wrapObservableInPromise(spawn(exe, params, opts));
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ const blameDecoration: TextEditorDecorationType = window.createTextEditorDecorat
|
|||||||
let highlightDecoration: TextEditorDecorationType;
|
let highlightDecoration: TextEditorDecorationType;
|
||||||
|
|
||||||
export default class GitBlameController extends Disposable {
|
export default class GitBlameController extends Disposable {
|
||||||
private _controller: GitBlameEditorController;
|
private _controller: GitBlameEditorController|null;
|
||||||
private _disposable: Disposable;
|
private _disposable: Disposable;
|
||||||
|
|
||||||
private _blameDecoration: TextEditorDecorationType;
|
private _blameDecoration: TextEditorDecorationType;
|
||||||
@@ -147,7 +147,6 @@ class GitBlameEditorController extends Disposable {
|
|||||||
|
|
||||||
this.editor.setDecorations(blameDecoration, []);
|
this.editor.setDecorations(blameDecoration, []);
|
||||||
this.editor.setDecorations(highlightDecoration, []);
|
this.editor.setDecorations(highlightDecoration, []);
|
||||||
this.editor = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this._disposable && this._disposable.dispose();
|
this._disposable && this._disposable.dispose();
|
||||||
@@ -170,7 +169,7 @@ class GitBlameEditorController extends Disposable {
|
|||||||
commands.executeCommand(BuiltInCommands.ToggleRenderWhitespace);
|
commands.executeCommand(BuiltInCommands.ToggleRenderWhitespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
let blameDecorationOptions: DecorationOptions[]
|
let blameDecorationOptions: DecorationOptions[] | undefined;
|
||||||
switch (this._config.annotation.style) {
|
switch (this._config.annotation.style) {
|
||||||
case BlameAnnotationStyle.Compact:
|
case BlameAnnotationStyle.Compact:
|
||||||
blameDecorationOptions = this._getCompactGutterDecorations(blame);
|
blameDecorationOptions = this._getCompactGutterDecorations(blame);
|
||||||
@@ -179,7 +178,10 @@ class GitBlameEditorController extends Disposable {
|
|||||||
blameDecorationOptions = this._getExpandedGutterDecorations(blame);
|
blameDecorationOptions = this._getExpandedGutterDecorations(blame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
this.editor.setDecorations(blameDecoration, blameDecorationOptions);
|
|
||||||
|
if (blameDecorationOptions) {
|
||||||
|
this.editor.setDecorations(blameDecoration, blameDecorationOptions);
|
||||||
|
}
|
||||||
|
|
||||||
sha = sha || blame.commits.values().next().value.sha;
|
sha = sha || blame.commits.values().next().value.sha;
|
||||||
|
|
||||||
|
|||||||
@@ -28,16 +28,16 @@ enum RemoveCacheReason {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default class GitProvider extends Disposable {
|
export default class GitProvider extends Disposable {
|
||||||
private _blameCache: Map<string, IBlameCacheEntry>;
|
private _blameCache: Map<string, IBlameCacheEntry>|null;
|
||||||
private _blameCacheDisposable: Disposable;
|
private _blameCacheDisposable: Disposable|null;
|
||||||
|
|
||||||
private _config: IConfig;
|
private _config: IConfig;
|
||||||
private _disposable: Disposable;
|
private _disposable: Disposable;
|
||||||
private _codeLensProviderDisposable: Disposable;
|
private _codeLensProviderDisposable: Disposable|null;
|
||||||
private _codeLensProviderSelector: DocumentFilter;
|
private _codeLensProviderSelector: DocumentFilter;
|
||||||
private _gitignore: Promise<ignore.Ignore>;
|
private _gitignore: Promise<ignore.Ignore>;
|
||||||
|
|
||||||
static BlameEmptyPromise = Promise.resolve(<IGitBlame>null);
|
static BlameEmptyPromise: Promise<IGitBlame|null> = Promise.resolve(null);
|
||||||
static BlameFormat = GitBlameFormat.incremental;
|
static BlameFormat = GitBlameFormat.incremental;
|
||||||
|
|
||||||
constructor(private context: ExtensionContext) {
|
constructor(private context: ExtensionContext) {
|
||||||
@@ -47,7 +47,7 @@ export default class GitProvider extends Disposable {
|
|||||||
|
|
||||||
this._onConfigure();
|
this._onConfigure();
|
||||||
|
|
||||||
this._gitignore = new Promise<ignore.Ignore>((resolve, reject) => {
|
this._gitignore = new Promise<ignore.Ignore|null>((resolve, reject) => {
|
||||||
const gitignorePath = path.join(repoPath, '.gitignore');
|
const gitignorePath = path.join(repoPath, '.gitignore');
|
||||||
fs.exists(gitignorePath, e => {
|
fs.exists(gitignorePath, e => {
|
||||||
if (e) {
|
if (e) {
|
||||||
@@ -198,7 +198,7 @@ export default class GitProvider extends Disposable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBlameForLine(fileName: string, line: number): Promise<IGitBlameLine> {
|
getBlameForLine(fileName: string, line: number): Promise<IGitBlameLine|null> {
|
||||||
return this.getBlameForFile(fileName).then(blame => {
|
return this.getBlameForFile(fileName).then(blame => {
|
||||||
const blameLine = blame && blame.lines[line];
|
const blameLine = blame && blame.lines[line];
|
||||||
if (!blameLine) return null;
|
if (!blameLine) return null;
|
||||||
@@ -212,7 +212,7 @@ export default class GitProvider extends Disposable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBlameForRange(fileName: string, range: Range): Promise<IGitBlameLines> {
|
getBlameForRange(fileName: string, range: Range): Promise<IGitBlameLines|null> {
|
||||||
return this.getBlameForFile(fileName).then(blame => {
|
return this.getBlameForFile(fileName).then(blame => {
|
||||||
if (!blame) return null;
|
if (!blame) return null;
|
||||||
|
|
||||||
@@ -261,7 +261,7 @@ export default class GitProvider extends Disposable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBlameForShaRange(fileName: string, sha: string, range: Range): Promise<IGitBlameCommitLines> {
|
getBlameForShaRange(fileName: string, sha: string, range: Range): Promise<IGitBlameCommitLines|null> {
|
||||||
return this.getBlameForFile(fileName).then(blame => {
|
return this.getBlameForFile(fileName).then(blame => {
|
||||||
if (!blame) return null;
|
if (!blame) return null;
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ export default class GitProvider extends Disposable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
getBlameLocations(fileName: string, range: Range) {
|
getBlameLocations(fileName: string, range: Range): Promise<Location[]|null> {
|
||||||
return this.getBlameForRange(fileName, range).then(blame => {
|
return this.getBlameForRange(fileName, range).then(blame => {
|
||||||
if (!blame) return null;
|
if (!blame) return null;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es5",
|
"target": "es6",
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"noLib": true,
|
"noLib": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
{
|
{
|
||||||
"globalDependencies": {
|
"globalDependencies": {
|
||||||
"tmp": "registry:dt/tmp#0.0.0+20160514170650"
|
"tmp": "registry:dt/tmp#0.0.0+20160514170650"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"lodash": "registry:npm/lodash#4.0.0+20160723033700"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -1,2 +1 @@
|
|||||||
/// <reference path="globals/tmp/index.d.ts" />
|
/// <reference path="globals/tmp/index.d.ts" />
|
||||||
/// <reference path="modules/lodash/index.d.ts" />
|
|
||||||
|
|||||||
18545
typings/modules/lodash/index.d.ts
vendored
18545
typings/modules/lodash/index.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"resolution": "main",
|
|
||||||
"tree": {
|
|
||||||
"src": "https://raw.githubusercontent.com/types/npm-lodash/9b83559bbd3454f0cd9e4020c920e36eee80d5a3/typings.json",
|
|
||||||
"raw": "registry:npm/lodash#4.0.0+20160723033700",
|
|
||||||
"main": "index.d.ts",
|
|
||||||
"version": "4.0.0",
|
|
||||||
"name": "lodash",
|
|
||||||
"type": "typings"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
8
typings/spawn-rx.d.ts
vendored
8
typings/spawn-rx.d.ts
vendored
@@ -4,10 +4,10 @@ declare module "spawn-rx" {
|
|||||||
|
|
||||||
namespace spawnrx {
|
namespace spawnrx {
|
||||||
function findActualExecutable(exe: string, args: Array<string>): { cmd: string, args: Array<string> };
|
function findActualExecutable(exe: string, args: Array<string>): { cmd: string, args: Array<string> };
|
||||||
function spawnDetached(exe: string, params: Array<string>, opts: Object): Observable<string>;
|
function spawnDetached(exe: string, params: Array<string>, opts: Object|undefined): Observable<string>;
|
||||||
function spawn(exe: string, params: Array<string>, opts: Object): Observable<string>;
|
function spawn(exe: string, params: Array<string>, opts: Object|undefined): Observable<string>;
|
||||||
function spawnDetachedPromise(exe: string, params: Array<string>, opts: Object): Promise<string>;
|
function spawnDetachedPromise(exe: string, params: Array<string>, opts: Object|undefined): Promise<string>;
|
||||||
function spawnPromise(exe: string, params: Array<string>, opts: Object): Promise<string>;
|
function spawnPromise(exe: string, params: Array<string>, opts: Object|undefined): Promise<string>;
|
||||||
}
|
}
|
||||||
export = spawnrx;
|
export = spawnrx;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user