Skip to content

[meta] Code health for filesystem interaction. #8801

Closed
@ericsnowcurrently

Description

@ericsnowcurrently

TODO: maybe move the list of tasks to a wiki page?

Tasks

filesystem:

  • identify all current filesystem usage
    • find direct usage
      • (#7519) fs module
      • (#7519) fs-extra module
    • find indirect usage
      • (#7519) tmp module
      • (#7519) glob module
      • ...
    • there are probably some we have missed
  • consolidate all filesystem usage into IFileSystem (src/client/common/platform/filesystem.ts)
    • (#7519) add ... to IFileSystem
      • implement
      • update call sites
    • ...
    • drop unused methods from IFileSystem (and friends)
      • (#7519) pathExistsSync()
      • ...
    • how to deal with third-party modules that use the filesystem directly?
  • ensure we keep using only our wrapper in the future
    • how to keep from accidentally using the filesystem directly?
  • use the new vscode.workspace.fs API (see [meta] Use the vscode filesystem API for *all* filesystem operations. #8533)
  • improve testability (and other cleanup)
    • (#7519) factor out TempFileSystem for tmp file/dir ops (i.e. as a wrapper around the node tmp module)
    • (#7519) factor out RawFileSystem
    • (#7519) factor out FileSystemUtils from FileSystem (and use RawFileSystem in it)
    • eliminate IFileSystem in favor of IFileSystemUtils (incl. its raw property)

paths:

  • improve testability (and other cleanup)
    • move IPathUtils from src/client/common/types.ts to src/client/common/platform/types.ts
    • (#7519) factor out FileSystemPaths as wrapper around 'path' module
    • rename src/client/common/platform/pathutils.ts to fspaths.ts
    • move FileSystemPaths there (for the low-level operations)
    • rename PathUtils to FileSystemPathUtils (for high-level operations)
    • move low-level operations to IFileSystemPaths
      • separator -> sep
      • delimiter
      • basename()
    • move high-level operations to IFileSystemPathUtils
      • arePathsSame()
    • add IFileSystemPathUtils.raw to expose FileSystemPaths
  • identify all current node path module usage
  • consolidate all fs path operations into FileSystemPathUtils & raw (see [meta] Consolidate filesystem path operations. #8541)
    • how to deal with third-party modules that use node's "path" module directly?
  • ensure we keep using only our wrapper in the future (see [meta] Consolidate filesystem path operations. #8541)
    • how to keep from accidentally using node's "path" module directly?

other:

  • clean up (particularly for testability)
    • move IsWindows from src/client/common/types.ts to src/client/common/platform/types.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-internalLabel for non-user facing issuesdebtCovers everything internal: CI, testing, refactoring of the codebase, etc.metaIssue that is tracking an overall project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions