diff --git a/tools/vscode-ext/package-lock.json b/tools/vscode-ext/package-lock.json index c91c452..29e7a1d 100644 --- a/tools/vscode-ext/package-lock.json +++ b/tools/vscode-ext/package-lock.json @@ -1,6 +1,6 @@ { "name": "goc", - "version": "0.0.3", + "version": "0.0.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -996,6 +996,11 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, + "upath": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/upath/-/upath-1.2.0.tgz", + "integrity": "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg==" + }, "vscode-test": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-1.4.0.tgz", diff --git a/tools/vscode-ext/package.json b/tools/vscode-ext/package.json index 1aae77d..6c1a53a 100644 --- a/tools/vscode-ext/package.json +++ b/tools/vscode-ext/package.json @@ -2,7 +2,7 @@ "name": "goc", "displayName": "Goc Coverage", "description": "Goc Coverage can display coverage vairation in real time. Goc is a comprehensive coverage testing system for The Go Programming Language, especially for some complex scenarios, like system testing code coverage collection and accurate testing.", - "version": "0.0.4", + "version": "0.0.5", "publisher": "lyyyuna", "repository": { "url": "https://github.com/qiniu/goc" @@ -61,6 +61,7 @@ }, "dependencies": { "axios": "^0.19.2", - "log4js": "^6.3.0" + "log4js": "^6.3.0", + "upath": "^1.2.0" } } diff --git a/tools/vscode-ext/src/gocserver.ts b/tools/vscode-ext/src/gocserver.ts index 39dfe32..19fa583 100644 --- a/tools/vscode-ext/src/gocserver.ts +++ b/tools/vscode-ext/src/gocserver.ts @@ -5,6 +5,7 @@ import { spawnSync } from 'child_process'; import * as path from 'path'; import { promisify } from 'util'; import * as log4js from 'log4js'; +import * as upath from 'upath'; const sleep = promisify(setTimeout); export class GocServer { @@ -100,7 +101,7 @@ export class GocServer { this._logger.error("no workspace found"); return []; } else { - cwd = workspaces[0].uri.path; + cwd = workspaces[0].uri.fsPath; } this._logger.debug('current project root directory: ', cwd); let opts = { @@ -160,6 +161,9 @@ export class GocServer { let importPath: string = line.split(':')[0]; let blockInfo: string = line.split(':')[1]; + // on windows the path is different from posix + // needs transform + importPathNeedsRender = upath.toUnix(importPathNeedsRender) if (importPath != importPathNeedsRender) { continue; }