VSCode: 禁用一小部分代码的代码格式化
VSCode: disable code formatting on small portion of code
所以我正在嵌入式 c 环境中开发引导加载程序。为了引导加载程序 "jump" .c 文件中需要一些汇编语言。
在 VSCode 中是否有类似于 This(或其他)的方法允许临时禁用格式化?
为了进一步说明,代码如下所示:
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0]; Load new stack pointer address
LDR PC, [ R0, #4 ]; Load new program counter address
}
和 VSCode 继续将此代码格式化为:
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0];
Load new stack pointer address
LDR PC,
[ R0, #4 ];
Load new program counter address
}
这将导致编译错误,无法构建。在此先感谢您的帮助。
如果您更改代码以使用 C 注释定界符,例如:
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0]; // Load new stack pointer address
LDR PC, [ R0, #4 ]; // Load new program counter address
}
然后格式化程序将不做任何缩进代码,这是良性的(而且更漂亮):
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0]; // Load new stack pointer address
LDR PC, [ R0, #4 ]; // Load new program counter address
}
所以我正在嵌入式 c 环境中开发引导加载程序。为了引导加载程序 "jump" .c 文件中需要一些汇编语言。
在 VSCode 中是否有类似于 This(或其他)的方法允许临时禁用格式化?
为了进一步说明,代码如下所示:
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0]; Load new stack pointer address
LDR PC, [ R0, #4 ]; Load new program counter address
}
和 VSCode 继续将此代码格式化为:
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0];
Load new stack pointer address
LDR PC,
[ R0, #4 ];
Load new program counter address
}
这将导致编译错误,无法构建。在此先感谢您的帮助。
如果您更改代码以使用 C 注释定界符,例如:
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0]; // Load new stack pointer address
LDR PC, [ R0, #4 ]; // Load new program counter address
}
然后格式化程序将不做任何缩进代码,这是良性的(而且更漂亮):
__asm void boot_jump(uint32_t address)
{
LDR SP, [R0]; // Load new stack pointer address
LDR PC, [ R0, #4 ]; // Load new program counter address
}