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

Adding code snippets #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

aminya
Copy link

@aminya aminya commented Jan 26, 2020

Code snippets and auto-complete using https://github.com/aminya/Matlab-Snippets - A full collection converted from official JSON files

@aminya aminya force-pushed the autocomplete branch 9 times, most recently from 7a82b9a to 714266a Compare January 26, 2020 10:26
Code snippets and auto-complete using 
https://github.com/aminya/Matlab-Snippets - A full collection converted 
from official JSON files
@thedavidprice
Copy link
Owner

@aminya This looks really interesting! Great work and thank you for adding the PR.

@rlivings39 Could you take a look at this when you have some availability? In general looks good, but I haven’t taken it for a spin nor dug fully through the src yet.

@aminya
Copy link
Author

aminya commented Feb 2, 2020

The only limitation is that only one all-in-one snippet is generated for each function that has all the possible arguments (if there where two possibilities to chose, 1st one is chosen).

To have multiple snippets (more compact than all-in-one snippet), I should probably parse Matlab documentation of each function online and then extract the first few lines.

@rlivings39
Copy link
Collaborator

Looks cool. The load time was not really noticeable on my system.
Some issues/questions:

  • Choosing a snippet inserts multiple cursors; 1 on the lhs and another on the first input. That's never been what I wanted when testing this out. See GIF below.
  • Managing functions with multiple different signatures is tricky. For example, try the snippet for plot. That seems bound to the snippet for the Curve Fitting Toolbox plot function, whereas I wanted the base plot function. Not sure how to handle that. Are these snippets provided in other editors to see precedent?
  • The doc link seems broken for plot.
  • The snippets are shown when I'm typing everywhere like in strings, comments, etc.

I wonder if providing this data as a custom autocomplete provider rather than in snippets would be more usable given the complexity of the data you're providing. That would require writing a bit more code but could let you give a much more tailored user experience.

Multiple cursors

atomSnippets

Snippets in many locations

atomSnippetsText

@rlivings39
Copy link
Collaborator

@elpollodiablo84, do you have any thoughts on this? I ask because I know you also maintain a MATLAB-oriented Atom package forked from this one.

@elpollodiablo84
Copy link

I think this PR is a really good idea, but like @rlivings39 I think it's better suited as a custom autocomplete provider. This probably means a lot of rework, but I think it will be worth it.

@aminya
Copy link
Author

aminya commented Feb 3, 2020

Choosing a snippet inserts multiple cursors; 1 on the lhs and another on the first input. That's never been what I wanted when testing this out. See GIF below.

Multiple cursors problem is fixed now

@aminya
Copy link
Author

aminya commented Feb 3, 2020

Also, I used a local Matlab installation, but I don't have all the toolboxes. I wonder if that affects the number of snippets. I will try to generate snippets on a university machine to see if any new snippets are generated.

@ghost
Copy link

ghost commented Jul 7, 2021

@Gimly this seems like a great feature for the VSC extension repo, any thoughts? 🙏🏾

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants