Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coc-vetur doesn't update diagnostics #18

Closed
andbar-ru opened this issue Oct 10, 2019 · 12 comments
Closed

coc-vetur doesn't update diagnostics #18

andbar-ru opened this issue Oct 10, 2019 · 12 comments

Comments

@andbar-ru
Copy link

andbar-ru commented Oct 10, 2019

Thanks for your work!

Coc-vetur doesn't update diagnostics in vue applications with typescript and imported external typescript modules. I have created minimal vue application with vue create as an example of this issue: https://github.com/andbar-ru/test-app

File https://github.com/andbar-ru/test-app/blob/master/src/components/HelloWorld.vue has error "[Vetur 2322] [E] Type '{ a: string; b: string; c: string; }' is not assignable to type 'ITestObject'." on the line 50 ("c: 'c',") But if I uncomment line 4 in the file https://github.com/andbar-ru/test-app/blob/master/src/components/types.ts to resolve this error, Vetur doesn't update diagnostic info and continues to show this error. Editing and saving file or reloading it doesn't help. Only reloading extension with the command :call CocAction('reloadExtension', 'coc-vetur') makes coc-vetur to update diagnostics. The same happens if then comment line 4 in the file types.ts -- coc-vetur doesn't show error in the file HelloWorld.vue until reloading extension. This issue happens in the last gvim and neovim (appImages)

VSCode's vetur updates diagnostics without problems.

Installed coc extensions:
coc-tsserver
coc-vetur
coc-eslint
coc-prettier
coc-json
coc-css

coc-settings.json:

{
  "coc.preferences.colorSupport": false,
  "coc.preferences.currentFunctionSymbolAutoUpdate": false,
  "codeLens.enable": true,
  "diagnostic.errorSign": "E",
  "diagnostic.warningSign": "W",
  "diagnostic.infoSign": "I",
  "diagnostic.hintSign": "H",
  "diagnostic.virtualText": false,
  "suggest.autoTrigger": "none",
  "suggest.noselect": false,
  "eslint.run": "onSave",
  "eslint.filetypes": ["javascript", "typescript", "vue"],
}

If you need more info, I will provide.

@chemzqm
Copy link
Member

chemzqm commented Oct 10, 2019

@andbar-ru
Copy link
Author

andbar-ru commented Oct 11, 2019

This is the output of vetur's CocCommand workspace.showOutput.

