美文网首页
用VSCODE写JS代码提示不全的解决方案

用VSCODE写JS代码提示不全的解决方案

作者: 幸之石 | 来源:发表于2020-06-07 11:56 被阅读0次

VScode是一款非常强大的代码编辑工具,但是对JS代码之类的弱类型语言的提示是许多用户的一个痛点。比如在写

carousel.addEventListener("mouseleave",mouseHandler)

这句代码时,mouseleave这个事件需要一个一个字母拼出来,稍有疏忽可能就导致拼写错误,极大地妨碍了我们的开发效率。

本人苦恼这个问题良久,在网上搜了许多解决办法并亲自实验了,网上很多方法对本人并不适用,在经过漫长的摸索后终于解决了这个问题,现分享下本人的解决方案,并不一定适用所有情况。大家可以尝试下

第一步,在VSCODE插件商店里搜索ESLint并安装,重启VSCODE;

第二布,修改settin.json文件。

直接复制下列内容覆盖settin.json的内容

{
    "files.autoSave": "off",
    "editor.fontSize": 18,
    "editor.tabSize": 2,
    "workbench.colorTheme": "Monokai Dimmed",
    "explorer.confirmDragAndDrop": false,
    "explorer.confirmDelete": false,
    "files.associations": {
        "*.tpl": "html"
    },
    "git.autofetch": true,
    "typescript.useCodeSnippetsOnMethodSuggest": true,
    "emmet.syntaxProfiles": {
        "vue-html": "html",
        "vue": "html"
    },
    "gitlens.advanced.messages": {
        "suppressCommitHasNoPreviousCommitWarning": false,
        "suppressCommitNotFoundWarning": false,
        "suppressFileNotUnderSourceControlWarning": false,
        "suppressGitVersionWarning": false,
        "suppressLineUncommittedWarning": false,
        "suppressNoRepositoryWarning": false,
        "suppressResultsExplorerNotice": false,
        "suppressShowKeyBindingsNotice": true,
        "suppressUpdateNotice": false,
        "suppressWelcomeNotice": true
    },
    "beautify.language": {
        "js": {
            "type": [
                "javascript",
                "json"
            ],
            "filename": [
                ".jshintrc",
                ".jsbeautify"
            ]
        },
        "css": [
            "css",
            "scss"
        ],
        "html": [
            "htm",
            "html",
            "vue"
        ]
    },
    "editor.quickSuggestions": {
        "strings": true
    },
    "sync.gist": "aac5149968c3b17bcaa44b0e41460038",
    "sync.lastUpload": "2018-06-27T02:07:56.788Z",
    "sync.autoDownload": false,
    "sync.autoUpload": false,
    "sync.lastDownload": "",
    "sync.forceDownload": false,
    "sync.anonymousGist": false,
    "sync.host": "",
    "sync.pathPrefix": "",
    "sync.quietSync": false,
    "sync.askGistName": false,
    "files.autoSave": "off",
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        {
            "language": "vue",
            "autoFix": true
        }
    ],
    "eslint.options": {
        "configFile": "/Users/maolipeng/Desktop/companyProject/SOFT-VUE-11/.eslintrc.js",
        "plugins": [
            "html"
        ]
    },
    "editor.renderIndentGuides": false,
    "editor.tabSize": 2,
    "files.associations": {
        "*.vue": "vue"
    },
    "eslint.autoFixOnSave": true,
    "eslint.options": {
        "extensions": [
            ".js",
            ".vue"
        ]
    },
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "vue",
        "vue-html"
    ],
    "search.exclude": {
        "**/node_modules": true,
        "**/bower_components": true,
        "**/dist": true
    },
    "emmet.syntaxProfiles": {
        "javascript": "jsx",
        "vue": "html",
        "vue-html": "html",
        "tpl": "html"
    },
    "git.confirmSync": false,
    "window.zoomLevel": 0,
    "editor.cursorBlinking": "smooth",
    "workbench.iconTheme": "vscode-great-icons",
    "editor.minimap.enabled": true,
    "editor.minimap.renderCharacters": false,
    "window.title": "${dirty}${activeEditorMedium}${separator}${rootName}",
    "editor.codeLens": true,
    "editor.snippetSuggestions": "top",
    "vetur.format.defaultFormatter.js": "vscode-typescript",
    "liveServer.settings.donotShowInfoMsg": true,
    "files.autoSave": "off",
    "eslint.validate": [
        "javascript",
        "javascriptreact",
        "html",
        {
            "language": "vue",
            "autoFix": true
        }
    ],
    "eslint.options": {
        "plugins": [
            "html"
        ]
    },
    "element-helper.version": "2.3",
    "gitlens.keymap": "alternate",
    "emmet.syntaxProfiles": {
        "vue-html": "html",
        "vue": "html"
    },
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "sync.removeExtensions": true,
    "sync.syncExtensions": true,
    "prettier.singleQuote": true,
    "prettier.semi": false,
    "vetur.format.defaultFormatter.html": "js-beautify-html",
    "vetur.format.defaultFormatterOptions": {
        "wrap_attributes": "force-aligned"
    },
    "gitlens.historyExplorer.enabled": true,
    "jetbrainsKeymap.promptV3Features": true,
    "emmet.triggerExpansionOnTab": true,
    "emmet.syntaxProfiles": {
        "javascript": "jsx"
    },
    "editor.fontLigatures": null
}

相关文章

网友评论

      本文标题:用VSCODE写JS代码提示不全的解决方案

      本文链接:https://www.haomeiwen.com/subject/xgfctktx.html