Browse Source

Updates to latest vscode extension template

Removes typings (using npm instead)
Fixes some promise catches
main
Eric Amodio 8 years ago
parent
commit
8df6b80725
15 changed files with 33 additions and 89 deletions
  1. +1
    -2
      .vscode/settings.json
  2. +2
    -1
      .vscodeignore
  3. +9
    -6
      package.json
  4. +7
    -7
      src/commands/diffWithPrevious.ts
  5. +5
    -5
      src/commands/diffWithWorking.ts
  6. +2
    -2
      src/commands/showBlame.ts
  7. +2
    -2
      src/commands/showBlameHistory.ts
  8. +2
    -2
      src/commands/toggleBlame.ts
  9. +3
    -1
      tsconfig.json
  10. +0
    -5
      typings.json
  11. +0
    -45
      typings/globals/tmp/index.d.ts
  12. +0
    -8
      typings/globals/tmp/typings.json
  13. +0
    -1
      typings/index.d.ts
  14. +0
    -1
      typings/node.d.ts
  15. +0
    -1
      typings/vscode-typings.d.ts

+ 1
- 2
.vscode/settings.json View File

@ -2,8 +2,7 @@
{ {
"files.exclude": { "files.exclude": {
"out": false, // set this to true to hide the "out" folder with the compiled JS files "out": false, // set this to true to hide the "out" folder with the compiled JS files
"node_modules": true,
"typings": true
"node_modules": true
}, },
"search.exclude": { "search.exclude": {
"out": true, // set this to false to include "out" folder in search results "out": true, // set this to false to include "out" folder in search results

+ 2
- 1
.vscodeignore View File

@ -1,6 +1,7 @@
images/*.gif images/*.gif
.vscode/**
typings/** typings/**
.vscode/**
.vscode-test/**
out/test/** out/test/**
test/** test/**
src/** src/**

+ 9
- 6
package.json View File

@ -7,7 +7,7 @@
}, },
"publisher": "eamodio", "publisher": "eamodio",
"engines": { "engines": {
"vscode": "^1.3.0"
"vscode": "^1.5.0"
}, },
"license": "SEE LICENSE IN LICENSE", "license": "SEE LICENSE IN LICENSE",
"displayName": "GitLens", "displayName": "GitLens",
@ -217,18 +217,21 @@
"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": "^4.16.1",
"moment": "^2.15.1", "moment": "^2.15.1",
"spawn-rx": "^2.0.1",
"spawn-rx": "^2.0.3",
"tmp": "^0.0.29" "tmp": "^0.0.29"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^2.0.3", "typescript": "^2.0.3",
"vscode": "^0.11.17"
"vscode": "^1.0.0",
"mocha": "^3.1.0",
"@types/node": "^6.0.41",
"@types/mocha": "^2.2.32",
"@types/tmp": "^0.0.31"
}, },
"scripts": { "scripts": {
"vscode:prepublish": "node ./node_modules/vscode/bin/compile && tsc",
"compile": "node ./node_modules/vscode/bin/compile -watch -p ./",
"vscode:prepublish": "tsc -p ./",
"compile": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install", "postinstall": "node ./node_modules/vscode/bin/install",
"pack": "git clean -xdf && npm install && vsce package", "pack": "git clean -xdf && npm install && vsce package",
"pub": "git clean -xdf --exclude=node_modules/ && npm install && vsce publish" "pub": "git clean -xdf --exclude=node_modules/ && npm install && vsce publish"

+ 7
- 7
src/commands/diffWithPrevious.ts View File

@ -19,7 +19,6 @@ export default class DiffWithPreviousCommand extends EditorCommand {
} }
return this.git.getBlameForLine(uri.fsPath, line) return this.git.getBlameForLine(uri.fsPath, line)
.catch(ex => console.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${line})`, ex))
.then(blame => { .then(blame => {
if (!blame) return; if (!blame) return;
@ -27,16 +26,17 @@ export default class DiffWithPreviousCommand extends EditorCommand {
const commit = blame.commit; const commit = blame.commit;
if (commit.isUncommitted) { if (commit.isUncommitted) {
return this.git.getBlameForLine(commit.previousUri.fsPath, blame.line.originalLine + 1, commit.previousSha, commit.repoPath) return this.git.getBlameForLine(commit.previousUri.fsPath, blame.line.originalLine + 1, commit.previousSha, commit.repoPath)
.catch(ex => console.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${blame.line.originalLine}, ${commit.previousSha})`, ex))
.then(prevBlame => { .then(prevBlame => {
if (!prevBlame) return; if (!prevBlame) return;
const prevCommit = prevBlame.commit; const prevCommit = prevBlame.commit;
return commands.executeCommand(Commands.DiffWithPrevious, commit.previousUri, commit.repoPath, commit.previousSha, commit.previousUri, prevCommit.sha, prevCommit.uri, blame.line.originalLine); return commands.executeCommand(Commands.DiffWithPrevious, commit.previousUri, commit.repoPath, commit.previousSha, commit.previousUri, prevCommit.sha, prevCommit.uri, blame.line.originalLine);
});
})
.catch(ex => console.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${blame.line.originalLine}, ${commit.previousSha})`, ex));
} }
return commands.executeCommand(Commands.DiffWithPrevious, commit.uri, commit.repoPath, commit.sha, commit.uri, commit.previousSha, commit.previousUri, line); return commands.executeCommand(Commands.DiffWithPrevious, commit.uri, commit.repoPath, commit.sha, commit.uri, commit.previousSha, commit.previousUri, line);
});
})
.catch(ex => console.error('[GitLens.DiffWithPreviousCommand]', `getBlameForLine(${line})`, ex));
} }
if (!compareWithSha) { if (!compareWithSha) {
@ -44,8 +44,8 @@ export default class DiffWithPreviousCommand extends EditorCommand {
} }
return Promise.all([this.git.getVersionedFile(shaUri.fsPath, repoPath, sha), this.git.getVersionedFile(compareWithUri.fsPath, repoPath, compareWithSha)]) return Promise.all([this.git.getVersionedFile(shaUri.fsPath, repoPath, sha), this.git.getVersionedFile(compareWithUri.fsPath, repoPath, compareWithSha)])
.catch(ex => console.error('[GitLens.DiffWithPreviousCommand]', 'getVersionedFile', ex))
.then(values => commands.executeCommand(BuiltInCommands.Diff, Uri.file(values[1]), Uri.file(values[0]), `${path.basename(compareWithUri.fsPath)} (${compareWithSha}) ↔ ${path.basename(shaUri.fsPath)} (${sha})`)
.then(() => commands.executeCommand(BuiltInCommands.RevealLine, {lineNumber: line, at: 'center'})));
.then(values => commands.executeCommand(BuiltInCommands.Diff, Uri.file(values[1]), Uri.file(values[0]), `${path.basename(compareWithUri.fsPath)} (${compareWithSha}) ↔ ${path.basename(shaUri.fsPath)} (${sha})`))
.then(() => commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }))
.catch(ex => console.error('[GitLens.DiffWithPreviousCommand]', 'getVersionedFile', ex));
} }
} }

+ 5
- 5
src/commands/diffWithWorking.ts View File

@ -19,7 +19,6 @@ export default class DiffWithWorkingCommand extends EditorCommand {
} }
return this.git.getBlameForLine(uri.fsPath, line) return this.git.getBlameForLine(uri.fsPath, line)
.catch(ex => console.error('[GitLens.DiffWithWorkingCommand]', `getBlameForLine(${line})`, ex))
.then(blame => { .then(blame => {
if (!blame) return; if (!blame) return;
@ -29,12 +28,13 @@ export default class DiffWithWorkingCommand extends EditorCommand {
return commands.executeCommand(Commands.DiffWithWorking, commit.uri, commit.repoPath, commit.previousSha, commit.previousUri, blame.line.line + 1); return commands.executeCommand(Commands.DiffWithWorking, commit.uri, commit.repoPath, commit.previousSha, commit.previousUri, blame.line.line + 1);
} }
return commands.executeCommand(Commands.DiffWithWorking, commit.uri, commit.repoPath, commit.sha, commit.uri, line) return commands.executeCommand(Commands.DiffWithWorking, commit.uri, commit.repoPath, commit.sha, commit.uri, line)
});
})
.catch(ex => console.error('[GitLens.DiffWithWorkingCommand]', `getBlameForLine(${line})`, ex));
}; };
return this.git.getVersionedFile(shaUri.fsPath, repoPath, sha) return this.git.getVersionedFile(shaUri.fsPath, repoPath, sha)
.catch(ex => console.error('[GitLens.DiffWithWorkingCommand]', 'getVersionedFile', ex))
.then(compare => commands.executeCommand(BuiltInCommands.Diff, Uri.file(compare), uri, `${path.basename(shaUri.fsPath)} (${sha}) ↔ ${path.basename(uri.fsPath)}`)
.then(() => commands.executeCommand(BuiltInCommands.RevealLine, {lineNumber: line, at: 'center'})));
.then(compare => commands.executeCommand(BuiltInCommands.Diff, Uri.file(compare), uri, `${path.basename(shaUri.fsPath)} (${sha}) ↔ ${path.basename(uri.fsPath)}`))
.then(() => commands.executeCommand(BuiltInCommands.RevealLine, { lineNumber: line, at: 'center' }))
.catch(ex => console.error('[GitLens.DiffWithWorkingCommand]', 'getVersionedFile', ex));
} }
} }

+ 2
- 2
src/commands/showBlame.ts View File

@ -21,7 +21,7 @@ export default class ShowBlameCommand extends EditorCommand {
} }
return this.git.getBlameForLine(uri.fsPath, editor.selection.active.line) return this.git.getBlameForLine(uri.fsPath, editor.selection.active.line)
.catch(ex => console.error('[GitLens.ShowBlameCommand]', `getBlameForLine(${editor.selection.active.line})`, ex))
.then(blame => this.annotationController.showBlameAnnotation(editor, blame && blame.commit.sha));
.then(blame => this.annotationController.showBlameAnnotation(editor, blame && blame.commit.sha))
.catch(ex => console.error('[GitLens.ShowBlameCommand]', `getBlameForLine(${editor.selection.active.line})`, ex));
} }
} }

+ 2
- 2
src/commands/showBlameHistory.ts View File

@ -20,7 +20,7 @@ export default class ShowBlameHistoryCommand extends EditorCommand {
} }
return this.git.getBlameLocations(uri.fsPath, range) return this.git.getBlameLocations(uri.fsPath, range)
.catch(ex => console.error('[GitLens.ShowBlameHistoryCommand]', 'getBlameLocations', ex))
.then(locations => commands.executeCommand(BuiltInCommands.ShowReferences, uri, position, locations));
.then(locations => commands.executeCommand(BuiltInCommands.ShowReferences, uri, position, locations))
.catch(ex => console.error('[GitLens.ShowBlameHistoryCommand]', 'getBlameLocations', ex));
} }
} }

+ 2
- 2
src/commands/toggleBlame.ts View File

@ -21,8 +21,8 @@ export default class ToggleBlameCommand extends EditorCommand {
} }
return this.git.getBlameForLine(uri.fsPath, editor.selection.active.line) return this.git.getBlameForLine(uri.fsPath, editor.selection.active.line)
.catch(ex => console.error('[GitLens.ToggleBlameCommand]', `getBlameForLine(${editor.selection.active.line})`, ex))
.then(blame => this.blameController.toggleBlameAnnotation(editor, blame && blame.commit.sha));
.then(blame => this.blameController.toggleBlameAnnotation(editor, blame && blame.commit.sha))
.catch(ex => console.error('[GitLens.ToggleBlameCommand]', `getBlameForLine(${editor.selection.active.line})`, ex));
} }
} }

+ 3
- 1
tsconfig.json View File

@ -3,7 +3,9 @@
"module": "commonjs", "module": "commonjs",
"target": "es6", "target": "es6",
"outDir": "out", "outDir": "out",
"noLib": true,
"lib": [
"es6"
],
"sourceMap": true, "sourceMap": true,
"rootDir": "." "rootDir": "."
}, },

+ 0
- 5
typings.json View File

@ -1,5 +0,0 @@
{
"globalDependencies": {
"tmp": "registry:dt/tmp#0.0.0+20160514170650"
}
}

+ 0
- 45
typings/globals/tmp/index.d.ts View File

@ -1,45 +0,0 @@
// Generated by typings
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d6115f046550714a28caa3555f47a1aec114fe5/tmp/tmp.d.ts
declare module "tmp" {
namespace tmp {
interface Options extends SimpleOptions {
mode?: number;
}
interface SimpleOptions {
prefix?: string;
postfix?: string;
template?: string;
dir?: string;
tries?: number;
keep?: boolean;
unsafeCleanup?: boolean;
}
interface SynchrounousResult {
name: string;
fd: number;
removeCallback: () => void;
}
function file(callback: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function file(config: Options, callback?: (err: any, path: string, fd: number, cleanupCallback: () => void) => void): void;
function fileSync(config?: Options): SynchrounousResult;
function dir(callback: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dir(config: Options, callback?: (err: any, path: string, cleanupCallback: () => void) => void): void;
function dirSync(config?: Options): SynchrounousResult;
function tmpName(callback: (err: any, path: string) => void): void;
function tmpName(config: SimpleOptions, callback?: (err: any, path: string) => void): void;
function tmpNameSync(config?: SimpleOptions): string;
function setGracefulCleanup(): void;
}
export = tmp;
}

+ 0
- 8
typings/globals/tmp/typings.json View File

@ -1,8 +0,0 @@
{
"resolution": "main",
"tree": {
"src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d6115f046550714a28caa3555f47a1aec114fe5/tmp/tmp.d.ts",
"raw": "registry:dt/tmp#0.0.0+20160514170650",
"typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/5d6115f046550714a28caa3555f47a1aec114fe5/tmp/tmp.d.ts"
}
}

+ 0
- 1
typings/index.d.ts View File

@ -1 +0,0 @@
/// <reference path="globals/tmp/index.d.ts" />

+ 0
- 1
typings/node.d.ts View File

@ -1 +0,0 @@
/// <reference path="../node_modules/vscode/typings/node.d.ts" />

+ 0
- 1
typings/vscode-typings.d.ts View File

@ -1 +0,0 @@
/// <reference path="../node_modules/vscode/typings/index.d.ts" />

Loading…
Cancel
Save