-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for ClojureScript Quick Start path bug #2326
Fix for ClojureScript Quick Start path bug #2326
Conversation
✅ Deploy Preview for calva-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@PEZ One thing I want to highlight is the outcome of side effects. I've tested on windows, but since I don't have the domain knowledge to assess the impact on either different windows platforms or other operating systems, I would suggest ensuring that this change doesn't break other assumptions from said platforms.
We know the types, but the remaining question in my mind is, "Are there any formats that these types come in that worked previously but may be broken with these new changes?" My assumption is no, but I will defer to you experience to make that judgement. |
@@ -69,7 +69,8 @@ async function fetchConfig(configName: string): Promise<DramConfig> { | |||
|
|||
async function downloadDram(storageUri: vscode.Uri, configPath: string, filePath: string) { | |||
const downloadUrl = `${dramsBaseUrl()}/${configPath}/${filePath}`; | |||
const dirUri = vscode.Uri.joinPath(storageUri, path.join(...path.dirname(filePath).split(/\//))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have had a lot of problems with this category of mistakes. Most oft them we have found, but this one was still lurking in there! (I think we may still have some places undiscovered.)
@@ -84,13 +85,9 @@ export async function downloadDrams( | |||
) { | |||
await Promise.all( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: Consider returning the promise instead of awaiting it. Similar to how we shouldn't have catched the error here, I think it makes sense to push the promises out and up as close to the user as possible.
Thanks for helping with improving Calva! 🙏 ❤️. Code looks great. I will try it on my Mac just to make sure I am understanding the issue correctly. We could consider adding this to the end-to-end tests. What speaks against it is that the tests are already dependent on a lot of external things and this would add more of that. |
It still works on my Mac. (Or course it does!) Good points about validation of the inputs there. At the moment we have full control of the whole chain, but my ambition is that more people will contribute drams (the configurations behind those Quick Start experiences) and then it will be very good to remember to help with that by validating inputs and generating good error messages. |
## [2.0.391] - 2023-10-11 | ||
|
||
- Fix: [Allowing dram download to fail vocally for user. Fixing a JS join path error](https://github.com/BetterThanTomorrow/calva/issues/2325) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was reviewing a bit too fast. This entry should not have a date, nor a version. It should remain just Unreleased. But no worries, I fixed it on the dev
branch.
What has changed?
More explanation is provided below the checklist.
Fixes #2325
My Calva PR Checklist
I have:
dev
branch. (Or have specific reasons to target some other branch.)published
. (Sorry for the nagging.)[Unreleased]
entry inCHANGELOG.md
, linking the issue(s) that the PR is addressing.npm run prettier-format
)npm run eslint
before creating your PR, or runnpm run eslint-watch
to eslint as you go).Ping @PEZ, @bpringe, @corasaurus-hex, @Cyrik
Why is this happening?
This issue was uncovered in a huddle session less than an hour ago at time of writing. Explanations to follow.
Why isn't it showing an error to the user?
It's not showing an error to the user because the exception that is (presumably) thrown is being caught and silently logged to a console that (I think) isn't exposed to the user. Specifically, this line.
calva/src/nrepl/repl-start.ts
Line 91 in 57a24c8
Why isn't the command behaving as expected?
The command isn't working because of nuances with javascript's join behavior. Look at this line.
calva/src/nrepl/repl-start.ts
Line 72 in 57a24c8
When javascript joins these lines it results in code such as
src\\hello_world
instead of the desiredsrc/hello_world
. This is an invalid directory format, so the directory cannot be created! Thus when trying to act on these assumed created files, the function will throw an exception that is silently caught.What is the solution?
The solution is twofold. First, remove the catch so that this error bubbles up and notifies the user. Second, remove the join since it's not needed to build the path connection for the file creation location; as follows.