vetur's debug output
[Trace - 12:09:11 AM] Sending request 'initialize - (0)'.
Params: {
    "processId": 15399,
    "rootPath": "/home/wind/tmp/test-app",
    "rootUri": "file:///home/wind/tmp/test-app",
    "capabilities": {
        "workspace": {
            "applyEdit": true,
            "workspaceEdit": {
                "documentChanges": true,
                "resourceOperations": [
                    "create",
                    "rename",
                    "delete"
                ],
                "failureHandling": "textOnlyTransactional"
            },
            "didChangeConfiguration": {
                "dynamicRegistration": true
            },
            "didChangeWatchedFiles": {
                "dynamicRegistration": true
            },
            "symbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                }
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true
            },
            "synchronization": {
                "dynamicRegistration": true,
                "willSave": true,
                "willSaveWaitUntil": true,
                "didSave": true
            },
            "completion": {
                "dynamicRegistration": true,
                "contextSupport": true,
                "completionItem": {
                    "snippetSupport": true,
                    "commitCharactersSupport": true,
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "deprecatedSupport": true,
                    "preselectSupport": true
                },
                "completionItemKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25
                    ]
                }
            },
            "hover": {
                "dynamicRegistration": true,
                "contentFormat": [
                    "markdown",
                    "plaintext"
                ]
            },
            "signatureHelp": {
                "dynamicRegistration": true,
                "signatureInformation": {
                    "documentationFormat": [
                        "markdown",
                        "plaintext"
                    ],
                    "parameterInformation": {
                        "labelOffsetSupport": true
                    }
                }
            },
            "definition": {
                "dynamicRegistration": true
            },
            "references": {
                "dynamicRegistration": true
            },
            "documentHighlight": {
                "dynamicRegistration": true
            },
            "documentSymbol": {
                "dynamicRegistration": true,
                "symbolKind": {
                    "valueSet": [
                        1,
                        2,
                        3,
                        4,
                        5,
                        6,
                        7,
                        8,
                        9,
                        10,
                        11,
                        12,
                        13,
                        14,
                        15,
                        16,
                        17,
                        18,
                        19,
                        20,
                        21,
                        22,
                        23,
                        24,
                        25,
                        26
                    ]
                }
            },
            "codeAction": {
                "dynamicRegistration": true,
                "codeActionLiteralSupport": {
                    "codeActionKind": {
                        "valueSet": [
                            "",
                            "quickfix",
                            "refactor",
                            "refactor.extract",
                            "refactor.inline",
                            "refactor.rewrite",
                            "source",
                            "source.organizeImports"
                        ]
                    }
                }
            },
            "codeLens": {
                "dynamicRegistration": true
            },
            "formatting": {
                "dynamicRegistration": true
            },
            "rangeFormatting": {
                "dynamicRegistration": true
            },
            "onTypeFormatting": {
                "dynamicRegistration": true
            },
            "rename": {
                "dynamicRegistration": true,
                "prepareSupport": true
            },
            "documentLink": {
                "dynamicRegistration": true
            },
            "typeDefinition": {
                "dynamicRegistration": true
            },
            "implementation": {
                "dynamicRegistration": true
            },
            "declaration": {
                "dynamicRegistration": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            }
        }
    },
    "initializationOptions": {
        "config": {
            "vetur": {
                "useWorkspaceDependencies": false,
                "completion": {
                    "autoImport": true,
                    "useScaffoldSnippets": true,
                    "tagCasing": "kebab"
                },
                "validation": {
                    "template": true,
                    "style": true,
                    "script": true
                },
                "format": {
                    "enable": true,
                    "options": {
                        "tabSize": 2,
                        "useTabs": false
                    },
                    "defaultFormatter": {
                        "html": "prettyhtml",
                        "css": "prettier",
                        "postcss": "prettier",
                        "scss": "prettier",
                        "less": "prettier",
                        "stylus": "stylus-supremacy",
                        "js": "prettier",
                        "ts": "prettier"
                    },
                    "defaultFormatterOptions": {
                        "js-beautify-html": {
                            "wrap_attributes": "force-expand-multiline"
                        },
                        "prettyhtml": {
                            "printWidth": 100,
                            "singleQuote": false,
                            "wrapAttributes": false,
                            "sortAttributes": false
                        }
                    },
                    "styleInitialIndent": false,
                    "scriptInitialIndent": false
                },
                "trace": {
                    "server": "verbose"
                },
                "dev": {
                    "logLevel": "INFO"
                },
                "experimental": {
                    "templateInterpolationService": false
                }
            },
            "emmet": {},
            "html": {},
            "javascript": {
                "showUnused": true,
                "updateImportsOnFileMove": {
                    "enable": true
                },
                "implementationsCodeLens": {
                    "enable": true
                },
                "referencesCodeLens": {
                    "enable": true
                },
                "preferences": {
                    "importModuleSpecifier": "non-relative",
                    "quoteStyle": "single"
                },
                "validate": {
                    "enable": true
                },
                "suggestionActions": {
                    "enabled": true
                },
                "suggest": {
                    "names": true,
                    "enabled": true,
                    "paths": true,
                    "autoImports": true,
                    "completeFunctionCalls": true
                },
                "format": {
                    "insertSpaceAfterCommaDelimiter": true,
                    "insertSpaceAfterConstructor": false,
                    "insertSpaceAfterSemicolonInForStatements": true,
                    "insertSpaceBeforeAndAfterBinaryOperators": true,
                    "insertSpaceAfterKeywordsInControlFlowStatements": true,
                    "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
                    "insertSpaceBeforeFunctionParenthesis": false,
                    "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
                    "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
                    "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
                    "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
                    "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
                    "insertSpaceAfterTypeAssertion": false,
                    "placeOpenBraceOnNewLineForFunctions": false,
                    "placeOpenBraceOnNewLineForControlBlocks": false
                }
            },
            "typescript": {
                "showUnused": true,
                "updateImportsOnFileMove": {
                    "enable": true
                },
                "implementationsCodeLens": {
                    "enable": true
                },
                "referencesCodeLens": {
                    "enable": true
                },
                "preferences": {
                    "importModuleSpecifier": "non-relative",
                    "quoteStyle": "single"
                },
                "suggestionActions": {
                    "enabled": true
                },
                "validate": {
                    "enable": true
                },
                "suggest": {
                    "enabled": true,
                    "paths": true,
                    "autoImports": true,
                    "completeFunctionCalls": true
                },
                "format": {
                    "insertSpaceAfterCommaDelimiter": true,
                    "insertSpaceAfterConstructor": false,
                    "insertSpaceAfterSemicolonInForStatements": true,
                    "insertSpaceBeforeAndAfterBinaryOperators": true,
                    "insertSpaceAfterKeywordsInControlFlowStatements": true,
                    "insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
                    "insertSpaceBeforeFunctionParenthesis": false,
                    "insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
                    "insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
                    "insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
                    "insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
                    "insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
                    "insertSpaceAfterTypeAssertion": false,
                    "placeOpenBraceOnNewLineForFunctions": false,
                    "placeOpenBraceOnNewLineForControlBlocks": false
                }
            },
            "prettier": {
                "formatterPriority": 1,
                "disableLanguages": [
                    "vue"
                ],
                "eslintIntegration": false,
                "tslintIntegration": false,
                "stylelintIntegration": false,
                "requireConfig": false,
                "onlyUseLocalVersion": false,
                "disableSuccessMessage": false,
                "statusItemText": "Prettier",
                "ignorePath": ".prettierignore",
                "printWidth": 80,
                "tabWidth": 2,
                "singleQuote": false,
                "trailingComma": "none",
                "bracketSpacing": true,
                "jsxBracketSameLine": false,
                "jsxSingleQuote": false,
                "htmlWhitespaceSensitivity": "css",
                "endOfLine": "auto",
                "parser": "babylon",
                "semi": true,
                "useTabs": false,
                "proseWrap": "preserve",
                "arrowParens": "avoid"
            },
            "stylusSupremacy": {}
        },
        "globalSnippetDir": "/home/wind/.config/Code/User/snippets/vetur"
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///home/wind/tmp/test-app",
            "name": "test-app"
        }
    ]
}

