Browse Source

Changes code lens and line blame toggles to always work

main
Eric Amodio 7 years ago
parent
commit
6898c39195
6 changed files with 18 additions and 25 deletions
  1. +4
    -4
      package.json
  2. +2
    -2
      src/codeLensController.ts
  3. +4
    -6
      src/commands/showLineBlame.ts
  4. +4
    -5
      src/commands/toggleCodeLens.ts
  5. +4
    -6
      src/commands/toggleLineBlame.ts
  6. +0
    -2
      src/currentLineController.ts

+ 4
- 4
package.json View File

@ -1686,11 +1686,11 @@
},
{
"command": "gitlens.toggleLineBlame",
"when": "gitlens:activeIsBlameable"
"when": "gitlens:enabled"
},
{
"command": "gitlens.toggleCodeLens",
"when": "gitlens:activeIsTracked && gitlens:canToggleCodeLens"
"when": "gitlens:enabled && gitlens:canToggleCodeLens"
},
{
"command": "gitlens.showLastQuickPick",
@ -3083,7 +3083,7 @@
"command": "gitlens.toggleCodeLens",
"key": "ctrl+shift+g shift+b",
"mac": "cmd+alt+g shift+b",
"when": "gitlens:keymap == chorded && editorTextFocus && gitlens:activeIsTracked && gitlens:canToggleCodeLens"
"when": "gitlens:keymap == chorded && editorTextFocus && gitlens:enabled && gitlens:canToggleCodeLens"
},
{
"command": "gitlens.showLastQuickPick",
@ -3159,7 +3159,7 @@
{
"command": "gitlens.toggleCodeLens",
"key": "shift+alt+b",
"when": "gitlens:keymap == standard && editorTextFocus && gitlens:activeIsTracked && gitlens:canToggleCodeLens"
"when": "gitlens:keymap == standard && editorTextFocus && gitlens:enabled && gitlens:canToggleCodeLens"
},
{
"command": "gitlens.showLastQuickPick",

+ 2
- 2
src/codeLensController.ts View File

@ -1,5 +1,5 @@
'use strict';
import { ConfigurationChangeEvent, Disposable, languages, TextEditor } from 'vscode';
import { ConfigurationChangeEvent, Disposable, languages } from 'vscode';
import { configuration, ICodeLensConfig } from './configuration';
import { CommandContext, setCommandContext } from './constants';
import { Container } from './container';
@ -79,7 +79,7 @@ export class CodeLensController extends Disposable {
this._provider.reset('idle');
}
toggleCodeLens(editor: TextEditor) {
toggleCodeLens() {
if (!this._canToggle) return;
Logger.log(`toggleCodeLens()`);

+ 4
- 6
src/commands/showLineBlame.ts View File

@ -1,18 +1,16 @@
'use strict';
import { TextEditor, TextEditorEdit, window } from 'vscode';
import { Commands, EditorCommand } from './common';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './common';
import { Container } from '../container';
import { Logger } from '../logger';
export class ShowLineBlameCommand extends EditorCommand {
export class ShowLineBlameCommand extends ActiveEditorCommand {
constructor() {
super(Commands.ShowLineBlame);
}
async execute(editor: TextEditor, edit: TextEditorEdit): Promise<any> {
if (editor === undefined) return undefined;
async execute(editor?: TextEditor, uri?: Uri): Promise<any> {
try {
return Container.lineAnnotations.showAnnotations(editor);
}

+ 4
- 5
src/commands/toggleCodeLens.ts View File

@ -1,15 +1,14 @@
'use strict';
import { TextEditor, TextEditorEdit } from 'vscode';
import { Commands, EditorCommand } from './common';
import { Command, Commands } from './common';
import { Container } from '../container';
export class ToggleCodeLensCommand extends EditorCommand {
export class ToggleCodeLensCommand extends Command {
constructor() {
super(Commands.ToggleCodeLens);
}
execute(editor: TextEditor, edit: TextEditorEdit) {
return Container.codeLens.toggleCodeLens(editor);
execute() {
return Container.codeLens.toggleCodeLens();
}
}

+ 4
- 6
src/commands/toggleLineBlame.ts View File

@ -1,18 +1,16 @@
'use strict';
import { TextEditor, TextEditorEdit, Uri, window } from 'vscode';
import { Commands, EditorCommand } from './common';
import { TextEditor, Uri, window } from 'vscode';
import { ActiveEditorCommand, Commands } from './common';
import { Container } from '../container';
import { Logger } from '../logger';
export class ToggleLineBlameCommand extends EditorCommand {
export class ToggleLineBlameCommand extends ActiveEditorCommand {
constructor() {
super(Commands.ToggleLineBlame);
}
async execute(editor: TextEditor, edit: TextEditorEdit, uri?: Uri): Promise<any> {
if (editor === undefined) return undefined;
async execute(editor: TextEditor, uri?: Uri): Promise<any> {
try {
return Container.lineAnnotations.toggleAnnotations(editor);
}

+ 0
- 2
src/currentLineController.ts View File

@ -311,8 +311,6 @@ export class CurrentLineController extends Disposable {
}
async toggleAnnotations(editor: TextEditor | undefined) {
if (editor === undefined) return;
const state = this.getBlameAnnotationState();
this.setBlameAnnotationState(!state.enabled, editor);
}

Loading…
Cancel
Save