英文:
My extension is not appearing under "installed extensions" when running in debug mode (F5) in VSCode
问题
尽管我正在开发的VSCode扩展在使用F5运行时目前符合预期,但在单击主侧边栏中的“Extensions”时却没有显示:
如果答案是当我学会如何为发布打包我的扩展后它会在单击“已安装”下的我的扩展后出现,那么我将如何测试单击“已安装”后页面是否显示正确?
package.json:
{
"name": "soliditai",
"displayName": "soliditai",
"description": "为您的Solidity合约生成测试",
"version": "1.0.0",
"engines": {
"vscode": "^1.75.0"
},
"publisher": "Soliditai.com",
"categories": [
"Other"
],
"activationEvents": [],
"main": "./out/uploadSolidityContract.js",
"contributes": {
"commands": [
{
"command": "solidityTestGenerator.uploadSolidityContract",
"title": "Soliditai-proof-of-concept: 上传合约"
}
],
"configuration": {
"type": "object",
"title": "Soliditai Proof-of-concept插件",
"properties": {
"soliditai.username": {
"type": "string",
"default": "",
"description": "您的soliditai.com用户名。在https://soliditai.com/wp-login.php?action=register上创建一个免费帐户",
"order": 1
},
"soliditai.application-password": {
"type": "string",
"default": "",
"description": "在网站上创建帐户并登录后,通过滚动到https://soliditai.com/wp-admin/profile.php底部创建一个应用程序密码",
"order": 2
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.1",
"@types/node": "16.x",
"@types/vscode": "^1.75.0",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@vscode/test-electron": "^2.2.3",
"eslint": "^8.34.0",
"glob": "^8.1.0",
"mocha": "^10.2.0",
"typescript": "^4.9.5"
},
"dependencies": {
"axios": "^1.3.4"
}
}
还有一个默认生成的README.md。
英文:
Although the VSCode extension I'm developing works as expected so far when running with F5, it does not appear when clicking on "Extensions" in the Primary Sidebar:
If the answer is that it will come later when I learn how to package my extension for release, then how will I test if the page after clicking my extension under "INSTALLED" looks right?
package.json:
{
"name": "soliditai",
"displayName": "soliditai",
"description": "Generate tests for your Solidity contracts",
"version": "1.0.0",
"engines": {
"vscode": "^1.75.0"
},
"publisher": "Soliditai.com",
"categories": [
"Other"
],
"activationEvents": [],
"main": "./out/uploadSolidityContract.js",
"contributes": {
"commands": [
{
"command": "solidityTestGenerator.uploadSolidityContract",
"title": "Soliditai-proof-of-concept: Upload Contract"
}
],
"configuration": {
"type": "object",
"title": "Soliditai Proof-of-concept Plugin",
"properties": {
"soliditai.username": {
"type": "string",
"default": "",
"description": "Your soliditai.com username. Create a free account on https://soliditai.com/wp-login.php?action=register",
"order": 1
},
"soliditai.application-password": {
"type": "string",
"default": "",
"description": "After creating an account and logging in on the website, create an application password by scrolling to the bottom of https://soliditai.com/wp-admin/profile.php",
"order": 2
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run lint",
"lint": "eslint src --ext ts",
"test": "node ./out/test/runTest.js"
},
"devDependencies": {
"@types/glob": "^8.1.0",
"@types/mocha": "^10.0.1",
"@types/node": "16.x",
"@types/vscode": "^1.75.0",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@vscode/test-electron": "^2.2.3",
"eslint": "^8.34.0",
"glob": "^8.1.0",
"mocha": "^10.2.0",
"typescript": "^4.9.5"
},
"dependencies": {
"axios": "^1.3.4"
}
}
There's also a default-generated README.md
答案1
得分: 1
当你调试你的扩展时,"debugable" 扩展不会显示在扩展视图中。从一开始就是这样运行的(如果我记得没错的话),在扩展的存储库中,我也没有找到任何要求此功能的请求。也许你可以在 VS Code 存储库中提出一个功能请求,要求这个 https://github.com/microsoft/vscode/issues/new/choose
关于测试你的扩展页面是否显示正确,即使你已经安装了扩展,并对下一次更新进行了任何更改,Extension Development Host
窗口中的 README(调试)也不会被更新。与之前的问题相同。
要测试你的扩展的外观,最好的替代方案是 Extension Manifest Editor 扩展,由微软自己(实际上是 DevLabs)开发。但该扩展已经很长时间没有更新,根据市场上的评论,它不再正常工作。似乎有人创建了一个替代扩展 https://marketplace.visualstudio.com/items?itemName=ms-devlabs.extension-manifest-editor&ssr=false#review-details,但我从未使用过,无法确定它的准确性。
最终,现在唯一的解决方案是打包扩展并安装 .vsix
文件。
希望这有所帮助。
英文:
When you debug your extension, the debugable extension is not displayed in the Extensions view. This has been working this way since the beginning (if I remember correctly) and a quick look in extension's repo, I didn't find any feature request asking for this either. Maybe you could open a Feature Request in VS Code repo, asking for this https://github.com/microsoft/vscode/issues/new/choose
About testing if your extension's page looks right, even if you have your extension already installed and you make any changes in README for the next update you want to test, the README in Extension Development Host
window (the debug) won't be updated as well. Same issue as before.
To test how your extension will look, the best alternative was Extension Manifest Editor extension, developed by Microsoft itself (DevLabs in fact). But the extension has not been updated for a long time and it is not working properly anymore, based on the reviews in the Marketplace. It seems someone created an alternative extension https://marketplace.visualstudio.com/items?itemName=ms-devlabs.extension-manifest-editor&ssr=false#review-details, but I never used it to tell how precise it is.
In the end, right now, the only solution is to package the extension and install the .vsix
file.
Hope this helps
答案2
得分: 1
如果您尚未在VS Code中安装您的扩展,那么它当然不会显示在活动栏中。在调试时,VS Code会临时“注入”它,以使其在调试主机中可见(但仅在那里)。
实际上,您可以拥有两个不同版本的扩展:一个是您从市场或本地vsix文件安装的,另一个是您当前正在调试的。
英文:
If you have not installed your extension in VS Code then of course it won't show in the activity bar. When debugging it, VS Code takes care to temporarily "inject" it so that it becomes visible in the debug host (but only there).
You can actually have 2 different versions of your extension: one that you installed from the marketplace (or a local vsix file) and the other one you are debugging currently.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论