mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-13 03:28:35 -05:00
Compare commits
14 Commits
v4.0.0-bet
...
v4.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
068b34b781 | ||
|
|
5328e56230 | ||
|
|
0fb718804e | ||
|
|
516bcf7eef | ||
|
|
f9bbc9af0a | ||
|
|
9cc96d4041 | ||
|
|
41785f6872 | ||
|
|
f72ea0005c | ||
|
|
b3f0d19e48 | ||
|
|
60702ff314 | ||
|
|
b72d22032c | ||
|
|
6b9fc3f9d2 | ||
|
|
5af70fd2bf | ||
|
|
cecd3524b8 |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
|
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
## [4.0.0-beta.2] - 2017-06-07
|
## [4.0.0-beta] - 2017-06-06
|
||||||
### Added
|
### Added
|
||||||
- Adds all-new, beautiful, highly customizable and themeable, file blame annotations
|
- Adds all-new, beautiful, highly customizable and themeable, file blame annotations
|
||||||
- Can now fully customize the [layout and content](https://github.com/eamodio/vscode-gitlens/blob/develop/README.md#file-blame-annotation-settings), as well as the [theme](https://github.com/eamodio/vscode-gitlens/blob/develop/README.md#theme-settings)
|
- Can now fully customize the [layout and content](https://github.com/eamodio/vscode-gitlens/blob/develop/README.md#file-blame-annotation-settings), as well as the [theme](https://github.com/eamodio/vscode-gitlens/blob/develop/README.md#theme-settings)
|
||||||
@@ -21,9 +21,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
- Adds `Show File Blame Annotations` command (`gitlens.showFileBlame`) - shows the file blame annotations
|
- Adds `Show File Blame Annotations` command (`gitlens.showFileBlame`) - shows the file blame annotations
|
||||||
- Adds `Open File in Remote` command (`gitlens.openFileInRemote`) to the `editor/title` context menu
|
- Adds `Open File in Remote` command (`gitlens.openFileInRemote`) to the `editor/title` context menu
|
||||||
- Adds `Open Repo in Remote` command (`gitlens.openRepoInRemote`) to the `editor/title` context menu
|
- Adds `Open Repo in Remote` command (`gitlens.openRepoInRemote`) to the `editor/title` context menu
|
||||||
- Adds `gitlens.strings.*` settings to allow for the customization of certain strings displayed
|
|
||||||
- Adds `gitlens.theme.*` settings to allow for the theming of certain elements
|
|
||||||
- Adds `gitlens.advanced.telemetry.enabled` settings to explicitly opt-in or out of telemetry, but still ultimately honors the `telemetry.enableTelemetry` setting
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- (BREAKING) Almost all of the GitLens settings have either been renamed, removed, or otherwise changed - see the [README](https://github.com/eamodio/vscode-gitlens/blob/develop/README.md#extension-settings)`
|
- (BREAKING) Almost all of the GitLens settings have either been renamed, removed, or otherwise changed - see the [README](https://github.com/eamodio/vscode-gitlens/blob/develop/README.md#extension-settings)`
|
||||||
@@ -38,11 +35,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixes [#81](https://github.com/eamodio/vscode-gitlens/issues/81) - Current line annotation feels too sticky
|
- Fixes [#81](https://github.com/eamodio/vscode-gitlens/issues/81) - Current line annotation feels too sticky
|
||||||
- Fixes issues with the zone.js monkey patching done by application insights (telemetry) - disables all the monkey patching
|
|
||||||
|
|
||||||
## [3.6.1] - 2017-06-07
|
|
||||||
### Fixed
|
|
||||||
- Fixes issues with the zone.js monkey patching done by application insights (telemetry) - disables all the monkey patching
|
|
||||||
|
|
||||||
## [3.6.0] - 2017-06-02
|
## [3.6.0] - 2017-06-02
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -271,14 +271,6 @@ GitLens is highly customizable and provides many configuration settings to allow
|
|||||||
|`gitlens.statusBar.format`|Specifies the format of the blame information on the status bar<br />Available tokens<br />`${id}` - commit id<br />`${author}` - commit author<br />`${message}` - commit message<br />`${ago}` - relative commit date (e.g. 1 day ago)<br />`${date}` - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
|
|`gitlens.statusBar.format`|Specifies the format of the blame information on the status bar<br />Available tokens<br />`${id}` - commit id<br />`${author}` - commit author<br />`${message}` - commit message<br />`${ago}` - relative commit date (e.g. 1 day ago)<br />`${date}` - formatted commit date (format specified by `gitlens.statusBar.dateFormat`)<br />See https://github.com/eamodio/vscode-gitlens/wiki/Advanced-Formatting for advanced formatting
|
||||||
|`gitlens.statusBar.dateFormat`|Specifies the date format of absolute dates shown in the blame information on the status bar<br />See https://momentjs.com/docs/#/displaying/format/ for valid formats
|
|`gitlens.statusBar.dateFormat`|Specifies the date format of absolute dates shown in the blame information on the status bar<br />See https://momentjs.com/docs/#/displaying/format/ for valid formats
|
||||||
|
|
||||||
### Strings Settings
|
|
||||||
|
|
||||||
|Name | Description
|
|
||||||
|-----|------------
|
|
||||||
|`gitlens.strings.codeLens.unsavedChanges.recentChangeAndAuthors`|Specifies the string to be shown in place of both the `recent change` and `authors` code lens when there are unsaved changes
|
|
||||||
|`gitlens.strings.codeLens.unsavedChanges.recentChangeOnly`|Specifies the string to be shown in place of the `recent change` code lens when there are unsaved changes
|
|
||||||
|`gitlens.strings.codeLens.unsavedChanges.authorsOnly`|Specifies the string to be shown in place of the `authors` code lens when there are unsaved changes
|
|
||||||
|
|
||||||
### Theme Settings
|
### Theme Settings
|
||||||
|
|
||||||
|Name | Description
|
|Name | Description
|
||||||
@@ -305,7 +297,6 @@ GitLens is highly customizable and provides many configuration settings to allow
|
|||||||
|Name | Description
|
|Name | Description
|
||||||
|-----|------------
|
|-----|------------
|
||||||
|`gitlens.advanced.toggleWhitespace.enabled`|Specifies whether or not to toggle whitespace off then showing blame annotations (*may* be required by certain fonts/themes)
|
|`gitlens.advanced.toggleWhitespace.enabled`|Specifies whether or not to toggle whitespace off then showing blame annotations (*may* be required by certain fonts/themes)
|
||||||
|`gitlens.advanced.telemetry.enabled`|Specifies whether or not to enable GitLens telemetry (even if enabled still abides by the overall `telemetry.enableTelemetry` setting
|
|
||||||
|`gitlens.advanced.menus`|Specifies which commands will be added to which menus
|
|`gitlens.advanced.menus`|Specifies which commands will be added to which menus
|
||||||
|`gitlens.advanced.caching.enabled`|Specifies whether git output will be cached
|
|`gitlens.advanced.caching.enabled`|Specifies whether git output will be cached
|
||||||
|`gitlens.advanced.caching.maxLines`|Specifies the threshold for caching larger documents
|
|`gitlens.advanced.caching.maxLines`|Specifies the threshold for caching larger documents
|
||||||
|
|||||||
8
package-lock.json
generated
8
package-lock.json
generated
@@ -1,8 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlens",
|
"name": "gitlens",
|
||||||
"version": "4.0.0-beta.2",
|
"version": "4.0.0-beta",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@types/applicationinsights": {
|
||||||
|
"version": "0.15.33",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/applicationinsights/-/applicationinsights-0.15.33.tgz",
|
||||||
|
"integrity": "sha1-yohXeRuaxSzlKplCXksJrRfrlwg=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/copy-paste": {
|
"@types/copy-paste": {
|
||||||
"version": "1.1.30",
|
"version": "1.1.30",
|
||||||
"resolved": "https://registry.npmjs.org/@types/copy-paste/-/copy-paste-1.1.30.tgz",
|
"resolved": "https://registry.npmjs.org/@types/copy-paste/-/copy-paste-1.1.30.tgz",
|
||||||
|
|||||||
23
package.json
23
package.json
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gitlens",
|
"name": "gitlens",
|
||||||
"version": "4.0.0-beta.2",
|
"version": "4.0.0-beta",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Eric Amodio",
|
"name": "Eric Amodio",
|
||||||
"email": "eamodio@gmail.com"
|
"email": "eamodio@gmail.com"
|
||||||
@@ -408,21 +408,6 @@
|
|||||||
"default": null,
|
"default": null,
|
||||||
"description": "Specifies the date format of absolute dates shown in the blame information on the status bar. See https://momentjs.com/docs/#/displaying/format/ for valid formats"
|
"description": "Specifies the date format of absolute dates shown in the blame information on the status bar. See https://momentjs.com/docs/#/displaying/format/ for valid formats"
|
||||||
},
|
},
|
||||||
"gitlens.strings.codeLens.unsavedChanges.recentChangeAndAuthors": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Cannot determine recent change or authors (unsaved changes)",
|
|
||||||
"description": "Specifies the string to be shown in place of both the `recent change` and `authors` code lens when there are unsaved changes"
|
|
||||||
},
|
|
||||||
"gitlens.strings.codeLens.unsavedChanges.recentChangeOnly": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Cannot determine recent change (unsaved changes)",
|
|
||||||
"description": "Specifies the string to be shown in place of the `recent change` code lens when there are unsaved changes"
|
|
||||||
},
|
|
||||||
"gitlens.strings.codeLens.unsavedChanges.authorsOnly": {
|
|
||||||
"type": "string",
|
|
||||||
"default": "Cannot determine authors (unsaved changes)",
|
|
||||||
"description": "Specifies the string to be shown in place of the `authors` code lens when there are unsaved changes"
|
|
||||||
},
|
|
||||||
"gitlens.theme.annotations.file.gutter.separateLines": {
|
"gitlens.theme.annotations.file.gutter.separateLines": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true,
|
"default": true,
|
||||||
@@ -691,11 +676,6 @@
|
|||||||
"default": true,
|
"default": true,
|
||||||
"description": "Specifies whether or not to close the QuickPick menu when focus is lost"
|
"description": "Specifies whether or not to close the QuickPick menu when focus is lost"
|
||||||
},
|
},
|
||||||
"gitlens.advanced.telemetry.enabled": {
|
|
||||||
"type": "boolean",
|
|
||||||
"default": true,
|
|
||||||
"description": "Specifies whether or not to enable GitLens telemetry (even if enabled still abides by the overall `telemetry.enableTelemetry` setting"
|
|
||||||
},
|
|
||||||
"gitlens.advanced.toggleWhitespace.enabled": {
|
"gitlens.advanced.toggleWhitespace.enabled": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false,
|
"default": false,
|
||||||
@@ -1278,6 +1258,7 @@
|
|||||||
"tmp": "0.0.31"
|
"tmp": "0.0.31"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/applicationinsights": "0.15.33",
|
||||||
"@types/copy-paste": "1.1.30",
|
"@types/copy-paste": "1.1.30",
|
||||||
"@types/iconv-lite": "0.0.1",
|
"@types/iconv-lite": "0.0.1",
|
||||||
"@types/mocha": "2.2.41",
|
"@types/mocha": "2.2.41",
|
||||||
|
|||||||
14
src/@types/applicationinsights/index.d.ts
vendored
14
src/@types/applicationinsights/index.d.ts
vendored
@@ -16,9 +16,9 @@ interface AutoCollectConsole {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface AutoCollectExceptions {
|
interface AutoCollectExceptions {
|
||||||
constructor(client: Client): AutoCollectExceptions;
|
constructor(client:Client): AutoCollectExceptions;
|
||||||
isInitialized(): boolean;
|
isInitialized(): boolean;
|
||||||
enable(isEnabled: boolean): void;
|
enable(isEnabled:boolean): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AutoCollectPerformance {
|
interface AutoCollectPerformance {
|
||||||
@@ -348,7 +348,7 @@ interface Client {
|
|||||||
* @param max the max sample for this set
|
* @param max the max sample for this set
|
||||||
* @param stdDev the standard deviation of the set
|
* @param stdDev the standard deviation of the set
|
||||||
*/
|
*/
|
||||||
trackMetric(name: string, value: number, count?: number, min?: number, max?: number, stdDev?: number, properties?: {
|
trackMetric(name: string, value: number, count?:number, min?: number, max?: number, stdDev?: number, properties?: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}): void;
|
}): void;
|
||||||
|
|
||||||
@@ -374,8 +374,7 @@ interface Client {
|
|||||||
* @param error An error that was returned for this request if it was unsuccessful. Defaults to null.
|
* @param error An error that was returned for this request if it was unsuccessful. Defaults to null.
|
||||||
*/
|
*/
|
||||||
trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
|
trackRequestSync(request: any /*http.IncomingMessage */, response: any /*http.ServerResponse */, ellapsedMilliseconds?: number, properties?: {
|
||||||
[key: string]: string;
|
[key: string]: string;}, error?: any) : void;
|
||||||
}, error?: any): void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
|
* Log information about a dependency of your app. Typically used to track the time database calls or outgoing http requests take from your server.
|
||||||
@@ -504,11 +503,6 @@ interface ApplicationInsights {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
setOfflineMode(value: boolean, resentIntervall?: number): ApplicationInsights;
|
setOfflineMode(value: boolean, resentIntervall?: number): ApplicationInsights;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
setAutoDependencyCorrelation(value: boolean): ApplicationInsights;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module "applicationinsights" {
|
declare module "applicationinsights" {
|
||||||
|
|||||||
@@ -98,9 +98,6 @@ export interface IAdvancedConfig {
|
|||||||
quickPick: {
|
quickPick: {
|
||||||
closeOnFocusOut: boolean;
|
closeOnFocusOut: boolean;
|
||||||
};
|
};
|
||||||
telemetry: {
|
|
||||||
enabled: boolean;
|
|
||||||
};
|
|
||||||
toggleWhitespace: {
|
toggleWhitespace: {
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
};
|
};
|
||||||
@@ -287,16 +284,6 @@ export interface IConfig {
|
|||||||
dateFormat: string;
|
dateFormat: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
strings: {
|
|
||||||
codeLens: {
|
|
||||||
unsavedChanges: {
|
|
||||||
recentChangeAndAuthors: string;
|
|
||||||
recentChangeOnly: string;
|
|
||||||
authorsOnly: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
theme: IThemeConfig;
|
theme: IThemeConfig;
|
||||||
|
|
||||||
debug: boolean;
|
debug: boolean;
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ async function migrateSettings(context: ExtensionContext) {
|
|||||||
Logger.error(ex, 'migrateSettings');
|
Logger.error(ex, 'migrateSettings');
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
window.showInformationMessage(`GitLens v4 adds many new settings and removes a few old ones, so please review your settings to ensure they are configured properly.`);
|
await window.showInformationMessage(`GitLens v4 adds many new settings and removes a few old ones, so please review your settings to ensure they are configured properly.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ export class CommitFormatter {
|
|||||||
options = dateFormatOrOptions;
|
options = dateFormatOrOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Strings.interpolate(template, new CommitFormatter(commit, options));
|
return Strings.interpolateLazy(template, new CommitFormatter(commit, options));
|
||||||
}
|
}
|
||||||
|
|
||||||
static toHoverAnnotation(commit: GitCommit, dateFormat: string = 'MMMM Do, YYYY h:MMa'): string | string[] {
|
static toHoverAnnotation(commit: GitCommit, dateFormat: string = 'MMMM Do, YYYY h:MMa'): string | string[] {
|
||||||
|
|||||||
@@ -237,13 +237,13 @@ export class GitCodeLensProvider implements CodeLensProvider {
|
|||||||
let title: string;
|
let title: string;
|
||||||
if (this._documentIsDirty) {
|
if (this._documentIsDirty) {
|
||||||
if (this._config.codeLens.recentChange.enabled && this._config.codeLens.authors.enabled) {
|
if (this._config.codeLens.recentChange.enabled && this._config.codeLens.authors.enabled) {
|
||||||
title = this._config.strings.codeLens.unsavedChanges.recentChangeAndAuthors;
|
title = 'Cannot determine recent change or authors (unsaved changes)';
|
||||||
}
|
}
|
||||||
else if (this._config.codeLens.recentChange.enabled) {
|
else if (this._config.codeLens.recentChange.enabled) {
|
||||||
title = this._config.strings.codeLens.unsavedChanges.recentChangeOnly;
|
title = 'Cannot determine recent change (unsaved changes)';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
title = this._config.strings.codeLens.unsavedChanges.authorsOnly;
|
title = 'Cannot determine authors (unsaved changes)';
|
||||||
}
|
}
|
||||||
|
|
||||||
lens.command = { title: title } as Command;
|
lens.command = { title: title } as Command;
|
||||||
@@ -256,7 +256,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
|
|||||||
const recentCommit = Iterables.first(blame.commits.values());
|
const recentCommit = Iterables.first(blame.commits.values());
|
||||||
title = `${recentCommit.author}, ${moment(recentCommit.date).fromNow()}`;
|
title = `${recentCommit.author}, ${moment(recentCommit.date).fromNow()}`;
|
||||||
if (this._config.codeLens.debug) {
|
if (this._config.codeLens.debug) {
|
||||||
title += ` [${SymbolKind[lens.symbolKind]}(${lens.range.start.character}-${lens.range.end.character}), Lines (${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1}), Commit (${recentCommit.shortSha})]`;
|
title += ` [${SymbolKind[lens.symbolKind]}(${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1}), Commit (${recentCommit.shortSha})]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this._config.codeLens.recentChange.command) {
|
switch (this._config.codeLens.recentChange.command) {
|
||||||
@@ -279,7 +279,7 @@ export class GitCodeLensProvider implements CodeLensProvider {
|
|||||||
const count = blame.authors.size;
|
const count = blame.authors.size;
|
||||||
let title = `${count} ${count > 1 ? 'authors' : 'author'} (${Iterables.first(blame.authors.values()).name}${count > 1 ? ' and others' : ''})`;
|
let title = `${count} ${count > 1 ? 'authors' : 'author'} (${Iterables.first(blame.authors.values()).name}${count > 1 ? ' and others' : ''})`;
|
||||||
if (this._config.codeLens.debug) {
|
if (this._config.codeLens.debug) {
|
||||||
title += ` [${SymbolKind[lens.symbolKind]}(${lens.range.start.character}-${lens.range.end.character}), Lines (${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1}), Authors (${Iterables.join(Iterables.map(blame.authors.values(), _ => _.name), ', ')})]`;
|
title += ` [${SymbolKind[lens.symbolKind]}(${lens.blameRange.start.line + 1}-${lens.blameRange.end.line + 1}), Authors (${Iterables.join(Iterables.map(blame.authors.values(), _ => _.name), ', ')})]`;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this._config.codeLens.authors.command) {
|
switch (this._config.codeLens.authors.command) {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
import { Objects } from './object';
|
||||||
const _escapeRegExp = require('lodash.escaperegexp');
|
const _escapeRegExp = require('lodash.escaperegexp');
|
||||||
|
|
||||||
export namespace Strings {
|
export namespace Strings {
|
||||||
@@ -36,11 +37,13 @@ export namespace Strings {
|
|||||||
return tokens;
|
return tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function interpolate(template: string, context: object): string {
|
export function interpolate(template: string, tokens: { [key: string]: any }): string {
|
||||||
if (!template) return template;
|
return new Function(...Object.keys(tokens), `return \`${template}\`;`)(...Objects.values(tokens));
|
||||||
|
}
|
||||||
|
|
||||||
template = template.replace(TokenSanitizeRegex, '$${this.$1}');
|
export function interpolateLazy(template: string, context: object): string {
|
||||||
return new Function(`return \`${template}\`;`).call(context);
|
template = template.replace(TokenSanitizeRegex, '$${c.$1}');
|
||||||
|
return new Function('c', `return \`${template}\`;`)(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function padLeft(s: string, padTo: number, padding: string = '\u00a0') {
|
export function padLeft(s: string, padTo: number, padding: string = '\u00a0') {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
import { Disposable, env, version, workspace } from 'vscode';
|
import { Disposable, env, version, workspace } from 'vscode';
|
||||||
import { ExtensionKey, IConfig } from './configuration';
|
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
|
|
||||||
let _reporter: TelemetryReporter;
|
let _reporter: TelemetryReporter;
|
||||||
@@ -8,28 +7,21 @@ let _reporter: TelemetryReporter;
|
|||||||
export class Telemetry extends Disposable {
|
export class Telemetry extends Disposable {
|
||||||
|
|
||||||
static configure(key: string) {
|
static configure(key: string) {
|
||||||
const cfg = workspace.getConfiguration().get<IConfig>(ExtensionKey)!;
|
if (!workspace.getConfiguration('telemetry').get<boolean>('enableTelemetry', true)) return;
|
||||||
if (!cfg.advanced.telemetry.enabled || !workspace.getConfiguration('telemetry').get<boolean>('enableTelemetry', true)) return;
|
|
||||||
|
|
||||||
_reporter = new TelemetryReporter(key);
|
_reporter = new TelemetryReporter(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static setContext(context?: { [key: string]: string }) {
|
static setContext(context?: { [key: string]: string }) {
|
||||||
if (_reporter === undefined) return;
|
_reporter && _reporter.setContext(context);
|
||||||
|
|
||||||
_reporter.setContext(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static trackEvent(name: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number; }) {
|
static trackEvent(name: string, properties?: { [key: string]: string }, measurements?: { [key: string]: number; }) {
|
||||||
if (_reporter === undefined) return;
|
_reporter && _reporter.trackEvent(name, properties, measurements);
|
||||||
|
|
||||||
_reporter.trackEvent(name, properties, measurements);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static trackException(ex: Error) {
|
static trackException(ex: Error) {
|
||||||
if (_reporter === undefined) return;
|
_reporter && _reporter.trackException(ex);
|
||||||
|
|
||||||
_reporter.trackException(ex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,12 +44,11 @@ export class TelemetryReporter {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this._client = this.appInsights.setup(key)
|
this._client = this.appInsights.setup(key)
|
||||||
.setAutoCollectRequests(false)
|
|
||||||
.setAutoCollectPerformance(false)
|
|
||||||
.setAutoCollectExceptions(false)
|
|
||||||
.setAutoCollectDependencies(false)
|
|
||||||
.setAutoCollectConsole(false)
|
.setAutoCollectConsole(false)
|
||||||
.setAutoDependencyCorrelation(false)
|
.setAutoCollectDependencies(false)
|
||||||
|
.setAutoCollectExceptions(false)
|
||||||
|
.setAutoCollectPerformance(false)
|
||||||
|
.setAutoCollectRequests(false)
|
||||||
.setOfflineMode(true)
|
.setOfflineMode(true)
|
||||||
.start()
|
.start()
|
||||||
.client;
|
.client;
|
||||||
|
|||||||
Reference in New Issue
Block a user