paulo-fernando-silva / vscOctaveDebugger

MIT License
35 stars 4 forks source link

local variables does not show dimensions? #32

Closed TaiPhamD closed 4 years ago

TaiPhamD commented 4 years ago

I remember when I first started using this a few days the local variable shows the dimensions but now it doesn't .

Screen Shot 2020-04-18 at 12 18 37 AM

Any idea how i can get the local variables to show the dimensions?

paulo-fernando-silva commented 4 years ago

Hi TaiPhamD, can you post some sample code that leads to this behavior? Thanks

TaiPhamD commented 4 years ago

I created a simple test .m script and the dimensions appear to be working correctly. The code that has this problem is ex5.m (Week 6 hw) from Andrew Ng's ML learning class on Coursera. I am don't think I can post that HW code online since I think coursera has the copy right on that. Let me try to see what's different about that code that's causing this issue and maybe I can post it. Alternatively, since this course is free from coursera perhaps you can jump directly to week6 and download the hw.zip?

TaiPhamD commented 4 years ago

ahh it seems to break when you load the matrix from a .mat file? When I declare the variables locally it is fine but after i load a .mat file it has problems.

Screen Shot 2020-04-18 at 12 37 05 AM Screen Shot 2020-04-18 at 12 37 13 AM
paulo-fernando-silva commented 4 years ago

ic. There's a couple of things going on here. First the matrix size is only shown when the number of elements is large - which is the same as saying 100 elements times prefetchCount, or 100 by default. The variables loaded from the .mat file are less than 100 elements so the value of each element will be shown instead. However, since these are nx1 vectors it'll only show the first element. To see the entire column you have to hover with the mouse. I implemented it like that as that's how octave would display them. But I guess I could display column and row vectors in the same way... Will have to think about it. 🤔

paulo-fernando-silva commented 4 years ago

It's also possible that it's preferable to show the size instead of the value. I guess I can add a switch to the launch configuration to support that. How does it sound?

TaiPhamD commented 4 years ago

I think that would be a great feature to add I as an option to always show dimension . While working in these code it’s very helpful for me to quickly know if the variable is a row or column vector or if it’s a matrix. I’ve been manually typing size in the debugger to get this info.

Also, thank you very much for making this plugin . I use octave on macos and the QT GUI is so buggy on macos (probably other Os too) so having this tool in visual studio code has been great to work with !

paulo-fernando-silva commented 4 years ago

Thanks. I'm glad the plugin is useful. 😃

I was thinking about it and remembered that you can always check the size and type of the variable if you move the mouse over the variable name. Did you try that? Would that be enough?

TaiPhamD commented 4 years ago

yes I tried the hover feature (didn't know it existed) and it's a lot more convenient than me typing size() to check. This is good enough for me. Thank you!

paulo-fernando-silva commented 4 years ago

Great. Thanks.