-
Notifications
You must be signed in to change notification settings - Fork 117
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
Always convert to absolute path before calculating diff #211
Always convert to absolute path before calculating diff #211
Conversation
I used this StackOverflow answer to implement path conversion, but it seems to me that the current diffing logic already does the job of the |
Code-wise, this looks alright! I'd have to write a few tests to really understand what currently goes wrong, and how this fixes it though. Maybe you could provide some info on this. |
This one is a bit hard to test, since it fixes a weird issue that occurs when dealing with workspaces, demonstrated by @h-michael's example project. Basically all the bindings would be correctly exported to the I've been testing against that, and I recall being sucessful on Friday, though today it seems the imports in |
Ah, awesome, missed that test repository! I think now I understand the issue! |
Let me know if you get stuck, happy to take a look at it. |
I think I know what the problem is, but I'm still not quite sure how to solve it.
All the export paths are relative to their respective |
I have found that the command |
In @h-michael's case, all of his exports would be |
Another issue with this approach: the command returns a json string (
|
There's I guess we should decide if we want to make everything relative to the workspace root. It's probably the better choice, but, as you mentioned, might be bothersome to the users. I'm not sure how big of a deal this would be, since the current state is somewhat broken anyway. That being said, I think we could also fix the current implementation. I'm not 100% sure yet how, but: I guess I'd be fine with either option, but this is probably something we want to put some thought into. |
Just checked, you're right, that gives the path in plaintext
This seems really hard to do. When |
We should also add |
I might not have thought this through 100%, but wouldn't this work?
Probably a good idea, though that might end up in stderr, idk |
As far as I've been able to test/understand (which, to be honest, is not very far), this doesn't work because when Again, I haven't completely wrapped my head around this quite yet, so I may very well be wrong, but it looks like this is what's happening |
I haven't tried anything using this. That might actually work |
I tried this today, and after a few failed attempts with commically incorrect results I actually got it to work, but it does require cleaning up the paths with something like |
|
@NyxCode, I think we have four options here
|
@escritorio-gustavo Awesome, thank you so much for the research on this. Let's say my crate I'd really like a solution which works for both workspaces and the scenario I just described. |
Oh sorry, I missed this bit of #177
Which made me think it was about the |
Thanks, due to the fact that this whole problem relies on having multiple crates involved I'm really struggling to come up with a way to test it |
Still... can't |
Something like this: #[derive(TS)]
#[ts(export)]
pub struct LibraryTypeDef {
pub a: i32
}
pub struct MyStruct {
#[ts(as = "LibraryTypeDef")]
pub foo: other_crate::LibraryType
} |
Absolutely, that'd work as a workaround. But If |
It really would be nice, but should library code in |
Convert
path
andbase
into absolute paths before diffing the twoFixes #111