Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMegan Rogge <merogge@microsoft.com>2022-06-07 19:27:44 +0300
committerGitHub <noreply@github.com>2022-06-07 19:27:44 +0300
commit7c22caad555b7b654ce4021ebf5b70e60c3cef23 (patch)
treee2ad02b35d2f03468df2e9f16e56f3c1cdc774a0 /extensions
parentc51f8ff55c79d9cda39358a3788e7ea151127138 (diff)
Use `I` prefix for task interfaces (#151350)
Diffstat (limited to 'extensions')
-rw-r--r--extensions/npm/src/commands.ts8
-rw-r--r--extensions/npm/src/npmView.ts12
-rw-r--r--extensions/npm/src/tasks.ts36
-rw-r--r--extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts8
4 files changed, 32 insertions, 32 deletions
diff --git a/extensions/npm/src/commands.ts b/extensions/npm/src/commands.ts
index 6847f322631..295ae306c3f 100644
--- a/extensions/npm/src/commands.ts
+++ b/extensions/npm/src/commands.ts
@@ -10,7 +10,7 @@ import {
detectNpmScriptsForFolder,
findScriptAtPosition,
runScript,
- FolderTaskItem
+ IFolderTaskItem
} from './tasks';
const localize = nls.loadMessageBundle();
@@ -37,17 +37,17 @@ export async function selectAndRunScriptFromFolder(context: vscode.ExtensionCont
}
const selectedFolder = selectedFolders[0];
- let taskList: FolderTaskItem[] = await detectNpmScriptsForFolder(context, selectedFolder);
+ let taskList: IFolderTaskItem[] = await detectNpmScriptsForFolder(context, selectedFolder);
if (taskList && taskList.length > 0) {
- const quickPick = vscode.window.createQuickPick<FolderTaskItem>();
+ const quickPick = vscode.window.createQuickPick<IFolderTaskItem>();
quickPick.title = 'Run NPM script in Folder';
quickPick.placeholder = 'Select an npm script';
quickPick.items = taskList;
const toDispose: vscode.Disposable[] = [];
- let pickPromise = new Promise<FolderTaskItem | undefined>((c) => {
+ let pickPromise = new Promise<IFolderTaskItem | undefined>((c) => {
toDispose.push(quickPick.onDidAccept(() => {
toDispose.forEach(d => d.dispose());
c(quickPick.selectedItems[0]);
diff --git a/extensions/npm/src/npmView.ts b/extensions/npm/src/npmView.ts
index 41e28e9bdf5..e7bfd08bd7c 100644
--- a/extensions/npm/src/npmView.ts
+++ b/extensions/npm/src/npmView.ts
@@ -14,10 +14,10 @@ import {
import * as nls from 'vscode-nls';
import { readScripts } from './readScripts';
import {
- createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, NpmTaskDefinition,
+ createTask, getPackageManager, getTaskName, isAutoDetectionEnabled, isWorkspaceFolder, INpmTaskDefinition,
NpmTaskProvider,
startDebugging,
- TaskWithLocation
+ ITaskWithLocation
} from './tasks';
const localize = nls.loadMessageBundle();
@@ -78,7 +78,7 @@ class NpmScript extends TreeItem {
package: PackageJSON;
taskLocation?: Location;
- constructor(_context: ExtensionContext, packageJson: PackageJSON, task: TaskWithLocation) {
+ constructor(_context: ExtensionContext, packageJson: PackageJSON, task: ITaskWithLocation) {
const name = packageJson.path.length > 0
? task.task.name.substring(0, task.task.name.length - packageJson.path.length - 2)
: task.task.name;
@@ -284,7 +284,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
});
}
- private buildTaskTree(tasks: TaskWithLocation[]): TaskTree {
+ private buildTaskTree(tasks: ITaskWithLocation[]): TaskTree {
let folders: Map<String, Folder> = new Map();
let packages: Map<String, PackageJSON> = new Map();
@@ -301,7 +301,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
}
const regularExpressions = (location && excludeConfig.has(location.uri.toString())) ? excludeConfig.get(location.uri.toString()) : undefined;
- if (regularExpressions && regularExpressions.some((regularExpression) => (<NpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
+ if (regularExpressions && regularExpressions.some((regularExpression) => (<INpmTaskDefinition>each.task.definition).script.match(regularExpression))) {
return;
}
@@ -311,7 +311,7 @@ export class NpmScriptsTreeDataProvider implements TreeDataProvider<TreeItem> {
folder = new Folder(each.task.scope);
folders.set(each.task.scope.name, folder);
}
- let definition: NpmTaskDefinition = <NpmTaskDefinition>each.task.definition;
+ let definition: INpmTaskDefinition = <INpmTaskDefinition>each.task.definition;
let relativePath = definition.path ? definition.path : '';
let fullPath = path.join(each.task.scope.name, relativePath);
packageJson = packages.get(fullPath);
diff --git a/extensions/npm/src/tasks.ts b/extensions/npm/src/tasks.ts
index d05b7bbc8bf..47237442d98 100644
--- a/extensions/npm/src/tasks.ts
+++ b/extensions/npm/src/tasks.ts
@@ -17,28 +17,28 @@ import { readScripts } from './readScripts';
const localize = nls.loadMessageBundle();
-export interface NpmTaskDefinition extends TaskDefinition {
+export interface INpmTaskDefinition extends TaskDefinition {
script: string;
path?: string;
}
-export interface FolderTaskItem extends QuickPickItem {
+export interface IFolderTaskItem extends QuickPickItem {
label: string;
task: Task;
}
type AutoDetect = 'on' | 'off';
-let cachedTasks: TaskWithLocation[] | undefined = undefined;
+let cachedTasks: ITaskWithLocation[] | undefined = undefined;
const INSTALL_SCRIPT = 'install';
-export interface TaskLocation {
+export interface ITaskLocation {
document: Uri;
line: Position;
}
-export interface TaskWithLocation {
+export interface ITaskWithLocation {
task: Task;
location?: Location;
}
@@ -48,7 +48,7 @@ export class NpmTaskProvider implements TaskProvider {
constructor(private context: ExtensionContext) {
}
- get tasksWithLocation(): Promise<TaskWithLocation[]> {
+ get tasksWithLocation(): Promise<ITaskWithLocation[]> {
return provideNpmScripts(this.context, false);
}
@@ -60,7 +60,7 @@ export class NpmTaskProvider implements TaskProvider {
public async resolveTask(_task: Task): Promise<Task | undefined> {
const npmTask = (<any>_task.definition).script;
if (npmTask) {
- const kind: NpmTaskDefinition = (<any>_task.definition);
+ const kind: INpmTaskDefinition = (<any>_task.definition);
let packageJsonUri: Uri;
if (_task.scope === undefined || _task.scope === TaskScope.Global || _task.scope === TaskScope.Workspace) {
// scope is required to be a WorkspaceFolder for resolveTask
@@ -170,10 +170,10 @@ export async function hasNpmScripts(): Promise<boolean> {
}
}
-async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<TaskWithLocation[]> {
+async function detectNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<ITaskWithLocation[]> {
- let emptyTasks: TaskWithLocation[] = [];
- let allTasks: TaskWithLocation[] = [];
+ let emptyTasks: ITaskWithLocation[] = [];
+ let allTasks: ITaskWithLocation[] = [];
let visitedPackageJsonFiles: Set<string> = new Set();
let folders = workspace.workspaceFolders;
@@ -201,9 +201,9 @@ async function detectNpmScripts(context: ExtensionContext, showWarning: boolean)
}
-export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise<FolderTaskItem[]> {
+export async function detectNpmScriptsForFolder(context: ExtensionContext, folder: Uri): Promise<IFolderTaskItem[]> {
- let folderTasks: FolderTaskItem[] = [];
+ let folderTasks: IFolderTaskItem[] = [];
try {
let relativePattern = new RelativePattern(folder.fsPath, '**/package.json');
@@ -223,7 +223,7 @@ export async function detectNpmScriptsForFolder(context: ExtensionContext, folde
}
}
-export async function provideNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<TaskWithLocation[]> {
+export async function provideNpmScripts(context: ExtensionContext, showWarning: boolean): Promise<ITaskWithLocation[]> {
if (!cachedTasks) {
cachedTasks = await detectNpmScripts(context, showWarning);
}
@@ -261,8 +261,8 @@ function isDebugScript(script: string): boolean {
return match !== null;
}
-async function provideNpmScriptsForFolder(context: ExtensionContext, packageJsonUri: Uri, showWarning: boolean): Promise<TaskWithLocation[]> {
- let emptyTasks: TaskWithLocation[] = [];
+async function provideNpmScriptsForFolder(context: ExtensionContext, packageJsonUri: Uri, showWarning: boolean): Promise<ITaskWithLocation[]> {
+ let emptyTasks: ITaskWithLocation[] = [];
let folder = workspace.getWorkspaceFolder(packageJsonUri);
if (!folder) {
@@ -273,7 +273,7 @@ async function provideNpmScriptsForFolder(context: ExtensionContext, packageJson
return emptyTasks;
}
- const result: TaskWithLocation[] = [];
+ const result: ITaskWithLocation[] = [];
const packageManager = await getPackageManager(context, folder.uri, showWarning);
@@ -294,8 +294,8 @@ export function getTaskName(script: string, relativePath: string | undefined) {
return script;
}
-export async function createTask(packageManager: string, script: NpmTaskDefinition | string, cmd: string[], folder: WorkspaceFolder, packageJsonUri: Uri, scriptValue?: string, matcher?: any): Promise<Task> {
- let kind: NpmTaskDefinition;
+export async function createTask(packageManager: string, script: INpmTaskDefinition | string, cmd: string[], folder: WorkspaceFolder, packageJsonUri: Uri, scriptValue?: string, matcher?: any): Promise<Task> {
+ let kind: INpmTaskDefinition;
if (typeof script === 'string') {
kind = { type: 'npm', script: script };
} else {
diff --git a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts
index a7b497e5467..4167e15ce00 100644
--- a/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts
+++ b/extensions/vscode-api-tests/src/singlefolder-tests/workspace.tasks.test.ts
@@ -147,7 +147,7 @@ import { assertNoRpc } from '../utils';
suite('CustomExecution', () => {
test('task should start and shutdown successfully', async () => {
window.terminals.forEach(terminal => terminal.dispose());
- interface CustomTestingTaskDefinition extends TaskDefinition {
+ interface ICustomTestingTaskDefinition extends TaskDefinition {
/**
* One of the task properties. This can be used to customize the task in the tasks.json
*/
@@ -179,7 +179,7 @@ import { assertNoRpc } from '../utils';
disposables.push(tasks.registerTaskProvider(taskType, {
provideTasks: () => {
const result: Task[] = [];
- const kind: CustomTestingTaskDefinition = {
+ const kind: ICustomTestingTaskDefinition = {
type: taskType,
customProp1: 'testing task one'
};
@@ -235,7 +235,7 @@ import { assertNoRpc } from '../utils';
});
test('sync task should flush all data on close', async () => {
- interface CustomTestingTaskDefinition extends TaskDefinition {
+ interface ICustomTestingTaskDefinition extends TaskDefinition {
/**
* One of the task properties. This can be used to customize the task in the tasks.json
*/
@@ -250,7 +250,7 @@ import { assertNoRpc } from '../utils';
disposables.push(tasks.registerTaskProvider(taskType, {
provideTasks: () => {
const result: Task[] = [];
- const kind: CustomTestingTaskDefinition = {
+ const kind: ICustomTestingTaskDefinition = {
type: taskType,
customProp1: 'testing task one'
};