Vscode摘要语法是否允许可选参数到命令
我最近开始使用第三方扩展程序来支持机器人编程的语言( robodk )。扩展程序非常好,但不包含我想使用的许多命令,并且不正确(至少对我来说)将可选的参数处理到命令。我想“扩展”扩展名来支持其他命令(并有可能向开发人员提供此反馈)。
我专门使用ABB的快速机器人语言。
示例:
MoveL robtarget, speeddata, zonedata, tooldata \WObj:=WObj0;
对于Movel, var1 thru var4 是必需的,但是 \ wobj:= wobj0 是可选的。字符串的“ \ wobj0:= ”的一部分是常数(如果提供选项),并且 wobj0 将是 movel movel type的变量/em>(在这种情况下为工作对象)。
有没有办法将摘要JSON编辑为 不是 输入可选零件,除非我开始键入backsslash,又要输入文本?我还想将可选部分保留在摘要中作为参考,因此我不必记住每个可选参数,因为某些命令有很多选择。
这是摘自Spipt.ABB.JSON文件:
"movel": {
"prefix": "movel",
"body": [
"MoveL ${1:var_robtarget}, ${2:var_speeddata}, ${3:var_zonedata}, ${4:pers_tooldata} \\WObj:=WObj0;"
],
"description": "Linear motion"
},
它以VAR_ROBTARGET,VAR_SPEEDDATA,VAR_ZONEDATA&amp&导致代码产生代码。 pers_tooldata全部突出显示,其余为纯文本:
MoveL var_robtarget, var_speeddata, var_zonedata, pers_tooldata \WObj:=WObj0;
I recently started using a 3rd party extension for language supporting robot programming (RoboDK). The extension is pretty good but doesn't include many of the commands I would like to use and doesn't correctly (at least to me) handle optional arguments to commands. I'd like to 'extend' the extension to support additional commands (and potentially provide this feedback to the developer).
I'm specifically using ABB's RAPID robot language.
Example:
MoveL robtarget, speeddata, zonedata, tooldata \WObj:=WObj0;
For MoveL, var1 thru var4 are required but \WObj:=WObj0 is optional. The '\WObj0:=' part of the string is a constant (if supplying the option) and WObj0 would be a variable of the expected type for MoveL (a work object, in this case).
Is there a way to edit the snippets json to not enter the optional part unless I start typing a backslash followed by text? I also would like to keep the optional part in the snippet as a reference so I don't have to remember every optional argument as some commands have many options.
Here's an excerpt from the snippet.abb.json file:
"movel": {
"prefix": "movel",
"body": [
"MoveL ${1:var_robtarget}, ${2:var_speeddata}, ${3:var_zonedata}, ${4:pers_tooldata} \\WObj:=WObj0;"
],
"description": "Linear motion"
},
Which results in the code with var_robtarget, var_speeddata, var_zonedata & pers_tooldata all highlighted and the remainder is plain text:
MoveL var_robtarget, var_speeddata, var_zonedata, pers_tooldata \WObj:=WObj0;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,我认为在同一片段中没有任何办法可以做到这一点。您可以在后面的前缀上制作另一个片段,但这很麻烦。
这是做您想做的事情的简单方法,但是您必须删除任何不需要的可选变量:
到达它们时也选择了最后一个变量。如果您不希望任何点击 delete 。
我只是在删除。
No, I don't think there is any way to do that within the same snippet. You could make another snippet with the backslash prefix but that is cumbersome.
Here is a simple way to do what you want but you will have to delete any optional variables you don't want:
That last variables are also selected when you get to them. If you don't want any just hit Delete.
In the above demo I am just tabbing and deleting.