Skip to main content

module analysis::diff::edits::FileSystemChanges

rascal-Not specified

Usage

import analysis::diff::edits::FileSystemChanges;

data FileSystemChange

Representing file (and directory) change events.

data FileSystemChange  
= removed(loc file)
| created(loc file)
| renamed(loc from, loc to)
| changed(loc file)
;

A File System Change describes what happened, or what will happen, to a file or directory:

FileSystemChanges are an intermediate contract between the sources and the targets of changes to files and directories on a file system. Typical sources are watch or source-to-source refactoring tools like "rename". Typical targets are preview UI and patch execution tools in the UI or on the commandline, or the listeners of watch that can trigger incremental re-compilation or re-loading features.

The location scheme which is passed to the respective constructors of File System Change must have the Watching and Writing IOCapability. Otherwise IO errors can be expected.

For detailed changes within files, see Text Edits.

Benefits

  • Implementations of file watchers can use FileSystemChange to report what happened.
  • Implementations of file and directory diff tools can represent the differences using File System Change

Pitfalls

  • To represent the internal differences of files, have a look at Text Edits instead.
  • Note that the concept of "file", as used here in the fields names of File System Change, includes "directories". This is because directories are indeed a kind of files from the OS perspective, and because it allows us to unify the two concepts here.