Custom code completion for class methods?

你离开我真会死。 提交于 2019-12-10 17:18:04

问题


In MATLAB, it is possible to define code suggestions and completions as explained in the documentation page titled "Customize Code Suggestions and Completions".

The snippets given therein, e.g.

{
  "_schemaVersion": "1.0.0",
  "anotherFunc":
  {
     "inputs":
     [
        {"name":"input1",  "kind":"required", "type":["numeric"]},
        {"name":"input2",  "kind":"required", "type":["numeric"]}
     ]
  }
}

show how we can control the predictions of functions found (presumably) in separate files in the same folder as functionSignatures.json.

Suppose I have a method called myMethod which resides in a class called myClass. Creating a JSON as above with "myMethod" instead of "anotherFunc" didn't seem to have an effect.

My question is - how can we define completions for class methods using this technique?


回答1:


After some trial and error, it appears that the prediction/completion logic expects to see syntax like:

"myClass.myMethod"

In other words, this should work:

{
  "_schemaVersion": "1.0.0",
  "myClass.myMethod":
  {
     "inputs":
     [
        ...
     ]
  }
}


来源:https://stackoverflow.com/questions/51895883/custom-code-completion-for-class-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!