Skip to content
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

Rework how the project directory is determined for jack-in and connect #275

Merged
merged 15 commits into from Aug 12, 2019

Conversation

@PEZ
Copy link
Collaborator

PEZ commented Aug 7, 2019

First we try find the workspace root, then we add custom sub dir

Hello, can you review this fix of getProjectDir() for me? It is not supposed to add any fancy new possibilities, just fix so that a custom project root (sub directory) should work in more cases. It is a very central function so I'd appreciate an extra brain on it. Cheers!

First we try find the workspace root, _then_ we add custom sub dir
@PEZ PEZ requested a review from kstehn Aug 7, 2019
@PEZ

This comment has been minimized.

Copy link
Collaborator Author

PEZ commented Aug 7, 2019

Please merge it if you think it is good enough. 😄

Copy link
Contributor

kstehn left a comment

Looks good.
But i think i found a problem , and it might be the reason why i thought this is buggy.

When you Jack-In the Terminal says "Executing task in folder ...."
After that i always canceled the process. This time i just let it run and it is the right Project.
But i have no idea where that might happen

@PEZ

This comment has been minimized.

Copy link
Collaborator Author

PEZ commented Aug 8, 2019

I think I might have been using the wrong constructor overload for the Task all this time. Fixed that now. Can you try and see if it fixes the problem? If so we should have a much more reliable jack-in for projects not in the workspace root now.

PEZ added 3 commits Aug 9, 2019
Removes `projectRootDir` setting and uses this logic instead:

1. If there is no file open. Stop and complain.
2. If there is a file open, use it to determine the project root
by looking for project files from the file's directory and up to
the window root (for plain folder windows) or the file's
workspace folder root (for workspaces) to find the project root.
Return
1. the window root for plain folders
2. first workspace root for workspaces.
calva/connector.ts Outdated Show resolved Hide resolved
@kstehn

This comment has been minimized.

Copy link
Contributor

kstehn commented Aug 9, 2019

Also like we discussed to remind you, add some documentation to the function that you are currently working on :).

@PEZ PEZ added this to Backlog in CT 2019 Q3 via automation Aug 10, 2019
@PEZ PEZ changed the title Apply custom project root last Rework how the project directory is determined for jack-in and connect Aug 10, 2019
@PEZ

This comment has been minimized.

Copy link
Collaborator Author

PEZ commented Aug 10, 2019

Now I have made the project root something we need to initialize as the start of the jack-in and (standalone) connect processes. When the path is actually needed, this initialized value will be used. Should be both more efficient and less error prone.

I also added that doc string, finally. 😄 Which was a very good thing to add, because the way I had phrased the strategy used... It made me realize that this new way of finding the project files isn't implementing that strategy! This will now fail for the ”plain” folder, multi-project case. (I haven't tested that yet, but I am pretty certain.) Committing this anyway, so that I can get your help with sanity checking the general change for init-then-use.

Will restore the old new way of finding the project files now. Then, maybe, this is closing in on being ready to merge.

@PEZ

This comment has been minimized.

Copy link
Collaborator Author

PEZ commented Aug 10, 2019

This now works for the plain folder multi project case. I've tested it with Leiningen, Clojure CLI and shadow-cljs. An inconvenience is that Calva remembers the jack-in and connect picker selections per workspace which can be confusing and trick people to accept the wrong defaults. I think we should fix that before shipping. What say you?

I'll make some tests with a real workspace now. Please put it to a test on your side as well.

@PEZ PEZ moved this from Backlog to In progress in CT 2019 Q3 Aug 10, 2019
@PEZ

This comment has been minimized.

Copy link
Collaborator Author

PEZ commented Aug 10, 2019

VSIX package built and sent to calva-dev in Clojurians Slack. Let's give it a day or two. If no one reports a problem, then merge! 😄

@kstehn kstehn merged commit 66dc266 into master Aug 12, 2019
@PEZ PEZ deleted the fix-custom-project-root branch Aug 12, 2019
@PEZ PEZ moved this from In progress to Done in CT 2019 Q3 Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
CT 2019 Q3
  
Done
2 participants
You can’t perform that action at this time.