Skip to content

Commit

Permalink
top module as docs (#10538)
Browse files Browse the repository at this point in the history
* src/commands as typing docs

* telemetryTypes

* telemetry typings as top component and helpers moved into platform

* Update telemetry generator

* Re export is not working with tests.

* fix experiment tests
  • Loading branch information
rebornix authored Jun 22, 2022
1 parent 380e100 commit 5b7e66d
Show file tree
Hide file tree
Showing 60 changed files with 146 additions and 145 deletions.
12 changes: 6 additions & 6 deletions TELEMETRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2736,7 +2736,7 @@ No properties for event

[src/notebooks/telemetry/notebookOrKernelLanguageTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/telemetry/notebookOrKernelLanguageTelemetry.ts)
```typescript
import { getTelemetrySafeLanguage } from '../../telemetry/helpers';
import { getTelemetrySafeLanguage } from '../../platform/telemetry/helpers';

export function sendNotebookOrKernelLanguageTelemetry(
telemetryEvent: Telemetry.SwitchToExistingKernel | Telemetry.NotebookLanguage,
Expand Down Expand Up @@ -8622,7 +8622,7 @@ No description provided

[src/notebooks/telemetry/notebookOrKernelLanguageTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/telemetry/notebookOrKernelLanguageTelemetry.ts)
```typescript
import { getTelemetrySafeLanguage } from '../../telemetry/helpers';
import { getTelemetrySafeLanguage } from '../../platform/telemetry/helpers';

export function sendNotebookOrKernelLanguageTelemetry(
telemetryEvent: Telemetry.SwitchToExistingKernel | Telemetry.NotebookLanguage,
Expand Down Expand Up @@ -9056,7 +9056,7 @@ No properties for event

## Locations Used

[src/telemetry/envFileTelemetry.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/telemetry/envFileTelemetry.node.ts)
[src/platform/telemetry/envFileTelemetry.node.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/platform/telemetry/envFileTelemetry.node.ts)
```typescript
}

Expand Down Expand Up @@ -9086,7 +9086,7 @@ No properties for event

## Locations Used

[src/telemetry/startupTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/telemetry/startupTelemetry.ts)
[src/platform/telemetry/startupTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/platform/telemetry/startupTelemetry.ts)
```typescript
await activatedPromise;
durations.totalActivateTime = stopWatch.elapsedTime;
Expand All @@ -9098,7 +9098,7 @@ No properties for event
```


[src/telemetry/startupTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/telemetry/startupTelemetry.ts)
[src/platform/telemetry/startupTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/platform/telemetry/startupTelemetry.ts)
```typescript
traceError('getActivationTelemetryProps() failed.', ex);
}
Expand All @@ -9110,7 +9110,7 @@ No properties for event
```


[src/telemetry/startupTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/telemetry/startupTelemetry.ts)
[src/platform/telemetry/startupTelemetry.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/platform/telemetry/startupTelemetry.ts)
```typescript

async function getActivationTelemetryProps(
Expand Down
12 changes: 6 additions & 6 deletions src/platform/common/application/commands.ts → src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import {
Uri,
ViewColumn
} from 'vscode';
import { IShowDataViewerFromVariablePanel } from '../../messageTypes';
import { Commands as DSCommands } from '../../../platform/common/constants';
import { PythonEnvironment } from '../../pythonEnvironments/info';
import { CommandSource } from '../../testing/common/constants';
import { Channel } from './types';
import { SelectJupyterUriCommandSource } from '../../../kernels/jupyter/serverSelector';
import { IShowDataViewerFromVariablePanel } from './platform/messageTypes';
import { Commands as DSCommands } from './platform/common/constants';
import { PythonEnvironment } from './platform/pythonEnvironments/info';
import { CommandSource } from './platform/testing/common/constants';
import { Channel } from './platform/common/application/types';
import { SelectJupyterUriCommandSource } from './kernels/jupyter/serverSelector';

export type CommandsWithoutArgs = keyof ICommandNameWithoutArgumentTypeMapping;

Expand Down
8 changes: 4 additions & 4 deletions src/extension.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ import {
import { createDeferred } from './platform/common/utils/async';
import { Common, OutputChannelNames } from './platform/common/utils/localize';
import { IServiceContainer, IServiceManager } from './platform/ioc/types';
import { sendErrorTelemetry, sendStartupTelemetry } from './telemetry/startupTelemetry';
import { sendErrorTelemetry, sendStartupTelemetry } from './platform/telemetry/startupTelemetry';
import { noop } from './platform/common/utils/misc';
import { PythonExtension } from './webviews/webview-side/common/constants';
import { registerTypes as registerPlatformTypes } from './platform/serviceRegistry.node';
import { registerTypes as registerKernelTypes } from './kernels/serviceRegistry.node';
import { registerTypes as registerNotebookTypes } from './notebooks/serviceRegistry.node';
import { registerTypes as registerInteractiveTypes } from './interactive-window/serviceRegistry.node';
import { registerTypes as registerStandaloneTypes } from './standalone/serviceRegistry.node';
import { registerTypes as registerTelemetryTypes } from './telemetry/serviceRegistry.node';
import { registerTypes as registerTelemetryTypes } from './platform/telemetry/serviceRegistry.node';
import { registerTypes as registerIntellisenseTypes } from './intellisense/serviceRegistry.node';
import { registerTypes as registerWebviewTypes } from './webviews/extension-side/serviceRegistry.node';
import { IExtensionActivationManager } from './platform/activation/types';
Expand All @@ -80,15 +80,15 @@ import { getDisplayPath } from './platform/common/platform/fs-paths';
import { IFileSystemNode } from './platform/common/platform/types.node';
import { getJupyterOutputChannel } from './standalone/devTools/jupyterOutputChannel';
import { registerLogger, setLoggingLevel } from './platform/logging';
import { setExtensionInstallTelemetryProperties } from './telemetry/extensionInstallTelemetry.node';
import { setExtensionInstallTelemetryProperties } from './platform/telemetry/extensionInstallTelemetry.node';
import { Container } from 'inversify/lib/container/container';
import { ServiceContainer } from './platform/ioc/container';
import { ServiceManager } from './platform/ioc/serviceManager';
import { OutputChannelLogger } from './platform/logging/outputChannelLogger';
import { ConsoleLogger } from './platform/logging/consoleLogger';
import { FileLogger } from './platform/logging/fileLogger.node';
import { createWriteStream } from 'fs-extra';
import { initializeGlobals as initializeTelemetryGlobals } from './telemetry/telemetry';
import { initializeGlobals as initializeTelemetryGlobals } from './platform/telemetry/telemetry';

durations.codeLoadingTime = stopWatch.elapsedTime;

Expand Down
6 changes: 3 additions & 3 deletions src/extension.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ import {
import { createDeferred } from './platform/common/utils/async';
import { Common, OutputChannelNames } from './platform/common/utils/localize';
import { IServiceContainer, IServiceManager } from './platform/ioc/types';
import { sendErrorTelemetry, sendStartupTelemetry } from './telemetry/startupTelemetry';
import { sendErrorTelemetry, sendStartupTelemetry } from './platform/telemetry/startupTelemetry';
import { noop } from './platform/common/utils/misc';
import { PythonExtension } from './webviews/webview-side/common/constants';
import { registerTypes as registerPlatformTypes } from './platform/serviceRegistry.web';
import { registerTypes as registerTelemetryTypes } from './telemetry/serviceRegistry.web';
import { registerTypes as registerTelemetryTypes } from './platform/telemetry/serviceRegistry.web';
import { registerTypes as registerKernelTypes } from './kernels/serviceRegistry.web';
import { registerTypes as registerNotebookTypes } from './notebooks/serviceRegistry.web';
import { registerTypes as registerInteractiveTypes } from './interactive-window/serviceRegistry.web';
Expand All @@ -81,7 +81,7 @@ import { ServiceContainer } from './platform/ioc/container';
import { ServiceManager } from './platform/ioc/serviceManager';
import { OutputChannelLogger } from './platform/logging/outputChannelLogger';
import { ConsoleLogger } from './platform/logging/consoleLogger';
import { initializeGlobals as initializeTelemetryGlobals } from './telemetry/telemetry';
import { initializeGlobals as initializeTelemetryGlobals } from './platform/telemetry/telemetry';

durations.codeLoadingTime = stopWatch.elapsedTime;

Expand Down
2 changes: 1 addition & 1 deletion src/interactive-window/commands/commandRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { inject, injectable, optional } from 'inversify';
import { CodeLens, ConfigurationTarget, env, Range, Uri, commands } from 'vscode';
import { IKernelProvider } from '../../kernels/types';
import { ICommandNameArgumentTypeMapping } from '../../platform/common/application/commands';
import { ICommandNameArgumentTypeMapping } from '../../commands';
import {
IApplicationShell,
ICommandManager,
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { getDisplayPath, getFilePath } from '../platform/common/platform/fs-path
import { DataScience } from '../platform/common/utils/localize';
import { SysInfoReason } from '../platform/messageTypes';
import { getNormalizedInterpreterPath, getInterpreterHash } from '../platform/pythonEnvironments/info/interpreter';
import { getTelemetrySafeVersion } from '../telemetry/helpers';
import { getTelemetrySafeVersion } from '../platform/telemetry/helpers';
import { EnvironmentType, PythonEnvironment } from '../platform/pythonEnvironments/info';
import { fsPathToUri } from '../platform/vscode-path/utils';
import { deserializePythonEnvironment, serializePythonEnvironment } from '../platform/api/pythonApi';
Expand Down
4 changes: 2 additions & 2 deletions src/kernels/installer/productInstaller.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ import {
import { noop } from '../../platform/common/utils/misc';
import { IServiceContainer } from '../../platform/ioc/types';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { InterpreterPackages } from '../../telemetry/interpreterPackages.node';
import { InterpreterPackages } from '../../platform/telemetry/interpreterPackages.node';
import { getInterpreterHash } from '../../platform/pythonEnvironments/info/interpreter';
import { STANDARD_OUTPUT_CHANNEL } from '../../platform/common/constants';
import { sleep } from '../../platform/common/utils/async';
import { trackPackageInstalledIntoInterpreter } from './productInstaller';
import { IInterpreterPackages } from '../../telemetry/types';
import { IInterpreterPackages } from '../../telemetry';
import { translateProductToModule } from './utils';

export async function isModulePresentInEnvironment(memento: Memento, product: Product, interpreter: PythonEnvironment) {
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IDisposable } from '../../platform/common/types';
import { traceWarning } from '../../platform/logging';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { IKernel, isLocalConnection } from '../types';
import { getTelemetrySafeHashedString } from '../../telemetry/helpers';
import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers';
import * as stripComments from 'strip-comments';
import { IIPyWidgetScriptManager } from './types';
import { StopWatch } from '../../platform/common/utils/stopWatch';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/commonMessageCoordinator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from '../../platform/messageTypes';
import { IServiceContainer } from '../../platform/ioc/types';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { getTelemetrySafeHashedString } from '../../telemetry/helpers';
import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers';
import { Commands } from '../../platform/common/constants';
import { IKernelProvider } from '../types';
import { IPyWidgetMessageDispatcherFactory } from './ipyWidgetMessageDispatcherFactory';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/ipyWidgetScriptSourceProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../../platform/common/extensions';
import { traceError, traceInfo } from '../../platform/logging';
import { WidgetCDNs, IConfigurationService, IHttpClient } from '../../platform/common/types';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { getTelemetrySafeHashedString } from '../../telemetry/helpers';
import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers';
import { IKernel } from '../types';
import {
ILocalResourceUriConverter,
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/localIPyWidgetScriptManager.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IFileSystemNode } from '../../platform/common/platform/types.node';
import { IExtensionContext } from '../../platform/common/types';
import { StopWatch } from '../../platform/common/utils/stopWatch';
import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { getTelemetrySafeHashedString } from '../../telemetry/helpers';
import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers';
import { IKernel } from '../types';
import { BaseIPyWidgetScriptManager } from './baseIPyWidgetScriptManager';
import { IIPyWidgetScriptManager, INbExtensionsPathProvider } from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { disposeAllDisposables } from '../../platform/common/helpers';
import { IDisposableRegistry } from '../../platform/common/types';
import { isJupyterNotebook } from '../../platform/common/utils';
import { captureTelemetry, sendTelemetryEvent, Telemetry } from '../../telemetry';
import { getTelemetrySafeHashedString } from '../../telemetry/helpers';
import { getTelemetrySafeHashedString } from '../../platform/telemetry/helpers';
import { createJupyterCellFromVSCNotebookCell } from '../execution/helpers';
// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires
const flatten = require('lodash/flatten') as typeof import('lodash/flatten');
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/kernelDependencyService.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { DataScience, Common } from '../platform/common/utils/localize';
import { IServiceContainer } from '../platform/ioc/types';
import { EnvironmentType, PythonEnvironment } from '../platform/pythonEnvironments/info';
import { sendTelemetryEvent, Telemetry } from '../telemetry';
import { getTelemetrySafeHashedString } from '../telemetry/helpers';
import { getTelemetrySafeHashedString } from '../platform/telemetry/helpers';
import { isModulePresentInEnvironmentCache, trackPackageInstalledIntoInterpreter } from './installer/productInstaller';
import { ProductNames } from './installer/productNames';
import { IInstaller, Product, InstallerResponse } from './installer/types';
Expand Down
2 changes: 1 addition & 1 deletion src/kernels/raw/finder/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { Telemetry } from '../../../platform/common/constants';
import { sendTelemetryEvent } from '../../../telemetry';
import { getTelemetrySafeLanguage } from '../../../telemetry/helpers';
import { getTelemetrySafeLanguage } from '../../../platform/telemetry/helpers';
import { IJupyterKernelSpec } from '../../types';

const shellScripts = ['/bin/sh', '/bin/bash', '/bin/zsh'];
Expand Down
8 changes: 4 additions & 4 deletions src/kernels/telemetry/helper.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Resource } from '../../platform/common/types';
import { WorkspaceInterpreterTracker } from '../../telemetry/workspaceInterpreterTracker';
import { WorkspaceInterpreterTracker } from '../../platform/telemetry/workspaceInterpreterTracker';
import { PYTHON_LANGUAGE } from '../../platform/common/constants';
import { InterpreterCountTracker } from '../../telemetry/interpreterCountTracker';
import { getTelemetrySafeHashedString, getTelemetrySafeLanguage } from '../../telemetry/helpers';
import { InterpreterCountTracker } from '../../platform/telemetry/interpreterCountTracker';
import { getTelemetrySafeHashedString, getTelemetrySafeLanguage } from '../../platform/telemetry/helpers';
import { getNormalizedInterpreterPath } from '../../platform/pythonEnvironments/info/interpreter';
import { getResourceType } from '../../platform/common/utils';
import { getComparisonKey } from '../../platform/vscode-path/resources';
import { getFilePath } from '../../platform/common/platform/fs-paths';
import { trackedInfo, pythonEnvironmentsByHash, updatePythonPackages } from '../../telemetry/telemetry';
import { trackedInfo, pythonEnvironmentsByHash, updatePythonPackages } from '../../platform/telemetry/telemetry';
import { KernelConnectionMetadata } from '../types';
import { setSharedProperty } from '../../telemetry';

Expand Down
5 changes: 2 additions & 3 deletions src/kernels/telemetry/sendKernelTelemetryEvent.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { Resource } from '../../platform/common/types';
import { IEventNamePropertyMapping } from '../../telemetry/types';
import { Telemetry } from '../../platform/common/constants';
import { setSharedProperty, sendTelemetryEvent, waitBeforeSending } from '../../telemetry';
import { getContextualPropsForTelemetry } from '../../telemetry/telemetry';
import { setSharedProperty, sendTelemetryEvent, waitBeforeSending, IEventNamePropertyMapping } from '../../telemetry';
import { getContextualPropsForTelemetry } from '../../platform/telemetry/telemetry';
import { clearInterruptCounter, trackKernelResourceInformation } from './helper';
import { StopWatch } from '../../platform/common/utils/stopWatch';
import { populateTelemetryWithErrorInfo } from '../../platform/errors';
Expand Down
2 changes: 1 addition & 1 deletion src/notebooks/controllers/notebookControllerManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {
isPythonNotebook
} from '../../kernels/helpers';
import { getNotebookMetadata, getResourceType } from '../../platform/common/utils';
import { getTelemetrySafeLanguage } from '../../telemetry/helpers';
import { getTelemetrySafeLanguage } from '../../platform/telemetry/helpers';
import { INotebookMetadata } from '@jupyterlab/nbformat';
import { ServerConnectionType } from '../../kernels/jupyter/launcher/serverConnectionType';
import { computeServerId } from '../../kernels/jupyter/jupyterUtils';
Expand Down
2 changes: 1 addition & 1 deletion src/notebooks/telemetry/interpreterPackageTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { INotebookControllerManager } from '../types';
import { IInstaller, Product } from '../../kernels/installer/types';
import { IVSCodeNotebookController } from '../controllers/types';
import { trackKernelResourceInformation } from '../../kernels/telemetry/helper';
import { IInterpreterPackages } from '../../telemetry/types';
import { IInterpreterPackages } from '../../telemetry';

@injectable()
export class InterpreterPackageTracker implements IExtensionSingleActivationService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';

import { sendTelemetryEvent, Telemetry } from '../../telemetry';
import { getTelemetrySafeLanguage } from '../../telemetry/helpers';
import { getTelemetrySafeLanguage } from '../../platform/telemetry/helpers';

export function sendNotebookOrKernelLanguageTelemetry(
telemetryEvent: Telemetry.SwitchToExistingKernel | Telemetry.NotebookLanguage,
Expand Down
2 changes: 1 addition & 1 deletion src/platform/common/application/commandManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { injectable } from 'inversify';
import { commands, Disposable, TextEditor, TextEditorEdit } from 'vscode';
import { sendTelemetryEvent } from '../../../telemetry';
import { Telemetry } from '../constants';
import { ICommandNameArgumentTypeMapping } from './commands';
import { ICommandNameArgumentTypeMapping } from '../../../commands';
import { ICommandManager } from './types';

// This contains a list of commands to be ignored when sending telemetry in the command handler.
Expand Down
2 changes: 1 addition & 1 deletion src/platform/common/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ import {
} from 'vscode';

import { IAsyncDisposable, Resource } from '../types';
import { ICommandNameArgumentTypeMapping } from './commands';
import { ICommandNameArgumentTypeMapping } from '../../../commands';

/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/unified-signatures */

Expand Down
2 changes: 1 addition & 1 deletion src/platform/common/experiments/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { inject, injectable, named } from 'inversify';
import { Memento } from 'vscode';
import { getExperimentationService, IExperimentationService, TargetPopulation } from 'vscode-tas-client';
import { sendTelemetryEvent } from '../../../telemetry';
import { EventName } from '../../../telemetry/constants';
import { EventName } from '../../telemetry/constants';
import { IApplicationEnvironment } from '../application/types';
import { JVSC_EXTENSION_ID, STANDARD_OUTPUT_CHANNEL } from '../constants';
import { traceVerbose } from '../../logging';
Expand Down
2 changes: 1 addition & 1 deletion src/platform/common/platform/platformService.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as os from 'os';
import { coerce, SemVer } from 'semver';
import { Uri } from 'vscode';
import { sendTelemetryEvent } from '../../../telemetry';
import { EventName, PlatformErrors } from '../../../telemetry/constants';
import { EventName, PlatformErrors } from '../../telemetry/constants';
import { getOSType, OSType } from '../utils/platform';
import { parseVersion } from '../utils/version.node';
import { NON_WINDOWS_PATH_VARIABLE_NAME, WINDOWS_PATH_VARIABLE_NAME } from './constants.node';
Expand Down
Loading

0 comments on commit 5b7e66d

Please sign in to comment.