The problem encountered by VSCode: chrome file cannot be found / js middle block-level comment shows white invalid

Can't find Chrome Google Chrome

problem causes

早上突然用VSCode打开html页面显示:

Solution

  1. First go to set the default browser is chrome browser,

  2. Download the view in browser plugin
    Plug-in

  3. Change the setting.json configuration file
    My configuration:

{
    "open-in-browser.default": "C:/Users/27504/AppData/Local/Google/Chrome/Application/chrome.exe", //填写你的游览器的安装地址
    "workbench.iconTheme": "material-icon-theme",
    "[html]": {
        "editor.defaultFormatter": "HookyQR.beautify"
    },
    "window.zoomlevel": 1,
    "view-in-browser.default": "C:/Users/27504/AppData/Local/Google/Chrome/Application/chrome.exe", //填写你的游览器的安装地址
    "files.autosave": "onFocusChange",
    "files.associations": {
        "*.eJs": "html",
        "*.js": "javascript",
        "*.vue": "html",
        "*.cjson": "jsonc",
        "*.wxss": "css",
        "*.wxs": "javascript"
    },
    "emmet.triggerExpansionOnTab": true,
    "emmet.includeLanguages": {
        "vue-html": "html",
        "vue": "html",
        "js": "html",
        "wxml": "html"
    },
    "files.autoSave": "onFocusChange",
    "editor.semanticTokenColorCustomizations": null,
    "minapp-vscode.disableAutoConfig": true,
    "editor.codeActionsOnSave": null,
}

Then restart vscode.

Invalid JS file block-level comments in VSCode

problem causes

When using the js file in VSCode, I found that the comment can only be changed into a form instead of /**/.

Solution

Change the configuration items in setting.json.

Just change the options behind .js to javascript.

    "files.associations": {
        "*.eJs": "html",
        "*.js": "javascript",
        "*.vue": "html",
        "*.cjson": "jsonc",
        "*.wxss": "css",
        "*.wxs": "javascript"
    },

The files.associations configuration is used to control the format used by the files created by VSCode.

If there is something wrong with the above method, welcome to discuss!

Guess you like

Origin blog.csdn.net/qq_41497756/article/details/107517789