Skip to content

BUGFIX: Matlab completion now works with structs #61

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

Merged
merged 1 commit into from
Aug 23, 2016

Conversation

brunobeltran
Copy link
Contributor

This patch should fix #52.

The problem was that the MetaKernel framework expects do_matlab_complete('some_struct.long') to return 'some_struct.long_fieldname', but mtFindAllTabCompletions returns 'long_fieldname' instead.

This was fixed by asking do_matlab_complete.m to manually re-add the prefix. Matlab's isstruct function is used to make sure that the prefix that's being added back is actually a struct, instead of trying to use regular expressions to find the prefix, since that prevents corner cases where filenames that are valid Matlab identifiers are confused for structs that don't exist.

In practice, this means autocompletion will work correctly on test.p[TAB] whether test.py is a script in the current directory, a field py of the struct test, or both.

Also corrected some tab/spaces inconsistencies in the relevant files, and did some more name mangling to make sure that evalin(base, ... doesn't cause any problems if the user has a variable named e.g. completions_output.

@blink1073
Copy link
Contributor

Thanks!

@blink1073 blink1073 merged commit c28ccd9 into Calysto:master Aug 23, 2016
@Foucl
Copy link

Foucl commented Aug 23, 2016

thank you so much! (even though I know feel guilty for making you feel guilty ;-))

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.

Autocomplete sometimes deletes struct name
3 participants