microsoft / vscode-eslint

VSCode extension to integrate eslint into VSCode
MIT License
1.73k stars 334 forks source link

"Running save participants" hangs indefinitely on VSCode 1.42.1 #904

Closed katz12 closed 4 years ago

katz12 commented 4 years ago

image (4)

Steps to Reproduce:

I'm not completely sure where all of my configuration is, but this is my settings.json:

{
  "editor.tabSize": 2,

  "files.associations": {
    "*.css": "postcss"
 },
  "files.exclude": {
    "**/node_modules/**": true
  },
  "files.watcherExclude": {
    "**/dist/**": true
  },
  "search.exclude": {
    "**/dist/**": true
  },

  "typescript.tsdk": "node_modules/typescript/lib",

  "eslint.alwaysShowStatus": true,
  "eslint.packageManager": "yarn",
  "eslint.validate": [
    { "language": "javascript", "autoFix": true },
    { "language": "javascriptreact", "autoFix": true },
    { "language": "typescript", "autoFix": true },
    { "language": "typescriptreact", "autoFix": true }
  ],

  "prettier.disableLanguages": [
    "javascript",
    "javascriptreact",
    "typescript",
    "typescriptreact"
  ],

  "eslint.autoFixOnSave": true,
  "editor.formatOnSave": false,
  "editor.codeActionsOnSave": {
    "source.fixAll.eslint": true
  },
}

and this is my prettier.config.js:

module.exports = {
  semi: false,
  singleQuote: true,
  jsxSingleQuote: true
}

I tried removing the deprecated "eslint.autoFixOnSave": true and there was no change.

This issue does not occur if I revert back to VSCode 1.41.1. It also does not occur if I disable the ESLint plugin on 1.42.1.

dbaeumer commented 4 years ago

@katz12 can you share your repository with steps on how to reproduce this. Since I don't see this in my workspaces it is very hard to track this down without reproducible steps.

katz12 commented 4 years ago

Yeah I understand that this is a bit vague, but I am not able to share the entire repository. Is there any other configuration that would be helpful?

Maybe some logs I can look at?

katz12 commented 4 years ago

This is a possible duplicate: https://github.com/microsoft/vscode/issues/91057.

Maybe they can share some information to help debug the issue?

katz12 commented 4 years ago

If anyone else is having this issue and can provide the information that @dbaeumer is asking for, we can better diagnose this issue:

can you share your repository with steps on how to reproduce this. Since I don't see this in my workspaces it is very hard to track this down without reproducible steps.

dbaeumer commented 4 years ago

@katz12 you can always disable auto fix on save. All you need to do is:

    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": false
    }

Will save then work for you?

katz12 commented 4 years ago

My current workaround is to use VSCode 1.41.1

dbaeumer commented 4 years ago

@katz12 the difference is that you will not see the dialog but the save participant will not run either in 1.41.1. So it would be really good if I would be able to reproduce this. Could I get access to the code in a non public way ?

Polantaris commented 4 years ago

I'm also experiencing this on VSCode 1.42.1 with the latest eslint plugin. Unfortunately my repo is private and also very large, so I don't really have any code to share, however my settings.json is below.

{
    "editor.insertSpaces": false,
    "editor.wordWrap": "on",
    "editor.formatOnSave": false,
    "[html]": {
        "editor.formatOnSave": true
    },
    "eslint.autoFixOnSave": true,
    "editor.formatOnPaste": true,
    "typescript.tsdk": "[private repo]/node_modules/typescript/lib",
    "html.format.wrapAttributes": "preserve-aligned",
    "html.format.wrapLineLength": 240,
    "eslint.validate": [
        "javascript",
        {
            "language": "typescript",
            "autoFix": true,
        }
    ],
    "eslint.run": "onType",
    "eslint.trace.server": "messages",
    "eslint.workingDirectories": [
        {
            "directory": "[private repo]",
            "changeProcessCWD": true
        }
    ],
    "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
    "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "eslint.enable": true
}

