mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-13 11:38:40 -05:00
Adds const for ExtensionKey
This commit is contained in:
@@ -5,7 +5,7 @@ import { BlameAnnotationController } from './blameAnnotationController';
|
|||||||
import { BlameAnnotationFormat, BlameAnnotationFormatter } from './blameAnnotationFormatter';
|
import { BlameAnnotationFormat, BlameAnnotationFormatter } from './blameAnnotationFormatter';
|
||||||
import { TextEditorComparer } from './comparers';
|
import { TextEditorComparer } from './comparers';
|
||||||
import { IBlameConfig, IConfig, StatusBarCommand } from './configuration';
|
import { IBlameConfig, IConfig, StatusBarCommand } from './configuration';
|
||||||
import { DocumentSchemes } from './constants';
|
import { DocumentSchemes, ExtensionKey } from './constants';
|
||||||
import { BlameabilityChangeEvent, GitCommit, GitContextTracker, GitService, GitUri, IGitBlame, IGitCommitLine } from './gitService';
|
import { BlameabilityChangeEvent, GitCommit, GitContextTracker, GitService, GitUri, IGitBlame, IGitCommitLine } from './gitService';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ export class BlameActiveLineController extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _onConfigurationChanged() {
|
private _onConfigurationChanged() {
|
||||||
const config = workspace.getConfiguration('').get<IConfig>('gitlens');
|
const config = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||||
|
|
||||||
let changed: boolean = false;
|
let changed: boolean = false;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { DecorationRenderOptions, Disposable, Event, EventEmitter, ExtensionCont
|
|||||||
import { BlameAnnotationProvider } from './blameAnnotationProvider';
|
import { BlameAnnotationProvider } from './blameAnnotationProvider';
|
||||||
import { TextDocumentComparer, TextEditorComparer } from './comparers';
|
import { TextDocumentComparer, TextEditorComparer } from './comparers';
|
||||||
import { IBlameConfig } from './configuration';
|
import { IBlameConfig } from './configuration';
|
||||||
|
import { ExtensionKey } from './constants';
|
||||||
import { BlameabilityChangeEvent, GitService, GitUri, GitContextTracker } from './gitService';
|
import { BlameabilityChangeEvent, GitService, GitUri, GitContextTracker } from './gitService';
|
||||||
import { Logger } from './logger';
|
import { Logger } from './logger';
|
||||||
import { WhitespaceController } from './whitespaceController';
|
import { WhitespaceController } from './whitespaceController';
|
||||||
@@ -57,7 +58,7 @@ export class BlameAnnotationController extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _onConfigurationChanged() {
|
private _onConfigurationChanged() {
|
||||||
let toggleWhitespace = workspace.getConfiguration('gitlens.advanced.toggleWhitespace').get<boolean>('enabled');
|
let toggleWhitespace = workspace.getConfiguration(`${ExtensionKey}.advanced.toggleWhitespace`).get<boolean>('enabled');
|
||||||
if (!toggleWhitespace) {
|
if (!toggleWhitespace) {
|
||||||
// Until https://github.com/Microsoft/vscode/issues/11485 is fixed we need to toggle whitespace for non-monospace fonts and ligatures
|
// Until https://github.com/Microsoft/vscode/issues/11485 is fixed we need to toggle whitespace for non-monospace fonts and ligatures
|
||||||
// TODO: detect monospace font
|
// TODO: detect monospace font
|
||||||
@@ -72,7 +73,7 @@ export class BlameAnnotationController extends Disposable {
|
|||||||
this._whitespaceController = undefined;
|
this._whitespaceController = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = workspace.getConfiguration('gitlens').get<IBlameConfig>('blame');
|
const config = workspace.getConfiguration(ExtensionKey).get<IBlameConfig>('blame');
|
||||||
|
|
||||||
if (config.annotation.highlight !== (this._config && this._config.annotation.highlight)) {
|
if (config.annotation.highlight !== (this._config && this._config.annotation.highlight)) {
|
||||||
BlameDecorations.highlight && BlameDecorations.highlight.dispose();
|
BlameDecorations.highlight && BlameDecorations.highlight.dispose();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { BlameAnnotationFormat, BlameAnnotationFormatter, defaultAuthorLength }
|
|||||||
import { BlameDecorations } from './blameAnnotationController';
|
import { BlameDecorations } from './blameAnnotationController';
|
||||||
import { TextDocumentComparer } from './comparers';
|
import { TextDocumentComparer } from './comparers';
|
||||||
import { BlameAnnotationStyle, IBlameConfig } from './configuration';
|
import { BlameAnnotationStyle, IBlameConfig } from './configuration';
|
||||||
|
import { ExtensionKey } from './constants';
|
||||||
import { GitService, GitUri, IGitBlame } from './gitService';
|
import { GitService, GitUri, IGitBlame } from './gitService';
|
||||||
import { WhitespaceController } from './whitespaceController';
|
import { WhitespaceController } from './whitespaceController';
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ export class BlameAnnotationProvider extends Disposable {
|
|||||||
|
|
||||||
this._blame = this.git.getBlameForFile(this.uri);
|
this._blame = this.git.getBlameForFile(this.uri);
|
||||||
|
|
||||||
this._config = workspace.getConfiguration('gitlens').get<IBlameConfig>('blame');
|
this._config = workspace.getConfiguration(ExtensionKey).get<IBlameConfig>('blame');
|
||||||
|
|
||||||
const subscriptions: Disposable[] = [];
|
const subscriptions: Disposable[] = [];
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { commands, Disposable, QuickPickItem } from 'vscode';
|
import { commands, Disposable, QuickPickItem } from 'vscode';
|
||||||
import { CommandContext, setCommandContext } from './common';
|
import { CommandContext, setCommandContext } from './common';
|
||||||
|
import { ExtensionKey } from '../constants';
|
||||||
import { CommandQuickPickItem, OpenFileCommandQuickPickItem } from '../quickPicks';
|
import { CommandQuickPickItem, OpenFileCommandQuickPickItem } from '../quickPicks';
|
||||||
import { Logger } from '../logger';
|
import { Logger } from '../logger';
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ export class Keyboard extends Disposable {
|
|||||||
const subscriptions: Disposable[] = [];
|
const subscriptions: Disposable[] = [];
|
||||||
|
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
subscriptions.push(commands.registerCommand(`gitlens.key.${key}`, () => this.execute(key), this));
|
subscriptions.push(commands.registerCommand(`${ExtensionKey}.key.${key}`, () => this.execute(key), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
this._disposable = Disposable.from(...subscriptions);
|
this._disposable = Disposable.from(...subscriptions);
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
export const RepoPath = 'repoPath';
|
export const ExtensionId = 'gitlens';
|
||||||
|
export const ExtensionKey = ExtensionId;
|
||||||
|
export const QualifiedExtensionId = `eamodio.${ExtensionId}`;
|
||||||
|
|
||||||
|
export const ApplicationInsightsKey = 'a9c302f8-6483-4d01-b92c-c159c799c679';
|
||||||
|
|
||||||
export type BuiltInCommands = 'cursorMove' | 'editor.action.showReferences' | 'editor.action.toggleRenderWhitespace' | 'editorScroll' | 'revealLine' | 'setContext' | 'vscode.diff' | 'vscode.executeDocumentSymbolProvider' | 'vscode.executeCodeLensProvider' | 'vscode.open' | 'vscode.previewHtml' | 'workbench.action.closeActiveEditor' | 'workbench.action.nextEditor';
|
export type BuiltInCommands = 'cursorMove' | 'editor.action.showReferences' | 'editor.action.toggleRenderWhitespace' | 'editorScroll' | 'revealLine' | 'setContext' | 'vscode.diff' | 'vscode.executeDocumentSymbolProvider' | 'vscode.executeCodeLensProvider' | 'vscode.open' | 'vscode.previewHtml' | 'workbench.action.closeActiveEditor' | 'workbench.action.nextEditor';
|
||||||
export const BuiltInCommands = {
|
export const BuiltInCommands = {
|
||||||
@@ -32,6 +36,3 @@ export const WorkspaceState = {
|
|||||||
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState,
|
SuppressGitVersionWarning: 'suppressGitVersionWarning' as WorkspaceState,
|
||||||
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState
|
SuppressUpdateNotice: 'suppressUpdateNotice' as WorkspaceState
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ExtensionId = 'eamodio.gitlens';
|
|
||||||
export const ApplicationInsightsKey = 'a9c302f8-6483-4d01-b92c-c159c799c679';
|
|
||||||
@@ -18,7 +18,7 @@ import { StashApplyCommand, StashDeleteCommand, StashSaveCommand } from './comma
|
|||||||
import { ToggleCodeLensCommand } from './commands';
|
import { ToggleCodeLensCommand } from './commands';
|
||||||
import { Keyboard } from './commands';
|
import { Keyboard } from './commands';
|
||||||
import { IConfig } from './configuration';
|
import { IConfig } from './configuration';
|
||||||
import { ApplicationInsightsKey, BuiltInCommands, ExtensionId, WorkspaceState } from './constants';
|
import { ApplicationInsightsKey, BuiltInCommands, ExtensionKey, QualifiedExtensionId, WorkspaceState } from './constants';
|
||||||
import { GitContentProvider } from './gitContentProvider';
|
import { GitContentProvider } from './gitContentProvider';
|
||||||
import { GitContextTracker, GitService } from './gitService';
|
import { GitContextTracker, GitService } from './gitService';
|
||||||
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
|
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
|
||||||
@@ -30,13 +30,13 @@ export async function activate(context: ExtensionContext) {
|
|||||||
Logger.configure(context);
|
Logger.configure(context);
|
||||||
Telemetry.configure(ApplicationInsightsKey);
|
Telemetry.configure(ApplicationInsightsKey);
|
||||||
|
|
||||||
const gitlens = extensions.getExtension(ExtensionId);
|
const gitlens = extensions.getExtension(QualifiedExtensionId);
|
||||||
const gitlensVersion = gitlens.packageJSON.version;
|
const gitlensVersion = gitlens.packageJSON.version;
|
||||||
|
|
||||||
const rootPath = workspace.rootPath && workspace.rootPath.replace(/\\/g, '/');
|
const rootPath = workspace.rootPath && workspace.rootPath.replace(/\\/g, '/');
|
||||||
Logger.log(`GitLens(v${gitlensVersion}) active: ${rootPath}`);
|
Logger.log(`GitLens(v${gitlensVersion}) active: ${rootPath}`);
|
||||||
|
|
||||||
const config = workspace.getConfiguration('').get<IConfig>('gitlens');
|
const config = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||||
const gitPath = config.advanced.git;
|
const gitPath = config.advanced.git;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { Functions, Iterables, Strings } from './system';
|
import { Functions, Iterables, Strings } from './system';
|
||||||
import { CancellationToken, CodeLens, CodeLensProvider, commands, DocumentSelector, Event, EventEmitter, ExtensionContext, Position, Range, SymbolInformation, SymbolKind, TextDocument, Uri, workspace } from 'vscode';
|
import { CancellationToken, CodeLens, CodeLensProvider, commands, DocumentSelector, Event, EventEmitter, ExtensionContext, Position, Range, SymbolInformation, SymbolKind, TextDocument, Uri, workspace } from 'vscode';
|
||||||
import { Commands } from './commands';
|
import { Commands } from './commands';
|
||||||
import { BuiltInCommands, DocumentSchemes } from './constants';
|
import { BuiltInCommands, DocumentSchemes, ExtensionKey } from './constants';
|
||||||
import { CodeLensCommand, CodeLensLocation, IConfig, ICodeLensLanguageLocation } from './configuration';
|
import { CodeLensCommand, CodeLensLocation, IConfig, ICodeLensLanguageLocation } from './configuration';
|
||||||
import { GitCommit, GitService, GitUri, IGitBlame, IGitBlameLines } from './gitService';
|
import { GitCommit, GitService, GitUri, IGitBlame, IGitBlameLines } from './gitService';
|
||||||
import { Logger } from './logger';
|
import { Logger } from './logger';
|
||||||
@@ -43,11 +43,11 @@ export class GitCodeLensProvider implements CodeLensProvider {
|
|||||||
private _documentIsDirty: boolean;
|
private _documentIsDirty: boolean;
|
||||||
|
|
||||||
constructor(context: ExtensionContext, private git: GitService) {
|
constructor(context: ExtensionContext, private git: GitService) {
|
||||||
this._config = workspace.getConfiguration('').get<IConfig>('gitlens');
|
this._config = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this._config = workspace.getConfiguration('').get<IConfig>('gitlens');
|
this._config = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||||
|
|
||||||
Logger.log('Triggering a reset of the git CodeLens provider');
|
Logger.log('Triggering a reset of the git CodeLens provider');
|
||||||
this._onDidChangeCodeLenses.fire();
|
this._onDidChangeCodeLenses.fire();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Iterables, Objects } from './system';
|
|||||||
import { Disposable, Event, EventEmitter, ExtensionContext, FileSystemWatcher, languages, Location, Position, Range, TextDocument, TextEditor, Uri, workspace } from 'vscode';
|
import { Disposable, Event, EventEmitter, ExtensionContext, FileSystemWatcher, languages, Location, Position, Range, TextDocument, TextEditor, Uri, workspace } from 'vscode';
|
||||||
import { CommandContext, setCommandContext } from './commands';
|
import { CommandContext, setCommandContext } from './commands';
|
||||||
import { CodeLensVisibility, IConfig } from './configuration';
|
import { CodeLensVisibility, IConfig } from './configuration';
|
||||||
import { DocumentSchemes } from './constants';
|
import { DocumentSchemes, ExtensionKey } from './constants';
|
||||||
import { Git, GitBlameParser, GitBranch, GitCommit, GitLogCommit, GitLogParser, GitRemote, GitStashParser, GitStatusFile, GitStatusParser, IGit, IGitAuthor, IGitBlame, IGitBlameLine, IGitBlameLines, IGitLog, IGitStash, IGitStatus } from './git/git';
|
import { Git, GitBlameParser, GitBranch, GitCommit, GitLogCommit, GitLogParser, GitRemote, GitStashParser, GitStatusFile, GitStatusParser, IGit, IGitAuthor, IGitBlame, IGitBlameLine, IGitBlameLines, IGitLog, IGitStash, IGitStatus } from './git/git';
|
||||||
import { IGitUriData, GitUri } from './git/gitUri';
|
import { IGitUriData, GitUri } from './git/gitUri';
|
||||||
import { GitCodeLensProvider } from './gitCodeLensProvider';
|
import { GitCodeLensProvider } from './gitCodeLensProvider';
|
||||||
@@ -123,7 +123,7 @@ export class GitService extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _onConfigurationChanged() {
|
private _onConfigurationChanged() {
|
||||||
const config = workspace.getConfiguration().get<IConfig>('gitlens');
|
const config = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||||
|
|
||||||
const codeLensChanged = !Objects.areEquivalent(config.codeLens, this.config && this.config.codeLens);
|
const codeLensChanged = !Objects.areEquivalent(config.codeLens, this.config && this.config.codeLens);
|
||||||
const advancedChanged = !Objects.areEquivalent(config.advanced, this.config && this.config.advanced);
|
const advancedChanged = !Objects.areEquivalent(config.advanced, this.config && this.config.advanced);
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { ExtensionContext, OutputChannel, window, workspace } from 'vscode';
|
import { ExtensionContext, OutputChannel, window, workspace } from 'vscode';
|
||||||
import { IAdvancedConfig } from './configuration';
|
import { IAdvancedConfig } from './configuration';
|
||||||
|
import { ExtensionKey } from './constants';
|
||||||
import { Telemetry } from './telemetry';
|
import { Telemetry } from './telemetry';
|
||||||
|
|
||||||
const ConfigurationName = 'gitlens';
|
|
||||||
const OutputChannelName = 'GitLens';
|
const OutputChannelName = 'GitLens';
|
||||||
const ConsolePrefix = `[${OutputChannelName}]`;
|
const ConsolePrefix = `[${OutputChannelName}]`;
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ let level: OutputLevel = OutputLevel.Silent;
|
|||||||
let output: OutputChannel;
|
let output: OutputChannel;
|
||||||
|
|
||||||
function onConfigurationChanged() {
|
function onConfigurationChanged() {
|
||||||
const cfg = workspace.getConfiguration(ConfigurationName).get<IAdvancedConfig>('advanced');
|
const cfg = workspace.getConfiguration(ExtensionKey).get<IAdvancedConfig>('advanced');
|
||||||
|
|
||||||
if (cfg.debug !== debug || cfg.output.level !== level) {
|
if (cfg.debug !== debug || cfg.output.level !== level) {
|
||||||
debug = cfg.debug;
|
debug = cfg.debug;
|
||||||
@@ -53,11 +53,11 @@ export class Logger {
|
|||||||
|
|
||||||
static error(ex: Error, classOrMethod?: string, ...params: any[]): void {
|
static error(ex: Error, classOrMethod?: string, ...params: any[]): void {
|
||||||
if (debug) {
|
if (debug) {
|
||||||
console.error(ConsolePrefix, ex, ...params, '\n');
|
console.error(ConsolePrefix, classOrMethod, ex, ...params, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (level !== OutputLevel.Silent) {
|
if (level !== OutputLevel.Silent) {
|
||||||
output.appendLine([ex, ...params].join(' '));
|
output.appendLine([classOrMethod, ex, ...params].join(' '));
|
||||||
}
|
}
|
||||||
|
|
||||||
Telemetry.trackException(ex);
|
Telemetry.trackException(ex);
|
||||||
|
|||||||
@@ -2,12 +2,13 @@
|
|||||||
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, Uri, window, workspace } from 'vscode';
|
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, Uri, window, workspace } from 'vscode';
|
||||||
import { Commands, Keyboard, KeyboardScope, KeyMapping, openEditor } from '../commands';
|
import { Commands, Keyboard, KeyboardScope, KeyMapping, openEditor } from '../commands';
|
||||||
import { IAdvancedConfig } from '../configuration';
|
import { IAdvancedConfig } from '../configuration';
|
||||||
|
import { ExtensionKey } from '../constants';
|
||||||
import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService';
|
import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService';
|
||||||
// import { Logger } from '../logger';
|
// import { Logger } from '../logger';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
|
|
||||||
export function getQuickPickIgnoreFocusOut() {
|
export function getQuickPickIgnoreFocusOut() {
|
||||||
return !workspace.getConfiguration('gitlens').get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
|
return !workspace.getConfiguration(ExtensionKey).get<IAdvancedConfig>('advanced').quickPick.closeOnFocusOut;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showQuickPickProgress(message: string, mapping?: KeyMapping, delay: boolean = false): CancellationTokenSource {
|
export function showQuickPickProgress(message: string, mapping?: KeyMapping, delay: boolean = false): CancellationTokenSource {
|
||||||
|
|||||||
Reference in New Issue
Block a user