用vscode 编辑c语言或者Verilog代码, 由于其它开发工具的文件编码格式无法修改,默认只能是gb2312, 与我们国内奉行的统一 utf8 不一致. 所以只能是更改特殊文件的打开方式. 配置方式如下.

vscode设置特定扩展名文件的打开编码格式_vscode


关键配置如下:

{
    "git.openRepositoryInParentFolders": "never",
    "Codegeex.Privacy": true,
    "EIDE.ARM.INI.Path": "d:\\Keil_v5\\UV4\\UV4.exe",
    "terminal.integrated.scrollback": 3000,
    "workbench.editorAssociations": {
        "*.c": "default"
    },
    "Codegeex.Comment.LanguagePreference": "中文",
    "files.associations": {
        "*.v": "verilog",
        "*.c": "c",
        "*.h": "c"
    },
    "[c]": { 
            "files.encoding": "gb2312" //设置verilog文件编码
    },
    "[verilog]": { 
            "files.encoding": "gb2312" //设置verilog文件编码
    },
    "Codegeex.Local": {
        "apiURL": "",
        "useChatGLM": true,
        "chatGLM": {
            "apiKey": "",
            "model": ""
        },
        "chat": {
            "useDefaultSystemPrompt": true,
            "systemPrompt": "",
            "temperature": 0.2,
            "top_p": 0.95,
            "max_tokens": 1024,
            "presence_penalty": 1
        },
        "completions": {
            "useDefaultSystemPrompt": true,
            "systemPrompt": "",
            "temperature": 0.2,
            "top_p": 0.95,
            "max_tokens": 64,
            "presence_penalty": 1
        }
    },
    "editor.fontFamily": "宋体,Consolas, 'Courier New', monospace",
    "editor.inlayHints.fontFamily": "宋体",
    "Codegeex.License": ""
}