VS Code 具有称为配置文件的功能,例如,我有一个包含 Web 开发相关设置和扩展的配置文件,另一个包含 Java Spring 相关内容。但是,如果我安装扩展,它只会在我所在的配置文件上进行。如果它是我想要在所有配置文件上使用的通用扩展,那么我需要将其安装在我的所有配置文件上。
在VSCode 扩展中,我正在寻找一种方法,当用户修改package.json的contributes.configuration部分中定义的扩展属性时。
是否存在像onPropertyChange之类的事件或其他注册事件处理程序的方式?
当我尝试自动缩进 .ahk 文件时,我收到“没有安装‘ahk’文件的格式化程序”。如何创建一个基本的格式化程序?
我已经阅读了在线文档和 VS code API 的源代码,但我仍然不清楚如何读取 JSON 用户设置和工作空间设置。我尝试寻找示例,但找不到仅显示如何执行此操作的内容。
本质上我想要一个名为“最大值”的设置值。然后我想从 TS scrypt 读取最大值。
该文档引导我在 activate 函数中编写以下两行:
const config = vscode.workspace.getConfiguration('extension', vscode.window.activeTextEditor.document.uri);
vscode.window.showInformationMessage(config.has('configuration').toString());
Run Code Online (Sandbox Code Playgroud)
在我添加的 package.json 文件中,在贡献下:
"configuration": {
"maximum":
{
"type": ["integer"],
"default": 40,
"description": "The level of alignment, how far the titles will extend horizontally"
}
}
Run Code Online (Sandbox Code Playgroud)
但是我的输出是 false 。
我尝试了多个不同的输出,唯一一次我得到正确的结果是当第一个函数的参数是“启动”而第二个参数是“配置”时。
我无法仅从文档中了解参数需要是什么。也不应该在哪里指定该值。
我在VsCode中创建了很多自定义JavaScript代码段。最近,我开始在打字稿中处理项目,而且并不奇怪,JavaScript代码段在打字稿文件中不起作用。
有没有一种方法可以创建我可以在JavaScript和打字稿中使用的“共享”片段?(除了每次创建自定义代码段时复制代码段定义文件)
javascript code-snippets typescript visual-studio-code vscode-extensions
此错误不会消失!它仅在 VScode 输出控制台中显示,我在 google chrome 中运行代码,错误消失了。
ReferenceError:文档未定义
示例: https: //codepen.io/Dany2020/pen/vYLWPox
`[Running] node "c:\\index.js"
var headerText = document.getElementById("header");
^
ReferenceError: document is not defined
at Module._compile (internal/modules/cjs/loader.js:1138:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
[Done] exited with code=1 in 0.132 seconds`
Run Code Online (Sandbox Code Playgroud) 我有一个可用的 Angular 12 项目。现在我想转换这个项目,或者说我想从这个 Angular 项目中进行 VS Code 扩展。有没有办法构建 Angular 项目并将其作为 VS Code 扩展加载?
这里有人让 IntelliSense 在带有 DxCore 项目的 Arduino 的 Visual Studio Code 中相对完美地工作吗?我已经完成了大部分工作,但仍然存在一些问题。
对我来说,任何需要Serial.printf()
用红色波浪线标记的电话。Ctrl+单击printf
可以很好地显示定义。这里那里的其他事物也有相同的行为。例如,在定义va_start
内printf
。
除此之外,在验证草图时,我得到:
[Error] Failed to read or write IntelliSense configuration: {}
不认为这是一个真正的问题,但它很烦人。
这是我的c_pp_properties.json
文件:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\Users\\nabel\\OneDrive\\Documents\\ArduinoData\\packages\\DxCore\\hardware\\megaavr\\**",
"C:\\Users\\nabel\\OneDrive\\Documents\\Arduino\\libraries\\**",
"C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**",
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\**",
"C:\\Program Files (x86)\\Arduino\\tools\\**",
"C:\\Program Files (x86)\\Arduino\\libraries\\**"
],
"forcedInclude": [
"C:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino\\Arduino.h"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"ARDUINO=10816", // Should be updated for version of Arduino IDE installed; …
Run Code Online (Sandbox Code Playgroud) intellisense arduino dxcore visual-studio-code vscode-extensions
我正在尝试编写一个小助手扩展来简化功能分支的创建。我已经有了最近活动的工作项目的视图和一个用于从特定项目创建功能分支的按钮。名称的格式已经正确,但当功能已内置到 vscode 中时,我不想负责分支创建逻辑。
我的第一次尝试是简单地调用executeCommand
并传递命令和请求的分支名称,如下所示:
vscode.commands.executeCommand("git.branch", branchName);
Run Code Online (Sandbox Code Playgroud)
遗憾的是,该branchName
参数只是被忽略,文本输入的显示就像通过命令选项板执行命令时一样。简单的解决方案是简单地窃取借用分支创建逻辑或进行 cli 调用,但我很顽固,希望尽可能避免这样做。
我几乎无法在任何地方找到有关此主题的任何信息。
https://code.visualstudio.com/api/references/commands不涵盖 git 命令
https://code.visualstudio.com/api/extension-guides/command#command-uris涵盖了通过 uris 将参数传递给命令,但这对我来说也不起作用
我将不胜感激任何线索。
我想从用户那里接收一些输入,例如username
并在代码中使用它。如何做到这一点?
您可以在图像选项卡尺寸问题或缩进中看到,为什么缩进上出现红色或错误颜色?如何解决问题/错误?
"[python]": {
"editor.tabSize": 3,
"editor.defaultFormatter": "ms-python.python",
"editor.detectIndentation": false
},
"[django-html]": {
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
},
"editor.defaultFormatter": "ms-python.python",
}
Run Code Online (Sandbox Code Playgroud)
typescript ×2
angular ×1
api ×1
arduino ×1
autohotkey ×1
dxcore ×1
git ×1
intellisense ×1
javascript ×1
json ×1
node.js ×1
output ×1
profile ×1
python ×1