Skip to content

Commit c5a8e4f

Browse files
authored
Refactor code to remove unused JSDoc types (#24300)
Fixes #24077 Removes redundant type annotations from JSDocs in TypeScript files where the type is already inferred by TypeScript. For example: ![image](https://github.com/user-attachments/assets/9ee1f0b6-f36f-4f4f-81dc-5178d46808cb) Here I removed JSDoc types but I still kept all the useful information. I tried to be on the liberal side to avoid removing any comments that provide useful context or clarify behavior. If I missed any or if more can be removed, I’m happy to go over it again. Additionally, if this issue only applies to a specific folder or scope, please let me know so I can make the necessary adjustments.
1 parent 9be9308 commit c5a8e4f

37 files changed

+5
-192
lines changed

pythonExtensionApi/src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export interface PythonExtension {
2525

2626
/**
2727
* Gets the path to the debugger package used by the extension.
28-
* @returns {Promise<string>}
2928
*/
3029
getDebuggerPackagePath(): Promise<string | undefined>;
3130
};

src/client/activation/types.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,14 @@ import { PythonEnvironment } from '../pythonEnvironments/info';
1212
export const IExtensionActivationManager = Symbol('IExtensionActivationManager');
1313
/**
1414
* Responsible for activation of extension.
15-
*
16-
* @export
17-
* @interface IExtensionActivationManager
18-
* @extends {IDisposable}
1915
*/
2016
export interface IExtensionActivationManager extends IDisposable {
21-
/**
22-
* Method invoked when extension activates (invoked once).
23-
*
24-
* @returns {Promise<void>}
25-
* @memberof IExtensionActivationManager
26-
*/
17+
// Method invoked when extension activates (invoked once).
2718
activate(startupStopWatch: StopWatch): Promise<void>;
2819
/**
2920
* Method invoked when a workspace is loaded.
3021
* This is where we place initialization scripts for each workspace.
3122
* (e.g. if we need to run code for each workspace, then this is where that happens).
32-
*
33-
* @param {Resource} resource
34-
* @returns {Promise<void>}
35-
* @memberof IExtensionActivationManager
3623
*/
3724
activateWorkspace(resource: Resource): Promise<void>;
3825
}
@@ -43,8 +30,6 @@ export const IExtensionActivationService = Symbol('IExtensionActivationService')
4330
* invoked for every workspace folder (in multi-root workspace folders) during the activation of the extension.
4431
* This is a great hook for extension activation code, i.e. you don't need to modify
4532
* the `extension.ts` file to invoke some code when extension gets activated.
46-
* @export
47-
* @interface IExtensionActivationService
4833
*/
4934
export interface IExtensionActivationService {
5035
supportedWorkspaceTypes: { untrustedWorkspace: boolean; virtualWorkspace: boolean };
@@ -100,8 +85,6 @@ export interface ILanguageServerProxy extends IDisposable {
10085
* Sends a request to LS so as to load other extensions.
10186
* This is used as a plugin loader mechanism.
10287
* Anyone (such as intellicode) wanting to interact with LS, needs to send this request to LS.
103-
* @param {{}} [args]
104-
* @memberof ILanguageServerProxy
10588
*/
10689
loadExtension(args?: unknown): void;
10790
}
@@ -110,9 +93,6 @@ export const ILanguageServerOutputChannel = Symbol('ILanguageServerOutputChannel
11093
export interface ILanguageServerOutputChannel {
11194
/**
11295
* Creates output channel if necessary and returns it
113-
*
114-
* @type {ILogOutputChannel}
115-
* @memberof ILanguageServerOutputChannel
11696
*/
11797
readonly channel: ILogOutputChannel;
11898
}
@@ -123,8 +103,6 @@ export const IExtensionSingleActivationService = Symbol('IExtensionSingleActivat
123103
* invoked during the activation of the extension.
124104
* This is a great hook for extension activation code, i.e. you don't need to modify
125105
* the `extension.ts` file to invoke some code when extension gets activated.
126-
* @export
127-
* @interface IExtensionSingleActivationService
128106
*/
129107
export interface IExtensionSingleActivationService {
130108
supportedWorkspaceTypes: { untrustedWorkspace: boolean; virtualWorkspace: boolean };

src/client/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export function buildApi(
8080
* @param {Resource} [resource] A resource for which the setting is asked for.
8181
* * When no resource is provided, the setting scoped to the first workspace folder is returned.
8282
* * If no folder is present, it returns the global setting.
83-
* @returns {({ execCommand: string[] | undefined })}
8483
*/
8584
getExecutionDetails(
8685
resource?: Resource,

src/client/api/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export interface PythonExtension {
2525

2626
/**
2727
* Gets the path to the debugger package used by the extension.
28-
* @returns {Promise<string>}
2928
*/
3029
getDebuggerPackagePath(): Promise<string | undefined>;
3130
};

src/client/application/diagnostics/base.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,6 @@ export abstract class BaseDiagnosticsService implements IDiagnosticsService, IDi
7373
/**
7474
* Returns a key used to keep track of whether a diagnostic was handled or not.
7575
* So as to prevent handling/displaying messages multiple times for the same diagnostic.
76-
*
77-
* @protected
78-
* @param {IDiagnostic} diagnostic
79-
* @returns {string}
80-
* @memberof BaseDiagnosticsService
8176
*/
8277
protected getDiagnosticsKey(diagnostic: IDiagnostic): string {
8378
if (diagnostic.scope === DiagnosticScope.Global) {

src/client/application/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export interface IApplicationDiagnostics {
1111
/**
1212
* Perform pre-extension activation health checks.
1313
* E.g. validate user environment, etc.
14-
* @returns {Promise<void>}
15-
* @memberof IApplicationDiagnostics
1614
*/
1715
performPreStartupHealthCheck(resource: Resource): Promise<void>;
1816
register(): void;

src/client/common/application/commands.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export type CommandsWithoutArgs = keyof ICommandNameWithoutArgumentTypeMapping;
1414
/**
1515
* Mapping between commands and list or arguments.
1616
* These commands do NOT have any arguments.
17-
* @interface ICommandNameWithoutArgumentTypeMapping
1817
*/
1918
interface ICommandNameWithoutArgumentTypeMapping {
2019
[Commands.InstallPythonOnMac]: [];
@@ -52,9 +51,6 @@ export type AllCommands = keyof ICommandNameArgumentTypeMapping;
5251
/**
5352
* Mapping between commands and list of arguments.
5453
* Used to provide strong typing for command & args.
55-
* @export
56-
* @interface ICommandNameArgumentTypeMapping
57-
* @extends {ICommandNameWithoutArgumentTypeMapping}
5854
*/
5955
export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgumentTypeMapping {
6056
[Commands.Create_Environment]: [CreateEnvironmentOptions];

src/client/common/application/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,6 @@ export interface IWorkspaceService {
818818

819819
/**
820820
* Generate a key that's unique to the workspace folder (could be fsPath).
821-
* @param {(Uri | undefined)} resource
822-
* @returns {string}
823-
* @memberof IWorkspaceService
824821
*/
825822
getWorkspaceFolderIdentifier(resource: Uri | undefined, defaultValue?: string): string;
826823
/**

src/client/common/cancellation.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ export class CancellationError extends Error {
1616
}
1717
/**
1818
* Create a promise that will either resolve with a default value or reject when the token is cancelled.
19-
*
20-
* @export
21-
* @template T
22-
* @param {({ defaultValue: T; token: CancellationToken; cancelAction: 'reject' | 'resolve' })} options
23-
* @returns {Promise<T>}
2419
*/
2520
export function createPromiseFromCancellation<T>(options: {
2621
defaultValue: T;
@@ -50,10 +45,6 @@ export function createPromiseFromCancellation<T>(options: {
5045

5146
/**
5247
* Create a single unified cancellation token that wraps multiple cancellation tokens.
53-
*
54-
* @export
55-
* @param {(...(CancellationToken | undefined)[])} tokens
56-
* @returns {CancellationToken}
5748
*/
5849
export function wrapCancellationTokens(...tokens: (CancellationToken | undefined)[]): CancellationToken {
5950
const wrappedCancellantionToken = new CancellationTokenSource();
@@ -117,15 +108,13 @@ export namespace Cancellation {
117108

118109
/**
119110
* isCanceled returns a boolean indicating if the cancel token has been canceled.
120-
* @param cancelToken
121111
*/
122112
export function isCanceled(cancelToken?: CancellationToken): boolean {
123113
return cancelToken ? cancelToken.isCancellationRequested : false;
124114
}
125115

126116
/**
127117
* throws a CancellationError if the token is canceled.
128-
* @param cancelToken
129118
*/
130119
export function throwIfCanceled(cancelToken?: CancellationToken): void {
131120
if (isCanceled(cancelToken)) {

src/client/common/constants.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ export function isTestExecution(): boolean {
111111
/**
112112
* Whether we're running unit tests (*.unit.test.ts).
113113
* These tests have a special meaning, they run fast.
114-
* @export
115-
* @returns {boolean}
116114
*/
117115
export function isUnitTestExecution(): boolean {
118116
return process.env.VSC_PYTHON_UNIT_TEST === '1';

0 commit comments

Comments
 (0)