Add pijul.openChange command and text document provider for pijul-change scheme
[?]
Jan 4, 2021, 11:52 PM
GNQD74OZ56J2R23GVUGFP3G5KVML2KDZ4OUZK6SVLSM7HVO2WOCACDependencies
- [2]
WCQM6IOKAdd parsing of Author strings - [3]
GGYKE3DVEnforce documentation on every Function, Method, and Class - [4]
ZGMIJNFVCreate pijul.ts for executing commands using the Pijul CLI - [5]
VP6KWIRTAdd inline icons for commands on SCM view - [6]
ODRMVURUImplement first iteration of file diffing - [7]
6H4B4UJQAdd commands to open repo and global pijul configuration files - [8]
OXW4KMVUAdd QuickDiffProvider - [9]
YUVLBWV3Populate resource groups for unrecorded and untracked changes - [10]
L44OILGKAdd reset command to resource state context menu - [11]
L3VOQYAFAdd changelog view to the source control panel - [12]
ILH3GIVTAdd command centre and refresh/init commands - [*]
B4SKYP3YAdd repository model and add steps to initialize it - [*]
NCBEWRYEInitialize Repository
Change contents
- replacement in src/views/changelog.ts at line 1
import { TreeDataProvider, TreeItem, TreeItemCollapsibleState } from 'vscode';import { TreeDataProvider, TreeItem, TreeItemCollapsibleState, Uri } from 'vscode'; - edit in src/views/changelog.ts at line 22
const resourceUri = Uri.parse('pijul-change:' + element.hash); - replacement in src/views/changelog.ts at line 28
collapsibleState: TreeItemCollapsibleState.NonecollapsibleState: TreeItemCollapsibleState.None,contextValue: 'pijulChange',resourceUri: resourceUri,command: {command: 'vscode.open',title: 'Open Change TOML',arguments: [resourceUri]} - edit in src/repository.ts at line 106
this.disposables.push(workspace.registerTextDocumentContentProvider('pijul-change', this.repository)); - replacement in src/pijul.ts at line 182
* Implementation of the TextDocumentContentProvider, uses the `pijul reset <file> --dry-run` CLI command* to get the last recorded version of the file at the given URI, which VS Code can open as a text document.* @param uri The URI, with scheme 'pijul', which will be used to retrieve the last recorded version of the file* Implementation of the TextDocumentContentProvider. Depending on the scheme of the given URI, either returns* a the last recorded version of a file using `pijul reset` or the stdout of the `pijul change` command.* @param uri The URI, with scheme 'pijul' or 'pijul-change', which will be used to determine which text document should be returned. - replacement in src/pijul.ts at line 188
// return stdout, which is the last recorded version of the filereturn (await this._pijul.exec(this.repositoryRoot, ['reset', uri.path, '--dry-run'], { cancellationToken: token })).stdout;if (uri.scheme === 'pijul-change') {return (await this._pijul.exec(this.repositoryRoot, ['change', uri.path], { cancellationToken: token })).stdout;} else {// return stdout of a pijul reset dry run, which is the last recorded version of the filereturn (await this._pijul.exec(this.repositoryRoot, ['reset', uri.path, '--dry-run'], { cancellationToken: token })).stdout;} - replacement in src/commands.ts at line 4
import { Pijul } from './pijul';import { Pijul, PijulChange } from './pijul'; - edit in src/commands.ts at line 241
* Opens the output of `pijul change` for a given change* @param resourceStates The resources to open*/@command('pijul.openChange')async openChange (change: PijulChange): Promise<void> {const changeUri = Uri.parse('pijul-change:' + change.hash);console.log(changeUri);await commands.executeCommand('vscode.open', changeUri);}/** - edit in package.json at line 92
"command": "pijul.openChange","title": "Open Change TOML","category": "Pijul"},{ - replacement in package.json at line 253
]],"view/item/context": [{"command": "pijul.openChange","when": "view == pijul.views.log && viewItem == pijulChange"}]