Skip to content

Conversation

rlivings39
Copy link
Member

@rlivings39 rlivings39 commented May 5, 2023

Here's an initial attempt at outline support for mathworks/MATLAB-extension-for-vscode#1

This has a few responsiveness bugs I need to investigate, so please don't actually merge yet. Still I wanted to get some initial feedback.

Some bits of feedback I'd like to hear about:

  • Is this the right location? It feels navigation-related so I put it there. I could also imagine making a separate provider folder like symbols or structure.
  • I've tried to integrate well with the MATLAB startup option. Editors make requests for document symbols very frequently so I chose to make the document symbol request not trigger a MATLAB start with onDemand as mentioned in my comment.
  • One UX issue I didn't immediately see how to solve is: suppose you have A.m and foo.m open at VSCode launch. The documentSymbol request fires and since MATLAB hasn't started, we don't have any code index info yet. Right now I just return empty. It would be nice if I could wait on a promise or something for files to be indexed and then immediately return a response once the system is up and running. Any ideas on whether or not there's anything in the existing server that I could leverage for this?

Here's a screenshot of this in action:

image

Things left to do

  • Fix handling of classdef folders
  • Look into apparent stale data showing up with classdefs
  • Look at responsiveness for already opened files. Wait on MATLAB connection. Ensure promises don't stack up.
@rlivings39 rlivings39 requested a review from dklilley May 5, 2023 20:25
Copy link
Member

@dklilley dklilley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good so far!

I think navigation is the correct location for this. We can always pull it out into a symbols or structure grouping as we add more functionality, but currently it feels similar to the navigation-related functionality.

I also agree with using getMatlabConnection instead of getOrCreateMatlabConnection for your stated reasons.

For your third point - I don't think we have the ability to correctly handle returning a promise currently. I believe some refactoring will need to happen before that is possible.

@dklilley
Copy link
Member

dklilley commented May 9, 2023

Can you also add an entry to the list in the README for document symbol support?

@zm-cttae
Copy link

zm-cttae commented May 10, 2023

Does this work with mpm.m (multiple functions) and also a datastorage.m hugefile?

Is performance and resource consumption acceptable?

Is there:

  • variable assignment symbols
  • anonymous function support
  • block keyword support
@rlivings39
Copy link
Member Author

Can you also add an entry to the list in the README for document symbol support?

Done

@rlivings39 rlivings39 marked this pull request as ready for review May 12, 2023 10:06
@rlivings39
Copy link
Member Author

@zm-cttae Thanks for the feedback! Can you please point us to the paths for mpm.m and datastorage.m you have in mind and in what MATLAB release you're finding them? The versions I found in R2023a didn't seem right as mpm.m only had help comments.

Good design questions too. Those are good considerations for us for the future. Which block keywords did you have in mind?

@rlivings39
Copy link
Member Author

@zm-cttae Thanks! Those test cases seem to work well.

Noted on the request for loops, etc.

@rlivings39 rlivings39 changed the title Initial attempt at outline support documentSymbol / outline support May 12, 2023
@dklilley dklilley self-assigned this May 12, 2023
@dklilley dklilley merged commit be6ecd6 into mathworks:main May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants