file operations; focus blurred a bit and added/fixed a few other things

also see fiug.dev - 2021-06-14 video

file operations have migrated to the service worker and are now fully unit-tested within fiug. These are operations that create, read, update, delete (CRUD) files and folders. CRUD opartions used to be handled in a somewhat half-hazard way in the core of the app. Now they have moved to service worker where they are cleaned up and modularized. This functionality is fully unit-tested within fiug using qUnit in a barebones fashion. I’m pleased with how much running and writing unit tests within fiug closely resembles testing in VS Code with mocha or jest.

File operations have been a bane to me in the past. I think it’s impossible and/or very frustrating to do this sort of thing correctly while targeting a user interface; unit tests are a much better target at least at first. I can safely say that this is behind me minus some edge cases that I don’t think it’s wise to tackle right now.

git supports operations mentioned above. This means the changes you make in fiug will persist to your github repository when you push a commit.

preview has shifted from being a terminal menu item to being a terminal command that is invoked. Previously I was thinking of preview as something triggered by selecting it in the UI. Recently, I have shifted the way I think about developing fiug to a terminal-first approach. I shifted preview to a terminal execution model and that means I don’t have to answer some of the questions relating to an “always on” or “always available” model. This means that preview was rewritten to be a command that is invoked in the terminal and events are only monitored when preview is running.

terminal has moved to an iframe versus a module. I will probably do this with all of the core UI components. Settling on abstractions that make sense is a pain… That said, I think iframes offer the right degree of separation from the rest of the application for now. Maybe some day I will switch to web components. I am happy to speak at length about what all this means for terminal, but I will forgo writing about it for now.

editor state refers to tracking and restoring things like history and scroll position. I already had written a codemirror plugin for this, but it was disabled because it was buggy. Now it’s enabled and a little less buggy.

mini-map was added and is mostly done, but it’s still a little buggy.

context menu items were connected where possible and hid otherwise (versus being disabled). There were a few casualities where functionality steps backwards, but I’m not terribly concerned about those right now.

Changes

  • version (status bar and terminal) comes from package.json
  • changes in queue are reflected in file store after commit
  • delete for commits (because add already works)
  • file content as expected after move/copy operations
  • files in change queue are modified when operations occur
  • file (like .keep) don’t show up as ready for commit
  • command palette file find -> preview issues
  • sw freaks and app doesn’t crash well:
    • with dragging a file from one new folder to another new folder
  • rename file and folder need to be verified
  • paths which include “..” or “.” work for all commands
  • cp command works properly for files
  • cp command works properly for folders
  • terminal commands do not terminate properly
  • .keep files seem to not be created for new folder
  • cp is not present in terminal
  • mv command works properly for files
  • mv command works properly for folders
  • preview help documentation
  • preview should support wildcards, ie. *.md
  • preview with no arguments should preview current file (like old preview)
  • context menu for editor
  • preview as a terminal command vs a menu item
    • preview should honor selected file when service switched (may not do this)
  • rm command works properly for folder
  • editor tabs: on file delete, close tab (and switch editor)
  • service name issues with path in terminal
    • should not be able to cd lower than serviceName when service is loaded
    • cd /path should translate into serviceName/path
  • git diff at root is messed up
  • ls command needs to use the folder it was passed versus current state
  • tab doesn’t appear sometimes even though editor loads
  • terminal watch mode for js files
  • recall scroll position when markdown preview (for example) updates
  • hook up editor context menu
  • markdown preview recall scroll position
  • clicking on a search result opens file at that line
  • base href in html, added in service worker
  • md/mkdir command works properly
  • syntax highlight broken with editor updates/revert
  • re-enable/fix editor updates from past
    • editor document state
  • cd ../sibling results in parent//sibling (at 1 up from root)
  • terminal has its own cwd not dependent on app cwd
  • cat command works properly
  • better code fold behavior (gutter hover)
  • rm command works properly for file
  • touch command works properly
  • cd into parent/child results in going parent/parent/child
  • cd to / (root) then git commit/diff mess up
  • editor tabs close others, close all
  • explorer: fix new folder/file icons
  • when file is selected for preview, use full path of file
  • on commit, update file and changes stores
  • git commit should offer message on success/fail
  • something is messed up about cwd from app (esp for files at root)
  • tabs don’t trigger editor properly
    • this specifically occurs with bartokv0.4.3.md
    • also occurs in other situations
    • switch services and come back (seems to trigger this)