Visual Studio代码自定义语言IntelliSense和转到符号 [英] Visual Studio Code Custom Language IntelliSense and Go to symbol

查看:106
本文介绍了Visual Studio代码自定义语言IntelliSense和转到符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Visual Studio Code编写自定义语言的扩展名.通过tmLanguage文件,语法检测运行良好.我试图弄清楚如何添加智能感知并获得符号支持,但是我都无法找到清晰的文档或参考文件来工作.

I am in the process of writing an extension for a custom language in Visual Studio Code. Syntax detection is working well via the tmLanguage file. I am trying to figure out how to add intellisense and go to symbol support, neither of which I have been able to find clear documentation on nor reference file(s) to work from.

当我打开一个文件并选择了我的自定义语言并且选择转到符号"时,出现以下错误: 不幸的是,我们没有文件的符号信息.

When I have a file open with my custom language selected and I select go to symbol I get the following error: Unfortunately we have no symbol information for the file.

是否有任何文档,或者您可以提供一些入门指南,还是我们知道这些选项不适用于自定义语言?

Is there any documentation, or can you provide some tips on how to get started, or do we know that these options are not available for custom languages?

推荐答案

@Wosi是正确的,但他引用了API预览.从11月发行以来,您要实现WorkspaceSymbolProvider( https://code .visualstudio.com/docs/extensionAPI/vscode-api#WorkspaceSymbolProvider )来实现此目的.

@Wosi is correct but he refers the API preview. Since the Nov-release you want to implement a WorkspaceSymbolProvider (https://code.visualstudio.com/docs/extensionAPI/vscode-api#WorkspaceSymbolProvider) to achieve this.

您可以找到我们如何完成TypeScript 是如何注册功能.基本上提供provideWorkspaceSymbols函数,给定搜索字符串将返回符号列表.

You can find how we did it TypeScript here and this is how to register the feature. Basically provide a provideWorkspaceSymbols function that given a search string returns a list of symbols.

这篇关于Visual Studio代码自定义语言IntelliSense和转到符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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