gpt4 book ai didi

SAS and Visual Studio Code Snippets [duplicate](SAS和Visual Studio代码段[重复])

转载 作者:bug小助手 更新时间:2023-10-25 15:57:22 31 4
gpt4 key购买 nike




I'm working with SAS Enterprise Guide for the first time, and it's in a highly secure remote environment. So far, I find that auto-complete when writing code is virtually nonexistent, even though I've ensured it is turned on in the settings. I can write the code in Visual Studio Code, which has a SAS extension and great contextual help, but it of course doesn't have the library, table and column names available to it. I've been reading up a bit on adding custom snippets for auto completion in VSC, and I'm wondering if it might be possible to feed it a json file with every library, table and column name. Does anyone know if that's possible?

我是第一次使用SAS企业指南,它位于一个高度安全的远程环境中。到目前为止,我发现编写代码时自动完成几乎是不存在的,尽管我已经确保在设置中打开了它。我可以用Visual Studio Code编写代码,它有一个SAS扩展和很好的上下文帮助,但它当然没有可用的库、表和列名。我已经阅读了一些关于在VSC中添加用于自动完成的定制代码段的内容,我想知道是否有可能为它提供一个包含每个库、表和列名的json文件。有人知道这是否可能吗?


更多回答

Did you check with your sas server admin? If you have a library assigned that gives you access to the data, I can't imagine why EG wouldn't be able to do auto-complete. You might want to talk with SAS support as well.

您是否与您的SAS服务器管理员进行了核实?如果你分配了一个库,允许你访问数据,我不能想象为什么EG不能进行自动补全。您可能还想与SAS支持部门联系。

Maybe I don't know how to work it properly. In a proc sql statement, when I start typing the library, it works, and then when I type the dot and start typing the table name, that works too. But when I give it the alias "as a" then try to select column names by starting with a., commands come up in the auto-complete, but not column names.

也许我不知道如何正确地使用它。在proc SQL语句中,当我开始输入库时,它会起作用,然后当我输入点并开始输入表名称时,它也会起作用。但是,当我给它指定别名“as a”,然后尝试通过以.开头选择列名时,命令会出现在自动补全中,但不会出现列名。

That could be a limitation of EG autocomplete. Definitely possible it doesn't know about sql aliases.

这可能是EG自动完成的一个限制。绝对有可能它不知道SQL别名。

Tom, you could do this as an EG add-in. They are written in C# and simply need to follow certain interfaces. They work great and it is fairly easy to get the metadata. That said, it isn't a light project but it is very doable. If you know C#, you are looking at a few days to do it. See if Chris Hemendinger, SAS Community lead, has any existing add-ins that might work.

Tom,您可以作为EG插件来执行此操作。它们是用C#编写的,只需遵循某些接口即可。它们工作得很好,而且获取元数据相当容易。也就是说,这不是一个轻量级的项目,但它是非常可行的。如果您了解C#,那么您需要几天的时间来完成它。看看SAS社区负责人Chris Hemendinger是否有任何可能工作的现有插件。

优秀答案推荐

It turns out to be very easy to give Visual Studio Code your own list of auto-complete options. Go to File menu->Preferences->Configure User Snippets. It will ask you to choose the language, then open a json file for you to edit. In my instance it was named sas.json.

事实证明,为Visual Studio代码提供您自己的自动完成选项列表是非常容易的。进入文件菜单->首选项->配置用户代码段。它将要求您选择语言,然后打开一个json文件供您编辑。在我的实例中,它被命名为sas.json。


You can add your own entries in this format:

您可以使用以下格式添加您自己的条目:


{
"my_term": {
"prefix": "my_term",
"body": ["my_term"]
}

As soon as you save the json file, the auto-complete is available to your code written in the selected language. The prefix can be different from the actual term if you wanted to use a different prompt.

一旦保存了json文件,用所选语言编写的代码就可以使用自动完成功能。如果要使用不同的提示符,前缀可以与实际术语不同。


更多回答

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com