I'm happy to try anything to fix it, I've had to disable the eslint plugin for now because every save can take an upwards of five minutes to complete, however that's not a long term solution.

toddheslin commented 4 years ago

I discovered this issue when I added into my .vscode/settings.json:

{
    "eslint.workingDirectories": [
        {
            "directory": "src/server"
        },
        {
            "directory": "src/client"
        }
    ]
}

When I comment this out it works fine again.

UPDATE: It turns out that the problem was specifically happening when I was making changes within the codegen/** directory. When adding this into my workingDirectories list the problem disappeared. Also worth noting that I don't have eslint installed globally but instead always have it as a dev dependency in my projects (both server and client have it above, but generated didn't... not sure if that is relevant)

Anyway, hops this is some extra data for debugging it!

AbelHu commented 4 years ago

I also hit this issue in our GoLang project after VSCode was upgraded. I use VSCode in Windows (Do not use WSL). It still does not work after I set "source.fixAll.eslint" to false.

Version: 1.42.1 (system setup) Commit: c47d83b293181d9be64f27ff093689e8e7aed054 Date: 2020-02-11T14:45:59.656Z Electron: 6.1.6 Chrome: 76.0.3809.146 Node.js: 12.4.0 V8: 7.6.303.31-electron.0 OS: Windows_NT x64 10.0.18363

My settings.json { "window.zoomLevel": 0, "go.formatTool": "goimports", "go.useLanguageServer": true, "files.watcherExclude": { "/.git/": true, "/vendor/": true }, "remote.SSH.useLocalServer": true, "remote.downloadExtensionsLocally": true, "editor.formatOnPaste": true, "editor.folding": true, "editor.formatOnSave": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": false } }

dbaeumer commented 4 years ago

@AbelHu are you using ESLint at all. I guess you need to disable the corresponding go lang contribution.

dbaeumer commented 4 years ago

I would still highly appreciate a GitHub repository to clone. I am pretty sure this depends more on the content of a file that is validated than a setup.

Polantaris commented 4 years ago

So I did a little bit of experimenting and I'm hitting a very interesting behavior.

My repository has @typescript-eslint installed as well (as it is a TypeScript repo). In my .eslintrc.js, I have almost every single rule between eslint and @typescript-eslint defined even if the rules are set to the default because I prefer being explicit about things like this.

When I go into the .eslintrc.js and disable the @typescript-eslint rules, everything works fine again even if I re-enable them afterward. When I then reset VSCode, the issue reoccurs.

I'm not really sure if this issue boils down to @typescript-eslint or eslint, but I can open an issue with them if you believe the issue is related to that plugin. That being said, I'm not really sure if it belongs there as from my understanding @typescript-eslint is a general parser for eslint, not specifically related to vscode.

My .eslintrc.js:

module.exports = {
    parser: '@typescript-eslint/parser',
    plugins: ['@typescript-eslint/eslint-plugin'],
    parserOptions: {
        ecmaVersion: 6,
        sourceType: 'module',
        project: '../tsconfig.json',
        tsconfigRootDir: './[repo]'
    },
    env: {
        browser: true,
        commonjs: true,
        es6: true
    },
    rules: {
        //Possible Errors
        'for-direction': 'error',
        'getter-return': 'error',
        'no-async-promise-executor': 'error',
        'no-await-in-loop': 'error',
        'no-compare-neg-zero': 'error',
        'no-cond-assign': 'error',
        'no-console': 'warn',
        'no-constant-condition': 'warn',
        'no-control-regex': 'off',
        'no-debugger': 'warn',
        'no-dupe-args': 'error',
        'no-dupe-keys': 'error',
        'no-duplicate-case': 'error',
        'no-duplicate-imports': 'off',
        'no-empty': ['warn', { allowEmptyCatch: true }],
        'no-empty-character-class': 'off',
        'no-ex-assign': 'error',
        'no-extra-boolean-cast': 'warn',
        'no-extra-parens': 'off',
        '@typescript-eslint/no-extra-parens': 'off',
        'no-extra-semi': 'error',
        'no-func-assign': 'error',
        'no-inner-declarations': 'error',
        'no-invalid-regexp': 'error',
        'no-irregular-whitespace': 'warn',
        'no-misleading-character-class': 'error',
        'no-obj-calls': 'error',
        'no-prototype-builtins': 'off',
        'no-regex-spaces': 'off',
        'no-sparse-arrays': 'error',
        'no-template-curly-in-string': 'error',
        'no-unexpected-multiline': 'warn',
        'no-unreachable': 'error',
        'no-unsafe-finally': 'error',
        'no-unsafe-negation': 'error',
        'require-atomic-updates': 'error',
        'use-isnan': 'error',
        'valid-typeof': 'error',

        //Best Practices
        'accessor-pairs': 'off',
        'array-callback-return': 'warn',
        'block-scoped-var': 'warn',
        'class-methods-use-this': 'off',
        'complexity': ['warn', 20],
        'consistent-return': 'off',
        'curly': 'warn',
        'default-case': 'warn',
        'dot-location': ['warn', 'object'],
        'dot-notation': 'warn',
        'eqeqeq': ['error', 'always'],
        'guard-for-in': 'off',
        'max-classes-per-file': ['warn', 10],
        'no-alert': 'warn',
        'no-caller': 'warn',
        'no-case-declarations': 'warn',
        'no-div-regex': 'warn',
        'no-else-return': 'warn',
        'no-empty-function': 'off',
        '@typescript-eslint/no-empty-function': ['warn', { allow: ['constructors'] }],
        'no-empty-pattern': 'warn',
        'no-eq-null': 'warn',
        'no-eval': 'warn',
        'no-extend-native': 'warn',
        'no-extra-bind': 'warn',
        'no-extra-label': 'warn',
        'no-fallthrough': 'warn',
        'no-floating-decimal': 'warn',
        'no-global-assign': 'warn',
        'no-implicit-coercion': 'off',
        'no-implicit-globals': 'warn',
        'no-implied-eval': 'warn',
        'no-invalid-this': 'warn',
        'no-iterator': 'warn',
        'no-labels': 'warn',
        'no-lone-blocks': 'warn',
        'no-loop-func': 'warn',
        'no-magic-numbers': 'off',
        '@typescript-eslint/no-magic-numbers': [
            'warn',
            {
                ignore: [-3, -2, -1, 0, 1, 2, 3],
                ignoreNumericLiteralTypes: true,
                ignoreEnums: true
            }
        ],
        'no-multi-spaces': 'warn',
        'no-multi-str': 'warn',
        'no-new': 'warn',
        'no-new-func': 'warn',
        'no-new-wrappers': 'warn',
        'no-octal': 'warn',
        'no-octal-escape': 'warn',
        'no-param-reassign': 'off',
        'no-redeclare': 'warn',
        'no-restricted-properties': 'off',
        'no-return-assign': 'warn',
        'no-return-await': 'warn',
        'no-script-url': 'warn',
        'no-self-assign': 'warn',
        'no-self-compare': 'warn',
        'no-sequences': 'warn',
        'no-throw-literal': 'warn',
        'no-unmodified-loop-condition': 'warn',
        'no-unused-expressions': 'warn',
        'no-unused-labels': 'warn',
        'no-useless-call': 'warn',
        'no-useless-catch': 'warn',
        'no-useless-concat': 'warn',
        'no-useless-return': 'warn',
        'no-void': 'warn',
        'no-warning-comments': 'warn',
        'no-with': 'warn',
        'prefer-named-capture-group': 'off',
        'prefer-promise-reject-errors': 'off',
        'radix': 'warn',
        'require-await': 'warn',
        'require-unicode-regexp': 'off',
        'vars-on-top': 'warn',
        'wrap-iife': 'warn',
        'yoda': 'warn',

        //Variables
        'init-declarations': 'off',
        'no-delete-var': 'warn',
        'no-label-var': 'warn',
        'no-restricted-globals': 'off',
        'no-shadow': 'warn',
        'no-shadow-restricted-names': 'warn',
        'no-undef': 'warn',
        'no-undef-init': 'off',
        'no-undefined': 'off',
        'no-unused-vars': 'off',
        //'no-unused-vars': ['warn', { vars: 'local', args: 'none' }],
        '@typescript-eslint/no-unused-vars': ['warn', { vars: 'local', args: 'none' }],
        'no-use-before-define': 'off',
        '@typescript-eslint/no-use-before-define': 'warn',

        //Node.js and CommonJS
        'callback-return': 'warn',
        'global-require': 'off',
        'handle-callback-err': 'off',
        'no-buffer-constructor': 'warn',
        'no-mixed-requires': 'warn',
        'no-new-require': 'warn',
        'no-path-concat': 'warn',
        'no-process-env': 'off',
        'no-process-exit': 'off',
        'no-restricted-modules': 'off',
        'no-sync': 'off',

        //Stylistic Issues
        'array-bracket-newline': ['warn', 'consistent'],
        'array-bracket-spacing': ['warn', 'always'],
        'array-element-newline': ['warn', 'consistent'],
        'block-spacing': ['warn', 'always'],
        'brace-style': ['warn', 'stroustrup', { allowSingleLine: true }],
        'camelcase': 'off',
        'capitalized-comments': 'off',
        'comma-dangle': ['warn', 'only-multiline'],
        'comma-spacing': ['warn', { before: false, after: true }],
        'comma-style': ['warn', 'last'],
        'computed-property-spacing': ['warn', 'never'],
        'consistent-this': ['warn', 'that'],
        'eol-last': ['warn', 'always'],
        'func-call-spacing': 'off',
        '@typescript-eslint/func-call-spacing': ['warn', 'never'],
        'func-name-matching': 'warn',
        'func-names': ['warn', 'as-needed'],
        'func-style': ['warn', 'declaration', { allowArrowFunctions: true }],
        'function-paren-newline': ['warn', 'consistent'],
        'id-blacklist': 'off',
        'id-length': ['warn', { min: 1, max: 55 }],
        'id-match': 'off',
        'implicit-arrow-linebreak': ['warn', 'beside'],
        'indent': "off",
        '@typescript-eslint/indent': ['warn', 'tab'],
        'key-spacing': ['warn', { beforeColon: false, afterColon: true }],
        'keyword-spacing': ['warn', { before: true, after: true }],
        'line-comment-position': 'off',
        'linebreak-style': ['warn', 'windows'],
        'lines-around-comment': 'off',
        'lines-between-class-members': ['warn', 'always', { exceptAfterSingleLine: true }],
        'max-depth': ['warn', 6],
        'max-len': ['warn', { code: 240, tabWidth: 4 }],
        'max-lines': 'off',
        'max-lines-per-function': ['warn', { max: 70 }],
        'max-nested-callbacks': ['warn', { max: 10 }],
        'max-params': 'off',
        'max-statements': 'off',
        'max-statements-per-line': ['warn', { max: 2 }],
        'multiline-comment-style': 'off',
        'multiline-ternary': ['warn', 'always-multiline'],
        'new-cap': ['warn', { newIsCap: true, capIsNew: false, properties: false }],
        'new-parens': ['warn'],
        'newline-per-chained-call': ['warn', { ignoreChainWithDepth: 3 }],
        'no-array-constructor': 'off',
        '@typescript-eslint/no-array-constructor': 'off',
        'no-bitwise': ['warn', { int32Hint: true }],
        'no-continue': 'warn',
        'no-inline-comments': 'off',
        'no-lonely-if': 'warn',
        'no-mixed-operators': 'warn',
        'no-mixed-spaces-and-tabs': ['warn', 'smart-tabs'],
        'no-multi-assign': 'warn',
        'no-multiple-empty-lines': ['warn', { max: 1, maxEOF: 1, maxBOF: 0 }],
        'no-negated-condition': 'off',
        'no-nested-ternary': 'warn',
        'no-new-object': 'off',
        'no-plusplus': 'off',
        'no-restricted-syntax': 'off',
        'no-tabs': 'off',
        'no-ternary': 'off',
        'no-trailing-spaces': 'warn',
        'no-underscore-dangle': 'off',
        'no-unneeded-ternary': 'warn',
        'no-whitespace-before-property': 'warn',
        'nonblock-statement-body-position': ['warn', 'beside'],
        'object-curly-newline': ['warn', { consistent: true }],
        'object-curly-spacing': ['warn', 'always'],
        'object-property-newline': ['warn', { allowAllPropertiesOnSameLine: true }],
        'one-var': ['warn', 'never'],
        'one-var-declaration-per-line': ['warn', 'always'],
        'operator-assignment': ['warn', 'always'],
        'operator-linebreak': ['warn', 'after'],
        'padded-blocks': ['warn', 'never'],
        'padding-line-between-statements': 'off',
        'prefer-object-spread': 'off',
        'quote-props': ['warn', 'consistent-as-needed'],
        'quotes': ['warn', 'single'],
        'semi': 'off',
        '@typescript-eslint/semi': ['warn', 'always'],
        'semi-spacing': ['warn', { before: false, after: true }], 
        'semi-style': ['warn', 'last'],
        'sort-keys': 'off',
        'sort-vars': 'off',
        'space-before-blocks': ['warn', 'always'],
        'space-before-function-paren': ['warn', 'never'],
        'space-in-parens': ['warn', 'never'],
        'space-infix-ops': ['warn'],
        'space-unary-ops': ['warn', { words: true, nonwords: false }],
        'spaced-comment': 'off',
        'switch-colon-spacing': ['warn', { before: false, after: true }],
        'template-tag-spacing': ['warn', 'always'],
        'unicode-bom': 'off',
        'wrap-regex': ['warn'],
        //@typescript-eslint specific - Overridden rules are next to their eslint counterpart.
        //Documentation at https://github.com/typescript-eslint/typescript-eslint/tree/v1.12.0/packages/eslint-plugin/docs/rules
        '@typescript-eslint/adjacent-overload-signatures': 'warn',
        '@typescript-eslint/array-type': ['warn', { default: 'generic' }],
        '@typescript-eslint/await-thenable': 'off',
        '@typescript-eslint/ban-ts-ignore': 'error',
        '@typescript-eslint/ban-types': [
            'error',
            {
                types: {
                    String: { message: "Use 'string' instead.", fixWith: 'string' },
                    Number: { message: "Use 'number' instead.", fixWith: 'number' },
                    Boolean: { message: "Use 'boolean' instead.", fixWith: 'boolean' }
                }
            }
        ],
        '@typescript-eslint/camelcase': 'off',
        '@typescript-eslint/class-name-casing': 'error',
        '@typescript-eslint/consistent-type-definitions': 'off',
        '@typescript-eslint/explicit-function-return-type': ['error', { allowExpressions: true }],
        '@typescript-eslint/explicit-member-accessibility': ['error', { accessibility: 'explicit', overrides: { constructors: 'off' } }],
        '@typescript-eslint/generic-type-naming': ['warn', '^T[A-Z][a-zA-Z]+$'],
        '@typescript-eslint/interface-name-prefix': ['warn', 'always'],
        '@typescript-eslint/member-delimiter-style': [
            'error',
            { multiline: { delimiter: 'semi', requireLast: true }, singleline: { delimiter: 'semi', requireLast: true } }
        ],
        '@typescript-eslint/member-naming': ['warn', { private: '^_', protected: '^[_|a-z]', public: '^[a-z|A-Z]' }],
        '@typescript-eslint/member-ordering': ['warn', { classes: ['static-field', 'instance-field', 'constructor', 'static-method', 'instance-method'] }],
        '@typescript-eslint/no-angle-bracket-type-assertion': 'off',
        '@typescript-eslint/no-empty-interface': 'off',
        '@typescript-eslint/no-explicit-any': 'warn',
        '@typescript-eslint/no-extraneous-class': 'off',
        '@typescript-eslint/no-for-in-array': 'error',
        '@typescript-eslint/no-inferrable-types': 'off',
        '@typescript-eslint/no-misused-new': 'error',
        '@typescript-eslint/no-namespace': ['error', { allowDeclarations: true, allowDefinitionFiles: true }],
        '@typescript-eslint/no-non-null-assertion': 'error', 
        '@typescript-eslint/no-parameter-properties': ['error', { allows: ['private', 'private readonly'] }],
        '@typescript-eslint/no-require-imports': 'off',
        '@typescript-eslint/no-this-alias': 'error',
        '@typescript-eslint/triple-slash-reference': ['error', { path: 'never', types: 'never', lib: 'never' }],
        '@typescript-eslint/no-type-alias': 'off',
        '@typescript-eslint/no-unnecessary-qualifier': 'off',
        '@typescript-eslint/no-unnecessary-type-assertion': 'off',
        '@typescript-eslint/no-useless-constructor': 'warn',
        '@typescript-eslint/no-var-requires': 'off',
        '@typescript-eslint/prefer-for-of': 'off',
        '@typescript-eslint/prefer-function-type': 'off',
        '@typescript-eslint/prefer-interface': 'off',
        '@typescript-eslint/prefer-namespace-keyword': 'off',
        '@typescript-eslint/prefer-regexp-exec': 'off',
        '@typescript-eslint/prefer-string-starts-ends-with': 'off',
        '@typescript-eslint/promise-function-async': 'off',
        '@typescript-eslint/strict-boolean-expressions': 'off',
        '@typescript-eslint/unified-signatures': 'warn'
    }
};
AbelHu commented 4 years ago

@dbaeumer I have disabled esline in my vscode with below settings but it still does not work.

"editor.codeActionsOnSave": {
"source.fixAll.eslint": false
}

I still hit this issue even if I disable "Format on Save" and reboot VSCode. I only do not hit this issue after I disabled "GO" extension (Version 0.13.1).

The repo is not public so I cannot share it with you.

dbaeumer commented 4 years ago

@AbelHu this sounds like a problem with the Go extension then and has nothing to do with ESLint.

dbaeumer commented 4 years ago

@Polantaris any chance you could share your project with me so that I can try to reproduce this?

AbelHu commented 4 years ago

Thanks, @dbaeumer . My issue should be casued by https://github.com/microsoft/vscode-go/issues/3063. You can igonre it.

Polantaris commented 4 years ago

@dbaeumer Unfortunately my project is a private repository not even on Github, but let me see if I can reproduce it with a smaller project example today.

Polantaris commented 4 years ago

I haven't been able to reproduce it in a smaller project, but now I also don't have it happening anymore even on the repositories that had issues before. No configuration changes have been done on my side outside of what I mentioned previously and it looks like there have been no updates to eslint nor vscode itself either. I'm really confused as to what's going on at this point.

I'm going to keep an eye on this and if I see it again try to reproduce it right at the moment it starts happening, but until I start seeing the behavior again I can't give any more details.

dbaeumer commented 4 years ago

@Polantaris thanks for getting back and your willingness to provide additional data.

threehams commented 4 years ago

This likely isn't helpful, but this is happening inconsistently in our large private project as well (>400K LOC). I've done some minor work on the extension, but I'm unsure of where to start debugging this one since I don't really understand the underlying change in VS Code.

I'll try to dig into it tomorrow or the next day, though.

dbaeumer commented 4 years ago

Here is some background for those that want to dig into this:

To get a better understanding why this is happening it would be could if the user seeing this could either:

threehams commented 4 years ago

Trace. Can provide any other information you'd like, too.

[Info  - 12:31:41 PM] ESLint server stopped.
[Trace - 12:31:42 PM] Sending request 'initialize - (0)'.
[Trace - 12:31:42 PM] Received notification 'window/logMessage'.
[Info  - 12:31:42 PM] ESLint server running in node v12.8.1
[Trace - 12:31:42 PM] Received notification '$/progress'.
[Trace - 12:31:42 PM] Received notification '$/progress'.
[Trace - 12:31:42 PM] Received response 'initialize - (0)' in 100ms.
[Info  - 12:31:42 PM] ESLint server is running.
[Trace - 12:31:42 PM] Sending notification 'initialized'.
[Trace - 12:31:42 PM] Sending notification 'textDocument/didOpen'.
[Trace - 12:31:42 PM] Sending notification 'textDocument/didOpen'.
[Trace - 12:31:42 PM] Received request 'client/registerCapability - (0)'.
[Trace - 12:31:42 PM] Sending response 'client/registerCapability - (0)'. Processing request took 0ms
[Trace - 12:31:42 PM] Received request 'client/registerCapability - (1)'.
[Trace - 12:31:42 PM] Sending response 'client/registerCapability - (1)'. Processing request took 0ms
[Trace - 12:31:42 PM] Received request 'workspace/configuration - (2)'.
[Trace - 12:31:42 PM] Sending response 'workspace/configuration - (2)'. Processing request took 28ms
[Trace - 12:31:42 PM] Received request 'workspace/configuration - (3)'.
[Trace - 12:31:42 PM] Sending response 'workspace/configuration - (3)'. Processing request took 6ms
[Trace - 12:31:42 PM] 'npm config get prefix' value is: /Users/dedmondson/.nvm/versions/node/v12.13.0
[Trace - 12:31:42 PM] NODE_PATH value is: /Users/dedmondson/.nvm/versions/node/v12.13.0/lib/node_modules
[Trace - 12:31:42 PM] NODE_PATH value is: /Users/dedmondson/.nvm/versions/node/v12.13.0/lib/node_modules
[Trace - 12:31:42 PM] Received notification 'window/logMessage'.
[Info  - 12:31:42 PM] ESLint library loaded from: /Users/dedmondson/workspace/abp-frontend/node_modules/eslint/lib/api.js
[Trace - 12:31:44 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 12:31:44 PM] Received notification 'eslint/status'.
[Trace - 12:31:44 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 12:31:44 PM] Received notification 'eslint/status'.
[Trace - 12:31:46 PM] Sending notification 'textDocument/didOpen'.
[Trace - 12:31:46 PM] Received request 'workspace/configuration - (4)'.
[Trace - 12:31:46 PM] Sending response 'workspace/configuration - (4)'. Processing request took 1ms
[Trace - 12:31:46 PM] NODE_PATH value is: /Users/dedmondson/.nvm/versions/node/v12.13.0/lib/node_modules
[Trace - 12:31:51 PM] Sending notification 'textDocument/didChange'.
[Trace - 12:31:52 PM] Sending request 'textDocument/codeAction - (1)'.
[Trace - 12:32:19 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 12:32:19 PM] Received notification 'eslint/status'.
[Trace - 12:32:20 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 12:32:20 PM] Received notification 'eslint/status'.
[Trace - 12:32:20 PM] Received response 'textDocument/codeAction - (1)' in 27794ms.
[Trace - 12:32:20 PM] Sending notification 'textDocument/didSave'.

The next three saves happened quickly:

[Trace - 12:33:41 PM] Sending notification 'textDocument/didChange'.
[Trace - 12:33:41 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 12:33:41 PM] Received notification 'eslint/status'.
[Trace - 12:33:41 PM] Sending request 'textDocument/codeAction - (2)'.
[Trace - 12:33:41 PM] Received response 'textDocument/codeAction - (2)' in 0ms.
[Trace - 12:33:41 PM] Sending notification 'textDocument/didSave'.
[Trace - 12:34:05 PM] Sending request 'textDocument/codeAction - (3)'.
[Trace - 12:34:05 PM] Received response 'textDocument/codeAction - (3)' in 1ms.
[Trace - 12:34:05 PM] Sending notification 'textDocument/didSave'.
[Trace - 12:34:16 PM] Sending notification 'textDocument/didChange'.
[Trace - 12:34:16 PM] Received notification 'textDocument/publishDiagnostics'.
[Trace - 12:34:16 PM] Received notification 'eslint/status'.
[Trace - 12:34:16 PM] Sending request 'textDocument/codeAction - (4)'.
[Trace - 12:34:16 PM] Received response 'textDocument/codeAction - (4)' in 0ms.
[Trace - 12:34:16 PM] Sending notification 'textDocument/didSave'.

I can also try to take a smaller project and blow it up to be much bigger for reproduction later today.

edit: May be coincidence, but this time matches up pretty well with the time needed to start up the TypeScript language service on this project. This only occurs when enabling @typescript-eslint/parser, and occurs even if no rules are enabled. When I get the time, I'll see if it's the initial worker creation that's holding everything up.

more edit: So far, I can just confirm that ts.createWatchProgram() is taking a long time to start on our project, which is called from @typescript-eslint/typescript-estree. This accounts for the first save action taking a little while (it's about a 15 second startup time). Unfortunately, the issue we're seeing - constant save action delays - only occurs occasionally, and I haven't been able to trigger that in the last 30 minutes.

The next time I reproduce this, I should be able to get more information on why the watch program appears to be getting created more than once per session.

dbaeumer commented 4 years ago

The problem is very likely this:

[Trace - 12:32:20 PM] Received response 'textDocument/codeAction - (1)' in 27794ms

Fix on save is implemented using code actions on save. Since the request takes ~30seconds you see that dialog.

I am actually not sure what I can do about this. I have no influence on the startup not can I cancel it since ESLint itself is not implemented in a async fashion.

Do you see the same delay when validating files the first time in the terminal ?

vscodebot[bot] commented 4 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!

dbaeumer commented 4 years ago

I am reopening to allow to provide additional informaiton.

ligouhai commented 4 years ago

我很乐意尝试任何方法来修复它,我现在不得不禁用 eslint 插件,因为每次保存可能需要5分钟以上的时间来完成,但这不是一个长期的解决方案。

I'm also experiencing this on VSCode 1.42.1 with the latest eslint plugin. Unfortunately my repo is private and also very large, so I don't really have any code to share, however my settings.json is below.

{
  "editor.insertSpaces": false,
  "editor.wordWrap": "on",
  "editor.formatOnSave": false,
  "[html]": {
      "editor.formatOnSave": true
  },
  "eslint.autoFixOnSave": true,
  "editor.formatOnPaste": true,
  "typescript.tsdk": "[private repo]/node_modules/typescript/lib",
  "html.format.wrapAttributes": "preserve-aligned",
  "html.format.wrapLineLength": 240,
  "eslint.validate": [
      "javascript",
      {
          "language": "typescript",
          "autoFix": true,
      }
  ],
  "eslint.run": "onType",
  "eslint.trace.server": "messages",
  "eslint.workingDirectories": [
      {
          "directory": "[private repo]",
          "changeProcessCWD": true
      }
  ],
  "javascript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
  "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": true,
  "editor.codeActionsOnSave": {
      "source.fixAll.eslint": true
  },
  "eslint.enable": true
}

I'm happy to try anything to fix it, I've had to disable the eslint plugin for now because every save can take an upwards of five minutes to complete, however that's not a long term solution.

I have also encountered this problem, and now I have the same solution as you, which is to disable the eslint plug-in every time I encounter this problem and enable it later.

dbaeumer commented 4 years ago

@ligouhai can you please provide me with a GitHub repository I can clone that demos what you are experiencing.

octref commented 4 years ago

@dbaeumer I think you didn't press reopen, so I did that for you :p

vscodebot[bot] commented 4 years ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!