[Trace - 12:09:12 AM] Received notification 'window/logMessage'.
Params: {
"type": 4,
"message": "Loaded bundled typescript@3.6.3."
}

Loaded bundled typescript@3.6.3.
[Trace - 12:09:12 AM] Received notification 'window/logMessage'.
Params: {
"type": 4,
"message": "Vetur initialized"
}

Vetur initialized
[Trace - 12:09:12 AM] Received response 'initialize - (0)' in 1387ms.
Result: {
"capabilities": {
"textDocumentSync": 1,
"completionProvider": {
"resolveProvider": true,
"triggerCharacters": [
".",
":",
"<",
""",
"'",
"/",
"@",
"*"
]
},
"signatureHelpProvider": {
"triggerCharacters": [
"("
]
},
"documentFormattingProvider": false,
"hoverProvider": true,
"documentHighlightProvider": true,
"documentLinkProvider": {
"resolveProvider": false
},
"documentSymbolProvider": true,
"definitionProvider": true,
"referencesProvider": true,
"codeActionProvider": true,
"colorProvider": true
}
}

[Trace - 12:09:12 AM] Sending notification 'initialized'.
Params: {}

[Trace - 12:09:12 AM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
"settings": {
"vetur": {
"useWorkspaceDependencies": false,
"completion": {
"autoImport": true,
"useScaffoldSnippets": true,
"tagCasing": "kebab"
},
"validation": {
"template": true,
"style": true,
"script": true
},
"format": {
"enable": true,
"options": {
"tabSize": 2,
"useTabs": false
},
"defaultFormatter": {
"html": "prettyhtml",
"css": "prettier",
"postcss": "prettier",
"scss": "prettier",
"less": "prettier",
"stylus": "stylus-supremacy",
"js": "prettier",
"ts": "prettier"
},
"defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "force-expand-multiline"
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
},
"styleInitialIndent": false,
"scriptInitialIndent": false
},
"trace": {
"server": "verbose"
},
"dev": {
"logLevel": "INFO"
},
"experimental": {
"templateInterpolationService": false
}
},
"emmet": {},
"html": {},
"javascript": {
"showUnused": true,
"updateImportsOnFileMove": {
"enable": true
},
"implementationsCodeLens": {
"enable": true
},
"referencesCodeLens": {
"enable": true
},
"preferences": {
"importModuleSpecifier": "non-relative",
"quoteStyle": "single"
},
"validate": {
"enable": true
},
"suggestionActions": {
"enabled": true
},
"suggest": {
"names": true,
"enabled": true,
"paths": true,
"autoImports": true,
"completeFunctionCalls": true
},
"format": {
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterConstructor": false,
"insertSpaceAfterSemicolonInForStatements": true,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
"insertSpaceBeforeFunctionParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
"insertSpaceAfterTypeAssertion": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
},
"typescript": {
"showUnused": true,
"updateImportsOnFileMove": {
"enable": true
},
"implementationsCodeLens": {
"enable": true
},
"referencesCodeLens": {
"enable": true
},
"preferences": {
"importModuleSpecifier": "non-relative",
"quoteStyle": "single"
},
"suggestionActions": {
"enabled": true
},
"validate": {
"enable": true
},
"suggest": {
"enabled": true,
"paths": true,
"autoImports": true,
"completeFunctionCalls": true
},
"format": {
"insertSpaceAfterCommaDelimiter": true,
"insertSpaceAfterConstructor": false,
"insertSpaceAfterSemicolonInForStatements": true,
"insertSpaceBeforeAndAfterBinaryOperators": true,
"insertSpaceAfterKeywordsInControlFlowStatements": true,
"insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
"insertSpaceBeforeFunctionParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets": false,
"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces": false,
"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces": false,
"insertSpaceAfterTypeAssertion": false,
"placeOpenBraceOnNewLineForFunctions": false,
"placeOpenBraceOnNewLineForControlBlocks": false
}
},
"prettier": {
"formatterPriority": 1,
"disableLanguages": [
"vue"
],
"eslintIntegration": false,
"tslintIntegration": false,
"stylelintIntegration": false,
"requireConfig": false,
"onlyUseLocalVersion": false,
"disableSuccessMessage": false,
"statusItemText": "Prettier",
"ignorePath": ".prettierignore",
"printWidth": 80,
"tabWidth": 2,
"singleQuote": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"htmlWhitespaceSensitivity": "css",
"endOfLine": "auto",
"parser": "babylon",
"semi": true,
"useTabs": false,
"proseWrap": "preserve",
"arrowParens": "avoid"
},
"stylusSupremacy": {}
}
}

[Trace - 12:09:12 AM] Sending notification 'textDocument/didOpen'.
Params: {
"textDocument": {
"uri": "file:///home/wind/tmp/test-app/src/components/HelloWorld.vue",
"languageId": "vue",
"version": 1,
"text": "\n <div class="hello">\n

{{ msg }}

\n

\n For a guide and recipes on how to configure / customize this project,
\n check out the\n <a href="https://cli.vuejs.org\" target="_blank" rel="noopener">vue-cli documentation.\n

\n

Installed CLI Plugins

\n \n

Essential Links

\n \n

Ecosystem

\n \n

{{testObject.c}}

\n \n\n\n<script lang="ts">\nimport Vue from 'vue'\nimport { ITestObject } from './types'\n\nexport default Vue.extend({\n name: 'HelloWorld',\n props: {\n msg: String,\n },\n data (): {\n testObject: ITestObject,\n } {\n return {\n testObject: {\n a: 'a',\n b: 'b',\n c: 'c',\n }\n }\n }\n});\n</script>\n\n\n<style scoped>\nh3 {\n margin: 40px 0 0;\n}\nul {\n list-style-type: none;\n padding: 0;\n}\nli {\n display: inline-block;\n margin: 0 10px;\n}\na {\n color: #42b983;\n}\n</style>\n"
}
}

[Trace - 12:09:12 AM] Received request 'client/registerCapability - (0)'.
Params: {
"registrations": [
{
"id": "c4c7c197-8996-4992-8709-591f6a166522",
"method": "textDocument/formatting",
"registerOptions": {
"documentSelector": [
"vue"
]
}
}
]
}

[Trace - 12:09:12 AM] Sending response 'client/registerCapability - (0)'. Processing request took 0ms
No result returned.

[Trace - 12:09:14 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/wind/tmp/test-app/src/components/HelloWorld.vue",
"diagnostics": []
}

All lines just after running command. No new lines if I comment or uncomment line 4 in types.ts

I added

"vetur.trace.server": "verbose"

into seetings.json of VSCode.
If I change types.ts VSCode's vetur writes to log:

trace
[Trace - 1:49:53 AM] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///home/wind/tmp/test-app/src/components/types.ts",
            "type": 2
        }
    ]
}

[Trace - 1:49:54 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
"uri": "file:///home/wind/tmp/test-app/src/components/HelloWorld.vue",
"diagnostics": [
{
"range": {
"start": {
"line": 49,
"character": 8
},
"end": {
"line": 49,
"character": 14
}
},
"severity": 1,
"message": "Type '{ a: string; b: string; c: string; }' is not assignable to type 'ITestObject'.\n Object literal may only specify known properties, and 'c' does not exist in type 'ITestObject'.",
"tags": [],
"code": 2322,
"source": "Vetur"
}
]
}

So, coc-vetur doesn't watch changes in imported *.ts files.

coc-vetur's and vscode-vetur's log files differ very much. I can't guess crucial settings that allow vetur to watch *.ts files.

@chemzqm
Copy link
Member

chemzqm commented Oct 12, 2019

vetur only works on vue files.

@andbar-ru
Copy link
Author

andbar-ru commented Oct 12, 2019

However, coc-vetur watches imported *.js and *.ts files after reloading when first opening *.vue files. Link to the same issue in original vetur, already closed: vuejs/vetur#626.

@chemzqm
Copy link
Member

chemzqm commented Oct 12, 2019

The language client watching js and ts files https://github.com/neoclide/coc-vetur/blob/master/src/index.ts#L63, it's problem of vetur.

@andbar-ru
Copy link
Author

But vetur in VSCode hasn't this problem already and watches updates in associated *.ts and *js files without restarting.

@chemzqm
Copy link
Member

chemzqm commented Oct 12, 2019

Could be it's using old vetur, just updated.

@andbar-ru
Copy link
Author

andbar-ru commented Oct 12, 2019

Unfortunately, that didn't solve the problem. Probably, vue-language-server is responsible for that. coc-vetur uses pretty old version 0.0.62, but 0.22.4 is available.

Sorry: 0.22.4 is about vetur.

@chemzqm
Copy link
Member

chemzqm commented Oct 12, 2019

You should check https://www.npmjs.com/package/vue-language-server

@andbar-ru
Copy link
Author

andbar-ru commented Oct 12, 2019

It turns out createFileSystemWatcher uses watchman. The problem has been solved after I installed it. Thanks for pointing the way. I feel this aspect should be documented.

@arttobe
Copy link

arttobe commented Jan 25, 2020

I am running in the same issue, how did you exactly resolve it

@andbar-ru
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants