Ver código fonte

Fixes errors when selecting the last blank line

main
Eric Amodio 7 anos atrás
pai
commit
f53ecf8a7e
2 arquivos alterados com 8 adições e 11 exclusões
  1. +4
    -1
      src/blameAnnotationProvider.ts
  2. +4
    -10
      src/blameStatusBarController.ts

+ 4
- 1
src/blameAnnotationProvider.ts Ver arquivo

@ -132,7 +132,8 @@ export class BlameAnnotationProvider extends Disposable {
else if (typeof shaOrLine === 'number') {
const line = shaOrLine - offset;
if (line >= 0) {
sha = blame.lines[line].sha;
const commitLine = blame.lines[line];
sha = commitLine && commitLine.sha;
}
}
else {
@ -193,6 +194,7 @@ export class BlameAnnotationProvider extends Disposable {
const hoverMessage = BlameAnnotationFormatter.getAnnotationHover(this._config, l, commit);
// Escape single quotes because for some reason that breaks the ::before or ::after element
// https://github.com/Microsoft/vscode/issues/19922 remove once this is released
gutter = gutter.replace(/\'/g, '\\\'');
lastSha = l.sha;
@ -276,6 +278,7 @@ export class BlameAnnotationProvider extends Disposable {
const format = trailing ? BlameAnnotationFormat.Unconstrained : BlameAnnotationFormat.Constrained;
// Escape single quotes because for some reason that breaks the ::before or ::after element
// https://github.com/Microsoft/vscode/issues/19922 remove once this is released
const gutter = BlameAnnotationFormatter.getAnnotation(this._config, commit, format).replace(/\'/g, '\\\'');
const hoverMessage = BlameAnnotationFormatter.getAnnotationHover(this._config, l, commit);

+ 4
- 10
src/blameStatusBarController.ts Ver arquivo

@ -6,7 +6,6 @@ import { TextDocumentComparer, TextEditorComparer } from './comparers';
import { IBlameConfig, IConfig, StatusBarCommand } from './configuration';
import { DocumentSchemes } from './constants';
import GitProvider, { GitCommit, GitUri, IGitBlame, IGitCommitLine } from './gitProvider';
import { Logger } from './logger';
import * as moment from 'moment';
const activeLineDecoration: TextEditorDecorationType = window.createTextEditorDecorationType({
@ -160,15 +159,9 @@ export default class BlameStatusBarController extends Disposable {
return;
}
try {
commitLine = blame.lines[line];
const sha = commitLine.sha;
commit = blame.commits.get(sha);
}
catch (ex) {
Logger.error(`DEBUG(${this._uri.toString()}): Line ${line} not found in blame; lines=${blame.lines.length}, uriOffset=${this._uri.offset}, repoPath=${blame.repoPath}`);
throw ex;
}
commitLine = blame.lines[line];
const sha = commitLine && commitLine.sha;
commit = sha && blame.commits.get(sha);
}
else {
const blameLine = await this.git.getBlameForLine(this._uri.fsPath, line, this._uri.sha, this._uri.repoPath);
@ -246,6 +239,7 @@ export default class BlameStatusBarController extends Disposable {
} as IBlameConfig;
// Escape single quotes because for some reason that breaks the ::before or ::after element
// https://github.com/Microsoft/vscode/issues/19922 remove once this is released
const annotation = BlameAnnotationFormatter.getAnnotation(config, commit, BlameAnnotationFormat.Unconstrained).replace(/\'/g, '\\\'');
// Get the full commit message -- since blame only returns the summary

Carregando…
Cancelar
Salvar