Log the full version string for TS

Right now, if TS has an error before we get back the full version string in the TSServer `'telemetry'` event, we end up logging just the basic version info (such as 3.8.0). We also want to include the pre-release tags (3.8.0-tsversion20200101)
This commit is contained in:
Matt Bierner 2020-01-17 14:48:22 -08:00
parent 4a5890eabc
commit 5359a9373a
2 changed files with 17 additions and 5 deletions

View file

@ -182,7 +182,7 @@ export default class TypeScriptServiceClient extends Disposable implements IType
return this.serverState.tsserverVersion;
}
}
return this.apiVersion.version;
return this.apiVersion.fullVersionString;
}));
this.typescriptServerSpawner = new TypeScriptServerSpawner(this.versionProvider, this.logDirectoryProvider, this.pluginPathsProvider, this.logger, this.telemetryReporter, this.tracer);

View file

@ -10,7 +10,7 @@ const localize = nls.loadMessageBundle();
export default class API {
private static fromSimpleString(value: string): API {
return new API(value, value);
return new API(value, value, value);
}
public static readonly defaultVersion = API.fromSimpleString('1.0.0');
@ -36,7 +36,7 @@ export default class API {
public static fromVersionString(versionString: string): API {
let version = semver.valid(versionString);
if (!version) {
return new API(localize('invalidVersion', 'invalid version'), '1.0.0');
return new API(localize('invalidVersion', 'invalid version'), '1.0.0', '1.0.0');
}
// Cut off any prerelease tag since we sometimes consume those on purpose.
@ -44,12 +44,24 @@ export default class API {
if (index >= 0) {
version = version.substr(0, index);
}
return new API(versionString, version);
return new API(versionString, version, versionString);
}
private constructor(
/**
* Human readable string for the current version. Displayed in the UI
*/
public readonly displayName: string,
public readonly version: string
/**
* Semver version, e.g. '3.9.0'
*/
public readonly version: string,
/**
* Full version string including pre-release tags, e.g. '3.9.0-beta'
*/
public readonly fullVersionString: string,
) { }
public gte(other: API): boolean {