tab autocompete feature with imported packages

Is there a way to make the tab auto-complete popup menu include in its search the functions/classes in an imported Package/namespace?
for instance, i have the following directory structure
C:\Mfiles (exists on matlab path)
C:\Mfiles\+Units ( a package of classdef files)
C:\Mfiles\+Units\AngleUnits.m ( class file within Units package)
If i type the following within the command env or in the editor
import Units.*
bob= AngleUn
and then press \tab, it does not find AngleUnits.m in the popup menu. Is there a way to make the autocomplete search the Units namespace for matching filenames as well as the matlab path?
thanks

3 commentaires

Jim Hokanson
Jim Hokanson le 13 Oct 2012
Modifié(e) : Jim Hokanson le 13 Oct 2012
Tab complete in general for Matlab seems to be buggy when mixing classes and packages. Here's another example I just ran into on 2012b.
a.b.c.my_class won't show prompt for my_class, but will for c (package) where a.b is both a class and a package i.e. +b and @b
however, the following works (i.e. prompt for wtf shows) a.test.wtf where there is no class @test, just the package :/
I realize this doesn't deal with the case of imported cases but in general I consider all of these to be bugs ... Perhaps I'll file a bug report since I don't see anything in the bug reports section.
UPDATE I had a bug which was apparently preventing the tab complete from working. I am a bit surprised the bug stopped the class from showing up. I could understand failure to show static methods on the next tab complete due to some parsing error.... I had created a constant property which calls a static method which I had yet to declare as static within the class file, so the method "didn't exist" yet.
In 2015 I have still the same problem as Brain with MATLAB R2015a... Any news on that?
It appears this feature has not been added yet as of R2018b.
For example, suppose package 'pack' is on the MATLAB path and class 'Obj' is in 'pack'. After opening a script file and typing
pack.Ob
and then tab, the editor auto-completes the name 'Obj'.
However, after instead typing
import pack.Obj
Ob
and then tab, the auto-complete popup says "No completions found," even though MATLAB can find Obj at run time if the name is completed.
I would not call tab complete's failure to search imported packages a bug. But I regularly lose time typing due to this feature's absence. I hope MathWorks adds it.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur File Operations dans Centre d'aide et File Exchange

Produits

Commenté :

le 3 Août 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by