sgwilym / nova-deno

A Deno extension for Nova.
https://extensions.panic.com/extensions/co.gwil/co.gwil.deno/
MIT License
13 stars 1 forks source link

Using a Deno tests sidebar #42

Open belcar-s opened 2 years ago

belcar-s commented 2 years ago

This pull request is based on my two other branches: minimal-changes and excessive-reloading. I can rebase it if those changes are rejected. If they aren’t rejected, though, doing so is not a good idea; it would involve tons of conflict resolution (I think?) that would later need to be reversed. (The commit history and diffs in this page would supposedly be updated if the other pull requests were merged.)

Like last time, icons are missing. We need a test_sidebar_large, a test_sidebar_small and a run. The run is for the Run All button. I think an icon is better than a label, but we can use a label if that's preferred :).

https://user-images.githubusercontent.com/73370025/175392362-cb580c7a-4f6a-404c-802d-74d5bfc5f61b.mp4

The above video showcases an older version of the feature. In the current version, a warning is shown the first time the user runs tests in each workspace. The notification that is displayed after three seconds of the tests running could become annoying; it would be good to allow it to be disabled.

Changes unique to this pull request begin at Define the sidebar.

belcar-s commented 2 years ago

warning symbol

I don't know how to use this RegExp, which I found in the doowb/ansi-colors source code, without committing copyright infringement/becoming a criminal, and getting sent to jail.

/[\u001b\u009b][[\]#;?()]*(?:(?:(?:[^\W_]*;?[^\W_]*)\u0007)|(?:(?:[0-9]{1,4}(;[0-9]{0,4})*)?[~0-9=<>cf-nqrtyA-PRZ]))/g

It's seemingly licensed MIT. Do I add the thing to the LICENSE file, or is it OK to add the disclaimer next to the copied line? Sorry 🙁.

belcar-s commented 2 years ago

Wow! This is nearly done. I think I overestimated the difficulty. (Watch me turn out incapable of doing the rest 🙂.)

Note that we currently obtain the test results by parsing the logging produced by Deno, which must be prone to change. I'd love to know of a better way to do this.

Things remaining:

Ideas:

belcar-s commented 2 years ago

The Deno process's exit code upon failure is the same, regardless of whether the issue is a test's failure or failure to run tests. I can't think of an easy way, for example, of detecting the lack of a needed import map and notifying the user about it.

belcar-s commented 2 years ago

It might have been a bad idea to squash the changes from the other branches into 247786bcee22a3e1d29695b0e14ee2d53cec4d5c because I think that the commit will be kept now. I don't know how to undo that 🙁.

Outdated; this was fixed in 7143d463c338f0d5f6128d3a230e17d47fd5ab9f I've also been seeing these error messages: An error message reads 'Extension Error. The extension Deno encountered an error the last time Nova was open. Do you want to disable it?  You can enable it again in the Extensions preferences. An error message has the title 'Extension Service Quit Unexpectedly'. Below, three paragraphs read 'An issue with one or more extensions caused the service to terminate. As a result, all extensions will need to reload. The following extensions were executing when the crash occurred: • Deno (co.gwil.deno) You may optionally disable extensions until the next application launch.' It's a little bit bad. I haven't been able to find any logging about the issue, so it's hard to debug. It happens immediately after activation and only in workspaces that aren't associated to a folder (those that appear when you press ⇧⌘N).

In regard to the hidden section above, see https://devforum.nova.app/t/a-fun-new-way-to-crash-the-extension-service/1682.

belcar-s commented 2 years ago

I'm going to try to make it show test results as they come, and I'll make it notify that tests couldn't be run even if the attempt was made through a context menu.

belcar-s commented 2 years ago

The particular change I made in order to enable the first of those two things made test-running much slower, and I'm not really so enthusiastic about trying again, so I'll leave that as it is 🙃.