diff --git a/appveyor.yml b/appveyor.yml index f38d1db..cb7d4f8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ environment: - CODE_VERSION: 1.12.2 + CODE_VERSION: 1.14.0 install: - ps: Install-Product node 6.11.0 x64 diff --git a/images/icon.png b/images/icon.png new file mode 100644 index 0000000..9fef3d9 Binary files /dev/null and b/images/icon.png differ diff --git a/images/icon.svg b/images/icon.svg deleted file mode 100644 index 0b8f7e8..0000000 --- a/images/icon.svg +++ /dev/null @@ -1,103 +0,0 @@ - - - -image/svg+xml \ No newline at end of file diff --git a/package.json b/package.json index 6a6e71d..0f1a874 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "type": "git", "url": "https://github.com/ryanluker/vscode-coverage-gutters" }, - "icon": "images/icon.svg", + "icon": "images/icon.png", "galleryBanner": { "color": "#24381b", "theme": "dark" @@ -16,7 +16,7 @@ "bugs": "https://github.com/ryanluker/vscode-coverage-gutters/issues", "publisher": "ryanluker", "engines": { - "vscode": "^1.11.0" + "vscode": "^1.14.0" }, "categories": [ "Other" diff --git a/src/extension.ts b/src/extension.ts index 96536d3..11e339e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -9,7 +9,6 @@ import {Fs} from "./wrappers/fs"; import {Glob} from "./wrappers/glob"; import {LcovParse} from "./wrappers/lcov-parse"; import {Request} from "./wrappers/request"; -import {Uuid} from "./wrappers/uuid"; import {Vscode} from "./wrappers/vscode"; const fsImpl = new Fs(); @@ -19,7 +18,7 @@ const globImpl = new Glob(); export function activate(context: vscode.ExtensionContext) { const enableMetrics = vscode.workspace.getConfiguration("telemetry").get("enableTelemetry") as boolean; - const reporter = new Reporter(new Request(), new Uuid(), "", enableMetrics); + const reporter = new Reporter(new Request(), vscode.env.machineId, "", enableMetrics); const configStore = new Config(vscodeImpl, context, reporter).get(); const statusBarToggler = new StatusBarToggler(configStore); const lcov = new Lcov(configStore, globImpl, vscodeImpl, fsImpl); diff --git a/src/gutters.ts b/src/gutters.ts index 93d708b..a91d908 100644 --- a/src/gutters.ts +++ b/src/gutters.ts @@ -63,7 +63,10 @@ export class Gutters { const textEditor = window.activeTextEditor; try { const lcovPath = await this.lcov.find(); - await this.loadAndRenderCoverage(textEditor, lcovPath); + + // When we try to load the coverage when watch is actived we dont want to error + // if the active file has no coverage + this.loadAndRenderCoverage(textEditor, lcovPath).catch(() => {}); this.lcovWatcher = vscodeImpl.watchFile(lcovPath); this.lcovWatcher.onDidChange((event) => this.renderCoverageOnVisible(lcovPath)); @@ -124,6 +127,7 @@ export class Gutters { } private async loadAndRenderCoverage(textEditor: TextEditor, lcovPath: string): Promise { + if (!textEditor.document) { return ; } const lcovFile = await this.lcov.load(lcovPath); const file = textEditor.document.fileName; const coveredLines = await this.indicators.extract(lcovFile, file); diff --git a/src/indicators.ts b/src/indicators.ts index f6752b2..9f0aa25 100644 --- a/src/indicators.ts +++ b/src/indicators.ts @@ -42,6 +42,7 @@ export class Indicators { } public extract(lcovFile: string, file: string): Promise { + if (lcovFile === "") { return Promise.reject("No coverage details inside lcov file!"); } return new Promise((resolve, reject) => { this.parse.source(lcovFile, (err, data) => { if (err) { return reject(err); } diff --git a/src/reporter.ts b/src/reporter.ts index 83d7d64..a027772 100644 --- a/src/reporter.ts +++ b/src/reporter.ts @@ -1,8 +1,7 @@ import {Request} from "./wrappers/request"; -import {Uuid} from "./wrappers/uuid"; const EXT_NAME = "vscode-coverage-gutters"; -const EXT_VERSION = "1.0.0"; +const EXT_VERSION = "1.1.0"; export class Reporter { private readonly cid: string; @@ -10,10 +9,10 @@ export class Reporter { private readonly gaTrackingId: string; private readonly request: Request; - constructor(request: Request, uuid: Uuid, gaTrackingId: string, enableMetrics: boolean) { + constructor(request: Request, machineId: string, gaTrackingId: string, enableMetrics: boolean) { this.gaTrackingId = gaTrackingId; this.request = request; - this.cid = uuid.get(); + this.cid = machineId; this.enableMetrics = enableMetrics; } diff --git a/src/wrappers/uuid.ts b/src/wrappers/uuid.ts deleted file mode 100644 index 4c49ee7..0000000 --- a/src/wrappers/uuid.ts +++ /dev/null @@ -1,7 +0,0 @@ -import {v4} from "uuid"; - -export class Uuid { - public get(): string { - return v4(); - } -} diff --git a/test/reporter.test.ts b/test/reporter.test.ts index 8c1fdfa..291f6b9 100644 --- a/test/reporter.test.ts +++ b/test/reporter.test.ts @@ -11,11 +11,7 @@ suite("Reporter Tests", function() { }, }; - const fakeUuid = { - get() { - return "fakeuuidhere"; - }, - }; + const fakeUuid = "fakeuuidhere"; const reporter = new Reporter(fakeRequest, fakeUuid, "", false); reporter.sendEvent("test", "action"); @@ -30,11 +26,7 @@ suite("Reporter Tests", function() { }, }; - const fakeUuid = { - get() { - return "fakeuuidhere"; - }, - }; + const fakeUuid = "fakeuuidhere"; const reporter = new Reporter(fakeRequest, fakeUuid, "", true); reporter.sendEvent("test", "action"); @@ -49,11 +41,7 @@ suite("Reporter Tests", function() { }, }; - const fakeUuid = { - get() { - return "fakeuuidhere"; - }, - }; + const fakeUuid = "fakeuuidhere"; const reporter = new Reporter(fakeRequest, fakeUuid, "", true); reporter.sendEvent("test", "action"); @@ -68,11 +56,7 @@ suite("Reporter Tests", function() { }, }; - const fakeUuid = { - get() { - return "fakeuuidhere"; - }, - }; + const fakeUuid = "fakeuuidhere"; const reporter = new Reporter(fakeRequest, fakeUuid, "123", true); reporter.sendEvent("test", "action");