refactor and error handling

refactored a bit similar to the setup of markdown-preview plugin. added done to workspace open to handle running once view exists. added in error handling to pass to view if error