类方法的自定义代码完成? [英] Custom code completion for class methods?

查看:129
本文介绍了类方法的自定义代码完成?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MATLAB中,可以按照标题为"

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

其中给出的摘录,例如

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

说明如何控制与functionSignatures.json在同一文件夹中的单独文件中(大概)发现的函数的预测.

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

假设我有一个名为myMethod的方法,该方法位于名为myClass的类中.如上所述,用"myMethod"而不是"anotherFunc"创建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?

推荐答案

经过一番尝试和错误之后,预测/完成逻辑似乎希望看到如下语法:

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":
     [
        ...
     ]
  }
}

这篇关于类方法的自定义代码完成?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