VSCode扩展功能对应的Eclipse插件等价API及文档咨询
VSCode扩展API对应Eclipse插件API映射及文档来源
VSCode API 与 Eclipse 插件 API 映射
vscode.window.activeTextEditor.document.uri:通过PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()获取当前编辑器,再调用getEditorInput().getURI()获取文件URIvscode.window.activeTextEditor.selection:当前编辑器的选择可通过activeEditor.getSite().getSelectionProvider().getSelection()获取,若为文本选择可强转为ITextSelection,对应VSCode的选区信息vscode.window.showInformationMessage:使用MessageDialog.openInformation(Shell parent, String title, String message),Shell可通过PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()获取vscode.workspace.getConfiguration:通过Platform.getPreferencesService().getInstanceScope().getNode("你的插件ID")获取插件专属配置节点,对应VSCode的工作区/用户配置vscode.window.showInputBox:使用InputDialog.open(Shell parent, String title, String message, String initialValue)弹出输入框获取用户输入vscode.window.showQuickPick:使用ListDialog.open(Shell parent, Object[] elements)展示选项列表,供用户快速选择vscode.window.activeTextEditor.edit:先通过IDocumentProvider.getDocument(editorInput)获取当前文档,再调用replace(int offset, int length, String text)替换选中内容,修改后可按需调用editor.getDocumentProvider().saveDocument(null, editorInput, null, false)保存
Eclipse插件API文档最佳来源
- Eclipse IDE内置的Platform Plug-in Developer Guide:包含插件开发核心概念、API详解、分步教程等,可通过IDE的
Help > Help Contents直接访问 - Eclipse API Javadoc文档:每个组件的类、方法注释都在Javadoc中,可通过IDE的代码跳转(Ctrl+点击类/方法名)查看,也能在帮助系统中找到对应API的完整参考
内容的提问来源于stack exchange,提问作者David Souther
相关产品推荐
相关产品推荐

