Patrick Happel
Patrick Happel

Reputation: 1351

Matlab code completion for class method in a class folder and namespace

I have a class that is located in a namespace folder, and within this namespace folder it is inside a class folder. Thus, the directory structure is

inpath/+namespace/@ClassName/ClassName.m

I'd like to provide some code suggestions for a method defined in ClassName.m.

I have generated a functionSignature.json file and placed it in

inpath/+namespace/@ClassName/

which did not work, and also in

inpath/+namespace/

which didn't work either.

Furthermore, I have tried the following function names:

"Classname.Methodname"

and

"namespace.ClassName.MethodName"

in both locations, but it did not work.

The answer to this question says that the syntax "ClassName.MethodName" is correct for class methods, but the class was not located in a namespace (and the answer does not say whether the class was defined in a class directory).

To be sure that there are no other errors, here is my original functionSignature.json file (using "namespace.ClassName.MethodName"):

{
  "SICM.SICMScan.FromFile":
  {
     "inputs":
     [
         {"name":"in1",  "kind":"ordered", "type":"file=*.sicm,*.sic,*.ras"}
     ]
  }
} 

My questions are:

Upvotes: 2

Views: 157

Answers (1)

Cris Luengo
Cris Luengo

Reputation: 60760

it seems that my initial hunch is correct: the functionSignature.json file needs to be in whichever directory you add to the MATLAB path to use the functions. Since namespace directories are not directly added to the path, but their parent directory is, the functionSignature.json directory needs to be in the parent directory of the namespace directory.

Upvotes: 2

Related Questions