diff --git a/src/Instance.ts b/src/Instance.ts index 8517637cd..c613497bd 100644 --- a/src/Instance.ts +++ b/src/Instance.ts @@ -8,7 +8,7 @@ import { VsCodeConfig } from "./config/Configuration"; import { ConnectionConfig } from "./api/configuration/config/ConnectionManager"; import { EventEmitter } from "stream"; import { ConnectionStorage } from "./api/configuration/storage/ConnectionStorage"; -import { VscodeTools } from "./ui/vscodeTools"; +import { VscodeTools } from "./ui/Tools"; type IBMiEventSubscription = { func: Function, diff --git a/src/commands/open.ts b/src/commands/open.ts index e7d037b89..06685fe5b 100644 --- a/src/commands/open.ts +++ b/src/commands/open.ts @@ -4,7 +4,7 @@ import Instance from "../Instance"; import { Tools } from "../api/Tools"; import { getUriFromPath, parseFSOptions } from "../filesystems/qsys/QSysFs"; import path from "path"; -import { VscodeTools } from "../ui/vscodeTools"; +import { VscodeTools } from "../ui/Tools"; import IBMi from "../api/IBMi"; import { DefaultOpenMode } from "../api/configuration/config/ConnectionManager"; diff --git a/src/debug/certificates.ts b/src/debug/certificates.ts index e9fcad477..a568db53c 100644 --- a/src/debug/certificates.ts +++ b/src/debug/certificates.ts @@ -8,7 +8,7 @@ import { instance } from '../instantiate'; import IBMi from "../api/IBMi"; import IBMiContent from '../api/IBMiContent'; import { Tools } from '../api/Tools'; -import { VscodeTools } from '../ui/vscodeTools'; +import { VscodeTools } from '../ui/Tools'; import { DebugConfiguration, SERVICE_CERTIFICATE, CLIENT_CERTIFICATE, getDebugServiceDetails, getJavaHome, DEBUG_CONFIG_FILE, LEGACY_CERT_DIRECTORY } from '../api/configuration/DebugConfiguration'; type HostInfo = { diff --git a/src/debug/index.ts b/src/debug/index.ts index ad9de0e3b..344accbb1 100644 --- a/src/debug/index.ts +++ b/src/debug/index.ts @@ -11,7 +11,7 @@ import { Env, getEnvConfig } from "../filesystems/local/env"; import * as certificates from "./certificates"; import { DEBUG_CONFIG_FILE, DebugConfiguration, getDebugServiceDetails, resetDebugServiceDetails } from "../api/configuration/DebugConfiguration"; import * as server from "./server"; -import { VscodeTools } from "../ui/vscodeTools"; +import { VscodeTools } from "../ui/Tools"; import { getStoredPassword } from "../config/passwords"; const debugExtensionId = `IBM.ibmidebug`; diff --git a/src/extension.ts b/src/extension.ts index 1579832ee..79a06c8f0 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -34,7 +34,7 @@ import { SettingsUI } from "./webviews/settings"; import { registerActionTools } from "./ui/actions"; import IBMi from "./api/IBMi"; import path from "path"; -import { VscodeTools } from "./ui/vscodeTools"; +import { VscodeTools } from "./ui/Tools"; export async function activate(context: ExtensionContext): Promise { // Use the console to output diagnostic information (console.log) and errors (console.error) @@ -126,8 +126,7 @@ export async function activate(context: ExtensionContext): Promise instance, customUI: () => new CustomUI(), deployTools: DeployTools, evfeventParser: parseErrors, - tools: Tools, - vscodeTools: VscodeTools, + tools: VscodeTools, componentRegistry: extensionComponentRegistry }; } diff --git a/src/filesystems/local/deployTools.ts b/src/filesystems/local/deployTools.ts index 638cef4d5..070df5317 100644 --- a/src/filesystems/local/deployTools.ts +++ b/src/filesystems/local/deployTools.ts @@ -4,7 +4,7 @@ import vscode, { Uri, WorkspaceFolder } from 'vscode'; import { instance } from '../../instantiate'; import { LocalLanguageActions } from './LocalLanguageActions'; import { Deployment } from './deployment'; -import { VscodeTools } from '../../ui/vscodeTools'; +import { VscodeTools } from '../../ui/Tools'; import { DeploymentMethod } from '../../api/types'; import { DeploymentParameters } from '../../typings'; diff --git a/src/filesystems/local/git.ts b/src/filesystems/local/git.ts index 194bc5dc3..b53bcc206 100644 --- a/src/filesystems/local/git.ts +++ b/src/filesystems/local/git.ts @@ -3,7 +3,7 @@ import { getBranchLibraryName } from "./env"; import { instance } from "../../instantiate"; import IBMi from "../../api/IBMi"; import IBMiContent from "../../api/IBMiContent"; -import { VscodeTools } from "../../ui/vscodeTools"; +import { VscodeTools } from "../../ui/Tools"; import { ConnectionConfig } from "../../api/configuration/config/ConnectionManager"; const lastBranch: { [workspaceUri: string]: string } = {}; diff --git a/src/filesystems/qsys/FSUtils.ts b/src/filesystems/qsys/FSUtils.ts index c392dfeb2..0553c63de 100644 --- a/src/filesystems/qsys/FSUtils.ts +++ b/src/filesystems/qsys/FSUtils.ts @@ -1,6 +1,6 @@ import path from "path"; import vscode, { l10n } from "vscode"; -import { VscodeTools } from "../../ui/vscodeTools"; +import { VscodeTools } from "../../ui/Tools"; import IBMi from "../../api/IBMi"; import { ReconnectMode } from "../../api/configuration/config/ConnectionManager"; diff --git a/src/sandbox.ts b/src/sandbox.ts index 92a810578..32c716fa9 100644 --- a/src/sandbox.ts +++ b/src/sandbox.ts @@ -3,7 +3,7 @@ import querystring from "querystring"; import { commands, ExtensionContext, l10n, Uri, window } from "vscode"; import { instance } from "./instantiate"; import { ConnectionData } from "./typings"; -import { VscodeTools } from "./ui/vscodeTools"; +import { VscodeTools } from "./ui/Tools"; import IBMi from "./api/IBMi"; export async function registerUriHandler(context: ExtensionContext) { diff --git a/src/testing/deployTools.ts b/src/testing/deployTools.ts index 4f246074e..11307f57e 100644 --- a/src/testing/deployTools.ts +++ b/src/testing/deployTools.ts @@ -10,7 +10,7 @@ import { Tools } from "../api/Tools"; import { DeployTools } from "../filesystems/local/deployTools"; import { instance } from "../instantiate"; import { Action, DeploymentMethod } from "../typings"; -import { VscodeTools } from "../ui/vscodeTools"; +import { VscodeTools } from "../ui/Tools"; import { runAction } from "../ui/actions"; type FileInfo = { diff --git a/src/typings.ts b/src/typings.ts index 99ebb446f..ae873c008 100644 --- a/src/typings.ts +++ b/src/typings.ts @@ -7,15 +7,14 @@ import { ObjectFilters } from './api/configuration/config/ConnectionManager'; import { DeploymentMethod, FileError, IBMiMember, IBMiObject, WithPath } from "./api/types"; import { Ignore } from "ignore"; import { WorkspaceFolder } from "vscode"; -import { VscodeTools } from "./ui/vscodeTools"; +import { VscodeTools } from "./ui/Tools"; export interface CodeForIBMi { instance: Instance, customUI: () => CustomUI, deployTools: typeof DeployTools, evfeventParser: (lines: string[]) => Map, - tools: typeof Tools, - vscodeTools: typeof VscodeTools, + tools: typeof VscodeTools, componentRegistry: ComponentRegistry } diff --git a/src/ui/vscodeTools.ts b/src/ui/Tools.ts similarity index 90% rename from src/ui/vscodeTools.ts rename to src/ui/Tools.ts index 2f91f7c45..389465cad 100644 --- a/src/ui/vscodeTools.ts +++ b/src/ui/Tools.ts @@ -3,9 +3,9 @@ import Crypto from 'crypto'; import { readFileSync } from "fs"; import vscode, { MarkdownString } from "vscode"; import { API, GitExtension } from "../filesystems/local/gitApi"; -import { Tools } from '../api/Tools'; import { IBMiObject, IBMiMember, IFSFile } from '../typings'; import IBMi from '../api/IBMi'; +import { Tools } from '../api/Tools'; let gitLookedUp: boolean; let gitAPI: API | undefined; @@ -198,4 +198,19 @@ export namespace VscodeTools { return `Unknown`; } } + + // These are exported to not break the API from 'the great re-write'. + export const qualifyPath = Tools.qualifyPath; + export const unqualifyPath = Tools.unqualifyPath; + export const escapePath = Tools.escapePath; + export const distinct = Tools.distinct; + export const capitalize = Tools.capitalize; + export const sanitizeObjNamesForPase = Tools.sanitizeObjNamesForPase; + export const parseMessages = Tools.parseMessages; + export const parseQSysPath = Tools.parseQSysPath; + export const fileToPath = Tools.fileToPath; + export const fixWindowsPath = Tools.fixWindowsPath; + export const parseAttrDate = Tools.parseAttrDate; + export const normalizePath = Tools.normalizePath; + export const resolvePath = Tools.resolvePath; } \ No newline at end of file diff --git a/src/ui/diagnostics.ts b/src/ui/diagnostics.ts index 598080502..3a08dfd82 100644 --- a/src/ui/diagnostics.ts +++ b/src/ui/diagnostics.ts @@ -4,7 +4,7 @@ import { FileError } from "../typings"; import Instance from "../Instance"; import { getEvfeventFiles } from "../filesystems/local/actions"; import { parseErrors } from "../api/errors/parser"; -import { VscodeTools } from "./vscodeTools"; +import { VscodeTools } from "./Tools"; import IBMi from "../api/IBMi"; const ileDiagnostics = vscode.languages.createDiagnosticCollection(`ILE`); diff --git a/src/ui/views/LibraryListView.ts b/src/ui/views/LibraryListView.ts index e29c54d38..8f32f3433 100644 --- a/src/ui/views/LibraryListView.ts +++ b/src/ui/views/LibraryListView.ts @@ -1,7 +1,7 @@ import vscode, { commands, l10n } from "vscode"; import { instance } from "../../instantiate"; import { IBMiObject, WithLibrary } from "../../typings"; -import { VscodeTools } from "../vscodeTools"; +import { VscodeTools } from "../Tools"; import { ConnectionConfig } from "../../api/configuration/config/ConnectionManager"; import IBMi from "../../api/IBMi"; diff --git a/src/ui/views/debugView.ts b/src/ui/views/debugView.ts index 3033403df..d062c567d 100644 --- a/src/ui/views/debugView.ts +++ b/src/ui/views/debugView.ts @@ -4,7 +4,7 @@ import { checkClientCertificate, debugKeyFileExists, remoteCertificatesExists } import { DebugConfiguration, getDebugServiceDetails, SERVICE_CERTIFICATE } from "../../api/configuration/DebugConfiguration"; import { DebugJob, getDebugServerJob, getDebugServiceJob, isDebugEngineRunning, readActiveJob, readJVMInfo, startServer, startService, stopServer, stopService } from "../../debug/server"; import { instance } from "../../instantiate"; -import { VscodeTools } from "../vscodeTools"; +import { VscodeTools } from "../Tools"; import { BrowserItem } from "../types"; const title = "IBM i debugger"; diff --git a/src/ui/views/ifsBrowser.ts b/src/ui/views/ifsBrowser.ts index f9ea0dc00..08d379bf5 100644 --- a/src/ui/views/ifsBrowser.ts +++ b/src/ui/views/ifsBrowser.ts @@ -8,7 +8,7 @@ import { Search } from "../../api/Search"; import { Tools } from "../../api/Tools"; import { instance } from "../../instantiate"; import { FocusOptions, IFSFile, IFS_BROWSER_MIMETYPE, OBJECT_BROWSER_MIMETYPE, SearchHit, SearchResults, WithPath } from "../../typings"; -import { VscodeTools } from "../vscodeTools"; +import { VscodeTools } from "../Tools"; import IBMi from "../../api/IBMi"; import { BrowserItem, BrowserItemParameters } from "../types"; diff --git a/src/ui/views/objectBrowser.ts b/src/ui/views/objectBrowser.ts index 3662509ab..01a86017e 100644 --- a/src/ui/views/objectBrowser.ts +++ b/src/ui/views/objectBrowser.ts @@ -11,7 +11,7 @@ import { getMemberUri } from "../../filesystems/qsys/QSysFs"; import { instance } from "../../instantiate"; import { CommandResult, FilteredItem, FocusOptions, IBMiMember, IBMiObject, MemberItem, OBJECT_BROWSER_MIMETYPE, ObjectItem, WithLibrary } from "../../typings"; import { editFilter } from "../../webviews/filters"; -import { VscodeTools } from "../vscodeTools"; +import { VscodeTools } from "../Tools"; import { DefaultOpenMode, ObjectFilters } from "../../api/configuration/config/ConnectionManager"; import { BrowserItem, BrowserItemParameters } from "../types"; diff --git a/src/webviews/settings/index.ts b/src/webviews/settings/index.ts index 05845af93..dcd70b78f 100644 --- a/src/webviews/settings/index.ts +++ b/src/webviews/settings/index.ts @@ -8,7 +8,7 @@ import { isSEPSupported } from "../../debug/server"; import { extensionComponentRegistry } from "../../api/components/manager"; import { instance } from "../../instantiate"; import { ConnectionData, Server } from '../../typings'; -import { VscodeTools } from "../../ui/vscodeTools"; +import { VscodeTools } from "../../ui/Tools"; import IBMi from "../../api/IBMi"; import { ConnectionConfig, ConnectionManager } from "../../api/configuration/config/ConnectionManager"; import { deleteStoredPassword, getStoredPassword, setStoredPassword } from "../../config/passwords";