vscode 检查快速修复...在屏幕上永远不会解决,但响应在服务器上,

wfsdck30  于 6个月前  发布在  Vscode
关注(0)|答案(6)|浏览(65)

当所有扩展都被禁用时,是否会出现这个问题?:是/否

  • VS Code 版本:1.89.1
  • OS 版本:Windows 11 - 10.0.22621

重现步骤:

  1. 安装eslint插件
  2. 设置eslint配置
  3. 创建一个带有自动修复功能的.js文件
  4. 保存文件
  5. 问题出现在下面的问题栏中
  6. 将鼠标悬停在问题上,"检查快速修复..."永远无法解决。
  7. 服务上的日志记录如下
[Trace - 11:50:50 AM] Sending request 'textDocument/codeAction - (52)'.
Params: {
    "textDocument": {
        "uri": "file:///c%3A/Users/USER/workspace/REPO/common/app/lwc/component/component.js"
    },
    "range": {
        "start": {
            "line": 657,
            "character": 8
        },
        "end": {
            "line": 657,
            "character": 69
        }
    },
    "context": {
        "diagnostics": [
            {
                "range": {
                    "start": {
                        "line": 657,
                        "character": 8
                    },
                    "end": {
                        "line": 657,
                        "character": 69
                    }
                },
                "message": "Invalid reassignment of public property \"records\"",
                "code": "@lwc/lwc/no-api-reassignments",
                "codeDescription": {
                    "href": "https://github.com/salesforce/eslint-plugin-lwc/blob/v1.8.1/docs/rules/no-api-reassignments.md"
                },
                "severity": 1,
                "source": "eslint"
            }
        ],
        "only": [
            "quickfix"
        ],
        "triggerKind": 1
    }
}

[Trace - 11:50:50 AM] Received response 'textDocument/codeAction - (52)' in 1ms.
Result: [
    {
        "title": "Disable @lwc/lwc/no-api-reassignments for this line",
        "command": {
            "title": "Disable @lwc/lwc/no-api-reassignments for this line",
            "command": "eslint.applyDisableLine",
            "arguments": [
                {
                    "uri": "file:///c%3A/Users/USER/workspace/REPO/common/app/lwc/component/component.js",
                    "version": 6,
                    "ruleId": "@lwc/lwc/no-api-reassignments"
                }
            ]
        },
        "kind": "quickfix"
    },
    {
        "title": "Disable @lwc/lwc/no-api-reassignments for the entire file",
        "command": {
            "title": "Disable @lwc/lwc/no-api-reassignments for the entire file",
            "command": "eslint.applyDisableFile",
            "arguments": [
                {
                    "uri": "file:///c%3A/Users/USER/workspace/REPO/common/app/lwc/component/component.js",
                    "version": 6,
                    "ruleId": "@lwc/lwc/no-api-reassignments"
                }
            ]
        },
        "kind": "quickfix"
    },
    {
        "title": "Show documentation for @lwc/lwc/no-api-reassignments",
        "command": {
            "title": "Show documentation for @lwc/lwc/no-api-reassignments",
            "command": "eslint.openRuleDoc",
            "arguments": [
                {
                    "uri": "file:///c%3A/Users/USER/workspace/REPO/common/app/lwc/component/component.js",
                    "version": 6,
                    "ruleId": "@lwc/lwc/no-api-reassignments"
                }
            ]
        },
        "kind": "quickfix"
    }
]

settings.json

{
  "search.exclude": {
    "**/node_modules": true,
    "**/bower_components": true,
    "**/.sfdx": true
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "salesforcedx-vscode-core.show-cli-success-msg": false,
  "editor.bracketPairColorization.enabled": true,
  "editor.guides.bracketPairs": true,
  "files.eol": "\n",
  "editor.formatOnSave": true,
  "[xml]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[visualforce]": {
    "editor.defaultFormatter": "salesforce.salesforcedx-vscode-visualforce"
  },
  "apexPMD.enableCache": true,
  "apexPMD.priorityErrorThreshold": 3,
  "apexPMD.priorityWarnThreshold": 5,
  "apexPMD.runOnFileChange": true,
  "files.exclude": {
    "**/.git": false
  },
  "xml.validation.schema.enabled": "onValidSchema",
  "eslint.useESLintClass": true,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "always" 
  }
}
z3yyvxxp

z3yyvxxp1#

感谢您提出这个问题!看起来您可能正在使用旧版本的VS Code,最新稳定版本是1.90.0。请尝试升级到最新版本并检查此问题是否仍然存在。
快乐编码!

8e2ybdfx

8e2ybdfx2#

更新后,结果相同。

2ul0zpep

2ul0zpep3#

@dbaeumer 看起来在这里使用eslint花费了很多时间。你对此有什么见解吗?

x33g5p2x

x33g5p2x4#

如果有误,请纠正我,但你看到的是服务器已发送响应(在上面的跟踪中为1毫秒),但UI从未解决。

mfuanj7w

mfuanj7w5#

@dbaeumer 完全正确 :)

flseospp

flseospp6#

@justschen ESLint服务器在1毫秒内交付了结果:)

相关问题