mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-14 01:25:43 -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 { TextEditorComparer } from './comparers';
|
||||
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 * as moment from 'moment';
|
||||
|
||||
@@ -54,7 +54,7 @@ export class BlameActiveLineController extends Disposable {
|
||||
}
|
||||
|
||||
private _onConfigurationChanged() {
|
||||
const config = workspace.getConfiguration('').get<IConfig>('gitlens');
|
||||
const config = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||
|
||||
let changed: boolean = false;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { DecorationRenderOptions, Disposable, Event, EventEmitter, ExtensionCont
|
||||
import { BlameAnnotationProvider } from './blameAnnotationProvider';
|
||||
import { TextDocumentComparer, TextEditorComparer } from './comparers';
|
||||
import { IBlameConfig } from './configuration';
|
||||
import { ExtensionKey } from './constants';
|
||||
import { BlameabilityChangeEvent, GitService, GitUri, GitContextTracker } from './gitService';
|
||||
import { Logger } from './logger';
|
||||
import { WhitespaceController } from './whitespaceController';
|
||||
@@ -57,7 +58,7 @@ export class BlameAnnotationController extends Disposable {
|
||||
}
|
||||
|
||||
private _onConfigurationChanged() {
|
||||
let toggleWhitespace = workspace.getConfiguration('gitlens.advanced.toggleWhitespace').get<boolean>('enabled');
|
||||
let toggleWhitespace = workspace.getConfiguration(`${ExtensionKey}.advanced.toggleWhitespace`).get<boolean>('enabled');
|
||||
if (!toggleWhitespace) {
|
||||
// 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
|
||||
@@ -72,7 +73,7 @@ export class BlameAnnotationController extends Disposable {
|
||||
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)) {
|
||||
BlameDecorations.highlight && BlameDecorations.highlight.dispose();
|
||||
|
||||
@@ -5,6 +5,7 @@ import { BlameAnnotationFormat, BlameAnnotationFormatter, defaultAuthorLength }
|
||||
import { BlameDecorations } from './blameAnnotationController';
|
||||
import { TextDocumentComparer } from './comparers';
|
||||
import { BlameAnnotationStyle, IBlameConfig } from './configuration';
|
||||
import { ExtensionKey } from './constants';
|
||||
import { GitService, GitUri, IGitBlame } from './gitService';
|
||||
import { WhitespaceController } from './whitespaceController';
|
||||
|
||||
@@ -23,7 +24,7 @@ export class BlameAnnotationProvider extends Disposable {
|
||||
|
||||
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[] = [];
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
import { commands, Disposable, QuickPickItem } from 'vscode';
|
||||
import { CommandContext, setCommandContext } from './common';
|
||||
import { ExtensionKey } from '../constants';
|
||||
import { CommandQuickPickItem, OpenFileCommandQuickPickItem } from '../quickPicks';
|
||||
import { Logger } from '../logger';
|
||||
|
||||
@@ -95,7 +96,7 @@ export class Keyboard extends Disposable {
|
||||
const subscriptions: Disposable[] = [];
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
'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 const BuiltInCommands = {
|
||||
@@ -31,7 +35,4 @@ export const WorkspaceState = {
|
||||
GitLensVersion: 'gitlensVersion' as WorkspaceState,
|
||||
SuppressGitVersionWarning: 'suppressGitVersionWarning' 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 { Keyboard } from './commands';
|
||||
import { IConfig } from './configuration';
|
||||
import { ApplicationInsightsKey, BuiltInCommands, ExtensionId, WorkspaceState } from './constants';
|
||||
import { ApplicationInsightsKey, BuiltInCommands, ExtensionKey, QualifiedExtensionId, WorkspaceState } from './constants';
|
||||
import { GitContentProvider } from './gitContentProvider';
|
||||
import { GitContextTracker, GitService } from './gitService';
|
||||
import { GitRevisionCodeLensProvider } from './gitRevisionCodeLensProvider';
|
||||
@@ -30,13 +30,13 @@ export async function activate(context: ExtensionContext) {
|
||||
Logger.configure(context);
|
||||
Telemetry.configure(ApplicationInsightsKey);
|
||||
|
||||
const gitlens = extensions.getExtension(ExtensionId);
|
||||
const gitlens = extensions.getExtension(QualifiedExtensionId);
|
||||
const gitlensVersion = gitlens.packageJSON.version;
|
||||
|
||||
const rootPath = workspace.rootPath && workspace.rootPath.replace(/\\/g, '/');
|
||||
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;
|
||||
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
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 { Commands } from './commands';
|
||||
import { BuiltInCommands, DocumentSchemes } from './constants';
|
||||
import { BuiltInCommands, DocumentSchemes, ExtensionKey } from './constants';
|
||||
import { CodeLensCommand, CodeLensLocation, IConfig, ICodeLensLanguageLocation } from './configuration';
|
||||
import { GitCommit, GitService, GitUri, IGitBlame, IGitBlameLines } from './gitService';
|
||||
import { Logger } from './logger';
|
||||
@@ -43,11 +43,11 @@ export class GitCodeLensProvider implements CodeLensProvider {
|
||||
private _documentIsDirty: boolean;
|
||||
|
||||
constructor(context: ExtensionContext, private git: GitService) {
|
||||
this._config = workspace.getConfiguration('').get<IConfig>('gitlens');
|
||||
this._config = workspace.getConfiguration().get<IConfig>(ExtensionKey);
|
||||
}
|
||||
|
||||
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');
|
||||
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 { CommandContext, setCommandContext } from './commands';
|
||||
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 { IGitUriData, GitUri } from './git/gitUri';
|
||||
import { GitCodeLensProvider } from './gitCodeLensProvider';
|
||||
@@ -123,7 +123,7 @@ export class GitService extends Disposable {
|
||||
}
|
||||
|
||||
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 advancedChanged = !Objects.areEquivalent(config.advanced, this.config && this.config.advanced);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
import { ExtensionContext, OutputChannel, window, workspace } from 'vscode';
|
||||
import { IAdvancedConfig } from './configuration';
|
||||
import { ExtensionKey } from './constants';
|
||||
import { Telemetry } from './telemetry';
|
||||
|
||||
const ConfigurationName = 'gitlens';
|
||||
const OutputChannelName = 'GitLens';
|
||||
const ConsolePrefix = `[${OutputChannelName}]`;
|
||||
|
||||
@@ -19,7 +19,7 @@ let level: OutputLevel = OutputLevel.Silent;
|
||||
let output: OutputChannel;
|
||||
|
||||
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) {
|
||||
debug = cfg.debug;
|
||||
@@ -53,11 +53,11 @@ export class Logger {
|
||||
|
||||
static error(ex: Error, classOrMethod?: string, ...params: any[]): void {
|
||||
if (debug) {
|
||||
console.error(ConsolePrefix, ex, ...params, '\n');
|
||||
console.error(ConsolePrefix, classOrMethod, ex, ...params, '\n');
|
||||
}
|
||||
|
||||
if (level !== OutputLevel.Silent) {
|
||||
output.appendLine([ex, ...params].join(' '));
|
||||
output.appendLine([classOrMethod, ex, ...params].join(' '));
|
||||
}
|
||||
|
||||
Telemetry.trackException(ex);
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
import { CancellationTokenSource, commands, Disposable, QuickPickItem, QuickPickOptions, Uri, window, workspace } from 'vscode';
|
||||
import { Commands, Keyboard, KeyboardScope, KeyMapping, openEditor } from '../commands';
|
||||
import { IAdvancedConfig } from '../configuration';
|
||||
import { ExtensionKey } from '../constants';
|
||||
import { GitCommit, GitLogCommit, GitStashCommit } from '../gitService';
|
||||
// import { Logger } from '../logger';
|
||||
import * as moment from 'moment';
|
||||
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user