From 95e2544f213651e2442cd1ce2c5901f7be54c057 Mon Sep 17 00:00:00 2001 From: nobkd <44443899+nobkd@users.noreply.github.com> Date: Sat, 3 Dec 2022 19:36:55 +0100 Subject: [PATCH] fix: rename aoc data to aoc input to clarify --- package.json | 16 ++++++++-------- .../{openDataEditor.ts => openInputEditor.ts} | 6 +++--- src/commands/{saveData.ts => saveInput.ts} | 6 +++--- src/extension.ts | 14 +++++++------- src/utils/helper.ts | 6 +++--- src/utils/request.ts | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) rename src/commands/{openDataEditor.ts => openInputEditor.ts} (59%) rename src/commands/{saveData.ts => saveInput.ts} (79%) diff --git a/package.json b/package.json index dc4accd..6b49bd4 100644 --- a/package.json +++ b/package.json @@ -39,8 +39,8 @@ "onCommand:advent-of-vscode.loadCookie", "onCommand:advent-of-vscode.openDescriptionPanel", "onCommand:advent-of-vscode.select", - "onCommand:advent-of-vscode.saveData", - "onCommand:advent-of-vscode.copyData", + "onCommand:advent-of-vscode.saveInput", + "onCommand:advent-of-vscode.openInputEditor", "onCommand:advent-of-vscode.refreshDescription", "onCommand:advent-of-vscode.refreshTree" ], @@ -99,12 +99,12 @@ "group": "navigation@1" }, { - "command": "advent-of-vscode.saveData", + "command": "advent-of-vscode.saveInput", "when": "view == descriptionView && advent-of-vscode.loggedIn && advent-of-vscode.daySelected", "group": "navigation@2" }, { - "command": "advent-of-vscode.openDataEditor", + "command": "advent-of-vscode.openInputEditor", "when": "view == descriptionView && advent-of-vscode.loggedIn && advent-of-vscode.daySelected", "group": "navigation@3" } @@ -122,13 +122,13 @@ "icon": "$(log-out)" }, { - "command": "advent-of-vscode.saveData", - "title": "Save AoC Data as File", + "command": "advent-of-vscode.saveInput", + "title": "Save AoC Input as File", "icon": "$(save-as)" }, { - "command": "advent-of-vscode.openDataEditor", - "title": "Open AoC Data to Editor", + "command": "advent-of-vscode.openInputEditor", + "title": "Open AoC Input to Editor", "icon": "$(preferences-open-settings)" }, { diff --git a/src/commands/openDataEditor.ts b/src/commands/openInputEditor.ts similarity index 59% rename from src/commands/openDataEditor.ts rename to src/commands/openInputEditor.ts index 8667b5d..3b2daf1 100644 --- a/src/commands/openDataEditor.ts +++ b/src/commands/openInputEditor.ts @@ -1,9 +1,9 @@ import * as vscode from 'vscode'; -import { collectFetchData } from '../utils/helper'; +import { collectFetchInput } from '../utils/helper'; -export async function openDataEditor(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined) { - const content = await collectFetchData(year, day); +export async function openInputEditor(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined) { + const content = await collectFetchInput(year, day); if (content === undefined) { return; } diff --git a/src/commands/saveData.ts b/src/commands/saveInput.ts similarity index 79% rename from src/commands/saveData.ts rename to src/commands/saveInput.ts index 5da38e7..01c1450 100644 --- a/src/commands/saveData.ts +++ b/src/commands/saveInput.ts @@ -1,10 +1,10 @@ import * as vscode from 'vscode'; import { TextEncoder } from 'util'; -import { collectFetchData } from '../utils/helper'; +import { collectFetchInput } from '../utils/helper'; -export async function saveData(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined): Promise { - const data = await collectFetchData(year, day); +export async function saveInput(context: vscode.ExtensionContext, year: number | undefined, day: number | undefined): Promise { + const data = await collectFetchInput(year, day); if (data === undefined) { return; } diff --git a/src/extension.ts b/src/extension.ts index 9e9cbdb..1460ed1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2,8 +2,8 @@ import * as vscode from 'vscode'; import { login } from './commands/login'; import { logout } from './commands/logout'; -import { saveData } from './commands/saveData'; -import { openDataEditor } from './commands/openDataEditor'; +import { saveInput } from './commands/saveInput'; +import { openInputEditor } from './commands/openInputEditor'; import { SelectDayView } from './views/selectDayView'; import { DescriptionView } from './views/descriptionView'; @@ -99,16 +99,16 @@ export async function activate(context: vscode.ExtensionContext) { ) ); - // Data + // Input context.subscriptions.push( - vscode.commands.registerCommand('advent-of-vscode.openDataEditor', - async (year: number | undefined, day: number | undefined) => openDataEditor(context, year ?? selectionProxy.year, day ?? selectionProxy.day) + vscode.commands.registerCommand('advent-of-vscode.openInputEditor', + async (year: number | undefined, day: number | undefined) => openInputEditor(context, year ?? selectionProxy.year, day ?? selectionProxy.day) ) ); context.subscriptions.push( - vscode.commands.registerCommand('advent-of-vscode.saveData', - (year: number | undefined, day: number | undefined) => saveData(context, year ?? selectionProxy.year, day ?? selectionProxy.day) // TODO: change for inline cmds + vscode.commands.registerCommand('advent-of-vscode.saveInput', + (year: number | undefined, day: number | undefined) => saveInput(context, year ?? selectionProxy.year, day ?? selectionProxy.day) // TODO: change for inline cmds ) ); } diff --git a/src/utils/helper.ts b/src/utils/helper.ts index f99edb3..eb0afcb 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode'; -import { fetchData } from './request'; +import { fetchInput } from './request'; import { selectionProxy } from '../extension'; export function getNonce(): string { @@ -44,10 +44,10 @@ export function getDefaultHtml(defaultData: any) { `; } -export function collectFetchData(year: number | undefined, day: number | undefined): Promise { +export function collectFetchInput(year: number | undefined, day: number | undefined): Promise { if (selectionProxy.loggedIn === false) { vscode.window.showErrorMessage('Please [log in](command:advent-of-vscode.login) before getting data'); } - return fetchData(year, day); + return fetchInput(year, day); } diff --git a/src/utils/request.ts b/src/utils/request.ts index 76e25de..8332903 100644 --- a/src/utils/request.ts +++ b/src/utils/request.ts @@ -33,7 +33,7 @@ export async function fetchDescription(year: number, day: number): Promise { +export async function fetchInput(year: number | undefined, day: number | undefined): Promise { if (year === undefined || day === undefined) { return; }