File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import * as vscode from "vscode"
2- import { EXTENSION_ID } from "../extension"
2+ import { getExtensionVersion } from "../extension"
33import { AUTH_PROVIDER_ID } from "./auth"
44import type { App , Deployment , ListResponse , Team } from "./types"
55
@@ -8,13 +8,6 @@ export interface UploadInfo {
88 fields : Record < string , string >
99}
1010
11- function getExtensionVersion ( ) : string {
12- return (
13- vscode . extensions . getExtension ( EXTENSION_ID ) ?. packageJSON ?. version ??
14- "unknown"
15- )
16- }
17-
1811function getUserAgentHeaders ( ) : Record < string , string > {
1912 // User-Agent is a forbidden header in browsers and causes fetch to fail
2013 if ( vscode . env . uiKind === vscode . UIKind . Web ) return { }
Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ import {
3939
4040export const EXTENSION_ID = "FastAPILabs.fastapi-vscode"
4141
42+ export function getExtensionVersion ( ) : string {
43+ return (
44+ vscode . extensions . getExtension ( EXTENSION_ID ) ?. packageJSON ?. version ??
45+ "unknown"
46+ )
47+ }
48+
4249let parserService : Parser | null = null
4350
4451function navigateToLocation ( location : SourceLocation ) : void {
@@ -51,9 +58,7 @@ function navigateToLocation(location: SourceLocation): void {
5158
5259export async function activate ( context : vscode . ExtensionContext ) {
5360 const elapsed = createTimer ( )
54- const extensionVersion =
55- vscode . extensions . getExtension ( EXTENSION_ID ) ?. packageJSON ?. version ??
56- "unknown"
61+ const extensionVersion = getExtensionVersion ( )
5762 log (
5863 `FastAPI extension ${ extensionVersion } activated (VS Code ${ vscode . version } )` ,
5964 )
Original file line number Diff line number Diff line change 44 */
55
66import * as vscode from "vscode"
7- import { EXTENSION_ID } from "../../extension"
7+ import { getExtensionVersion } from "../../extension"
88import { client } from "./client"
99import type { ClientInfo } from "./types"
1010
@@ -88,9 +88,7 @@ export async function initVSCodeTelemetry(
8888 }
8989
9090 const userId = await getOrCreateUserId ( context )
91- const extensionVersion =
92- vscode . extensions . getExtension ( EXTENSION_ID ) ?. packageJSON ?. version ??
93- "unknown"
91+ const extensionVersion = getExtensionVersion ( )
9492
9593 await client . init ( {
9694 userId,
You can’t perform that action at this time.
0 commit comments