Skip to content

Commit

Permalink
Rename to ExecuteQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
DavisVaughan committed Sep 9, 2024
1 parent 8decce4 commit a18dd6d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* manager.ts
* execute-queue.ts
*
* Copyright (C) 2024 by Posit Software, PBC
*
Expand All @@ -16,13 +16,14 @@
import PQueue from 'p-queue';

/**
* Manager of multiple queues
* Language specific execution queue
*
* A singleton class that constructs and manages multiple queues, identified by their `key`.
* A singleton class that constructs and manages multiple execution queues, identified by
* their `key` (typically the language name).
*/
export class TaskQueueManager {
export class ExecuteQueue {
/// Singleton instance
private static _instance: TaskQueueManager;
private static _instance: ExecuteQueue;

/// Maps a `key` to its `queue`
private _queues = new Map<string, PQueue>();
Expand All @@ -39,13 +40,13 @@ export class TaskQueueManager {
*
* Creates it if it doesn't exist.
*/
static get instance(): TaskQueueManager {
if (!TaskQueueManager._instance) {
// Initialize manager if we've never accessed it
TaskQueueManager._instance = new TaskQueueManager();
static get instance(): ExecuteQueue {
if (!ExecuteQueue._instance) {
// Initialize if we've never accessed it
ExecuteQueue._instance = new ExecuteQueue();
}

return TaskQueueManager._instance;
return ExecuteQueue._instance;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/vscode/src/host/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import * as hooks from 'positron';

import { ExtensionHost, HostWebviewPanel, HostStatementRangeProvider } from '.';
import { CellExecutor, cellExecutorForLanguage, executableLanguages, isKnitrDocument, pythonWithReticulate } from './executors';
import { ExecuteQueue } from './execute-queue';
import { MarkdownEngine } from '../markdown/engine';
import { virtualDoc, virtualDocUri, adjustedPosition } from "../vdoc/vdoc";
import { TaskQueueManager } from './manager';

declare global {
function acquirePositronApi() : hooks.PositronApi;
Expand Down Expand Up @@ -76,7 +76,7 @@ export function hooksExtensionHost() : ExtensionHost {
}
}

await TaskQueueManager.instance.add(language, callback);
await ExecuteQueue.instance.add(language, callback);
},
executeSelection: async () : Promise<void> => {
await vscode.commands.executeCommand('workbench.action.positronConsole.executeCode', {languageId: language});
Expand Down

0 comments on commit a18dd6d

Please sign in to comment.