英文:
VSCode is commenting out code after /* in string literals. How can I disable this?
问题
VSCode 在我的 JS 文件中,从字符串文字中的部分 '/*' 开始注释掉了所有代码。
我不想要这种行为。
是否有人在使用 VSCode 时遇到类似的情况?
此文件的完整代码在这里:
import { json } from '@sveltejs/kit';
async function getPost() {
let posts = [];
const paths = import.meta.glob('/src/posts/*.md', { eager: true });
for (const path in paths) {
console.log(path);
}
return posts;
}
export async function GET() {
const post = await getPost();
return json(post);
}
我尝试在字符串文字中转义星号,但 prettier 自动修复了它。
'/src/posts/*.md' => /src/posts/*.md' (prettier 自动修复)
英文:
VSCode is commenting out all the code behind from the part '/*' in the string literal on my JS file.
Is there anybody who experienced some similar things like this using VSCode?
Whole code of this file is here
import { json } from '@sveltejs/kit';
async function getPost() {
let posts = [];
const paths = import.meta.glob('/src/posts/*.md', { eager: true });
for (const path in paths) {
console.log(path);
}
return posts;
}
export async function GET() {
const post = await getPost();
return json(post);
}
I tried to escape the asterisk in the string literal but the prettier auto fixed it.
'/src/posts/\*.md' => /src/posts/*.md' (auto fixed by prettier)
答案1
得分: 1
我检查了在VS Code上安装的插件,并禁用了Babel JS和JSDoc插件。这有所帮助,问题似乎已解决。
英文:
I checked the plugins installed on VS Code and disabled Babel JS and JSDoc plugin.
It helped and it seems the problem is resolved.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论