-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor round 2, with shared context
- Loading branch information
Showing
6 changed files
with
210 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as vscode from 'vscode'; | ||
import { AllQPItemVariants, DisposablesMap } from '../types'; | ||
import { getConfig } from '../utils/getConfig'; | ||
import { ChildProcessWithoutNullStreams } from 'child_process'; | ||
import { highlightLineDecorationType } from '../utils/highlightLineDecorationType'; | ||
|
||
// simple context for each invoke of periscope search | ||
let qp = vscode.window.createQuickPick<AllQPItemVariants>(); // @see https://code.visualstudio.com/api/references/vscode-api#QuickPick | ||
let workspaceFolders = vscode.workspace.workspaceFolders; | ||
let query = ''; | ||
let spawnRegistry: ChildProcessWithoutNullStreams[] = []; | ||
let config = getConfig(); | ||
let rgMenuActionsSelected: string[] = []; | ||
let highlightDecoration = highlightLineDecorationType(); | ||
let disposables: DisposablesMap = { | ||
general: [], | ||
rgMenuActions: [], | ||
query: [], | ||
}; | ||
|
||
export const context = { | ||
resetContext, | ||
qp, | ||
workspaceFolders, | ||
query, | ||
spawnRegistry, | ||
config, | ||
rgMenuActionsSelected, | ||
highlightDecoration, | ||
disposables | ||
}; | ||
|
||
// reset the context | ||
function resetContext() { | ||
context.qp = vscode.window.createQuickPick<AllQPItemVariants>(); | ||
context.workspaceFolders = vscode.workspace.workspaceFolders; | ||
context.query = ''; | ||
context.spawnRegistry = []; | ||
context.config = getConfig(); | ||
context.rgMenuActionsSelected = []; | ||
context.highlightDecoration = highlightLineDecorationType(); | ||
context.disposables = { | ||
general: [], | ||
rgMenuActions: [], | ||
query: [], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.