Browse Source

Reduces the size of the vsix

main
Eric Amodio 8 years ago
parent
commit
30b1fba8d4
7 changed files with 15 additions and 9 deletions
  1. +1
    -0
      .vscodeignore
  2. +1
    -1
      README.md
  3. BIN
      images/preview-blame.png
  4. BIN
      images/preview-codelens.png
  5. +4
    -2
      package.json
  6. +3
    -2
      src/gitCodeLensProvider.ts
  7. +6
    -4
      src/gitProvider.ts

+ 1
- 0
.vscodeignore View File

@ -1,3 +1,4 @@
images/*.gif
.vscode/** .vscode/**
typings/** typings/**
out/test/** out/test/**

+ 1
- 1
README.md View File

@ -43,7 +43,7 @@ Must be using Git and it must be in your path.
## Release Notes ## Release Notes
### 0.3.0
### 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
- Adds new command to toggle CodeLens on and off when `gitlens.codeLens.visibility` is set to `ondemand` - Adds new command to toggle CodeLens on and off when `gitlens.codeLens.visibility` is set to `ondemand`

BIN
images/preview-blame.png View File

Before After
Width: 1104  |  Height: 752  |  Size: 185 KiB

BIN
images/preview-codelens.png View File

Before After
Width: 787  |  Height: 556  |  Size: 124 KiB

+ 4
- 2
package.json View File

@ -1,6 +1,6 @@
{ {
"name": "gitlens", "name": "gitlens",
"version": "0.3.0",
"version": "0.3.1",
"author": { "author": {
"name": "Eric Amodio", "name": "Eric Amodio",
"email": "eamodio@gmail.com" "email": "eamodio@gmail.com"
@ -195,7 +195,9 @@
], ],
"dependencies": { "dependencies": {
"ignore": "^3.1.5", "ignore": "^3.1.5",
"lodash": "^4.15.0",
"lodash.debounce": "^4.0.8",
"lodash.escaperegexp": "^4.1.2",
"lodash.isequal": "^4.4.0",
"moment": "^2.15.0", "moment": "^2.15.0",
"spawn-rx": "^2.0.1", "spawn-rx": "^2.0.1",
"tmp": "^0.0.29" "tmp": "^0.0.29"

+ 3
- 2
src/gitCodeLensProvider.ts View File

@ -3,9 +3,10 @@ import {CancellationToken, CodeLens, CodeLensProvider, commands, DocumentSelecto
import {BuiltInCommands, Commands, DocumentSchemes, WorkspaceState} from './constants'; import {BuiltInCommands, Commands, DocumentSchemes, WorkspaceState} from './constants';
import {CodeLensCommand, CodeLensLocation, ICodeLensesConfig} from './configuration'; import {CodeLensCommand, CodeLensLocation, ICodeLensesConfig} from './configuration';
import GitProvider, {IGitBlame, IGitBlameLines, IGitCommit} from './gitProvider'; import GitProvider, {IGitBlame, IGitBlameLines, IGitCommit} from './gitProvider';
import * as _ from 'lodash';
import * as moment from 'moment'; import * as moment from 'moment';
const escapeRegExp = require('lodash.escapeRegExp');
export class GitRecentChangeCodeLens extends CodeLens { export class GitRecentChangeCodeLens extends CodeLens {
constructor(private git: GitProvider, public fileName: string, public symbolKind: SymbolKind, public blameRange: Range, range: Range) { constructor(private git: GitProvider, public fileName: string, public symbolKind: SymbolKind, public blameRange: Range, range: Range) {
super(range); super(range);
@ -105,7 +106,7 @@ export default class GitCodeLensProvider implements CodeLensProvider {
let startChar = -1; let startChar = -1;
try { try {
startChar = line.text.search(`\\b${_.escapeRegExp(symbol.name)}\\b`);
startChar = line.text.search(`\\b${escapeRegExp(symbol.name)}\\b`);
} }
catch (ex) { } catch (ex) { }
if (startChar === -1) { if (startChar === -1) {

+ 6
- 4
src/gitProvider.ts View File

@ -6,10 +6,12 @@ import GitCodeLensProvider from './gitCodeLensProvider';
import Git, {GitBlameParserEnricher, GitBlameFormat, GitCommit, IGitAuthor, IGitBlame, IGitBlameCommitLines, IGitBlameLine, IGitBlameLines, IGitCommit} from './git/git'; import Git, {GitBlameParserEnricher, GitBlameFormat, GitCommit, IGitAuthor, IGitBlame, IGitBlameCommitLines, IGitBlameLine, IGitBlameLines, IGitCommit} from './git/git';
import * as fs from 'fs' import * as fs from 'fs'
import * as ignore from 'ignore'; import * as ignore from 'ignore';
import * as _ from 'lodash';
import * as moment from 'moment'; import * as moment from 'moment';
import * as path from 'path'; import * as path from 'path';
const debounce = require('lodash.debounce');
const isEqual = require('lodash.isequal');
export { Git }; export { Git };
export * from './git/git'; export * from './git/git';
@ -83,7 +85,7 @@ export default class GitProvider extends Disposable {
private _onConfigure() { private _onConfigure() {
const config = workspace.getConfiguration().get<IConfig>('gitlens'); const config = workspace.getConfiguration().get<IConfig>('gitlens');
if (!_.isEqual(config.codeLens, this._config && this._config.codeLens)) {
if (!isEqual(config.codeLens, this._config && this._config.codeLens)) {
this._codeLensProviderDisposable && this._codeLensProviderDisposable.dispose(); this._codeLensProviderDisposable && this._codeLensProviderDisposable.dispose();
if (config.codeLens.visibility === CodeLensVisibility.Auto && (config.codeLens.recentChange.enabled || config.codeLens.authors.enabled)) { if (config.codeLens.visibility === CodeLensVisibility.Auto && (config.codeLens.recentChange.enabled || config.codeLens.authors.enabled)) {
this._codeLensProviderSelector = GitCodeLensProvider.selector; this._codeLensProviderSelector = GitCodeLensProvider.selector;
@ -93,7 +95,7 @@ export default class GitProvider extends Disposable {
} }
} }
if (!_.isEqual(config.advanced, this._config && this._config.advanced)) {
if (!isEqual(config.advanced, this._config && this._config.advanced)) {
if (config.advanced.caching.enabled) { if (config.advanced.caching.enabled) {
// TODO: Cache needs to be cleared on file changes -- createFileSystemWatcher or timeout? // TODO: Cache needs to be cleared on file changes -- createFileSystemWatcher or timeout?
this._blameCache = new Map(); this._blameCache = new Map();
@ -103,7 +105,7 @@ export default class GitProvider extends Disposable {
// TODO: Maybe stop clearing on close and instead limit to a certain number of recent blames // TODO: Maybe stop clearing on close and instead limit to a certain number of recent blames
disposables.push(workspace.onDidCloseTextDocument(d => this._removeCachedBlame(d, RemoveCacheReason.DocumentClosed))); disposables.push(workspace.onDidCloseTextDocument(d => this._removeCachedBlame(d, RemoveCacheReason.DocumentClosed)));
const removeCachedBlameFn = _.debounce(this._removeCachedBlame.bind(this), 2500);
const removeCachedBlameFn = debounce(this._removeCachedBlame.bind(this), 2500);
disposables.push(workspace.onDidSaveTextDocument(d => removeCachedBlameFn(d, RemoveCacheReason.DocumentSaved))); disposables.push(workspace.onDidSaveTextDocument(d => removeCachedBlameFn(d, RemoveCacheReason.DocumentSaved)));
disposables.push(workspace.onDidChangeTextDocument(e => removeCachedBlameFn(e.document, RemoveCacheReason.DocumentChanged))); disposables.push(workspace.onDidChangeTextDocument(e => removeCachedBlameFn(e.document, RemoveCacheReason.DocumentChanged)));

Loading…
Cancel
Save