neoclide / coc-vetur

Vue language server extension for coc.nvim
219 stars 7 forks source link

templateInterpolationService not showing diagnostics in the latest version #51

Closed JoosepAlviste closed 4 years ago

JoosepAlviste commented 4 years ago

Hey! I upgraded to the new version of coc-vetur (version 1.13.0) and it seems like the diagnostics in templates are not shown anymore when I've enabled vetur.experimental.templateInterpolationService. I can see that the type information is correctly shown (hovering works), but errors are not shown anymore.

Here's a screenshot illustrating a problem side-by-side with VSCode:

image

On the left picture is coc-vetur which doesn't show the type error and on the right is VSCode which shows the correct error.

I can temporarily downgrade coc-vetur to version 1.12.0 to fix this.


Here's the example code (project generated with Vue CLI):

<template>
  <div>{{ count.length }}</div>
</template>

<script lang="ts">
import { ref } from "vue";

export default {
  setup() {
    const count = ref(0);
    return { count };
  }
};
</script>
Here's the verbose log output if it helps.
[Trace - 9:17:03 PM] Sending request 'initialize - (0)'.
Params: {
    "processId": 6390,
    "rootPath": "",
    "rootUri": "file:///",
    "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
                    ]
                },
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                }
            },
            "executeCommand": {
                "dynamicRegistration": true
            },
            "configuration": true,
            "workspaceFolders": true
        },
        "textDocument": {
            "publishDiagnostics": {
                "relatedInformation": true,
                "versionSupport": false,
                "tagSupport": {
                    "valueSet": [
                        1,
                        2
                    ]
                }
            },
            "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
                    ]
                },
                "hierarchicalDocumentSymbolSupport": true,
                "tagSupport": {
                    "valueSet": [
                        1
                    ]
                }
            },
            "codeAction": {
                "dynamicRegistration": true,
                "isPreferredSupport": 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,
                "tooltipSupport": true
            },
            "typeDefinition": {
                "dynamicRegistration": true
            },
            "implementation": {
                "dynamicRegistration": true
            },
            "declaration": {
                "dynamicRegistration": true
            },
            "colorProvider": {
                "dynamicRegistration": true
            },
            "foldingRange": {
                "dynamicRegistration": true,
                "rangeLimit": 5000,
                "lineFoldingOnly": true
            },
            "selectionRange": {
                "dynamicRegistration": true
            }
        },
        "window": {
            "workDoneProgress": 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": true
                }
            },
            "emmet": {
                "showExpandedAbbreviation": "always",
                "showAbbreviationSuggestions": true,
                "includeLanguages": {
                    "htmldjango": "html"
                },
                "variables": {},
                "syntaxProfiles": {},
                "excludeLanguages": [
                    "markdown"
                ],
                "showSuggestionsAsSnippets": true,
                "preferences": {},
                "optimizeStylesheetParsing": true,
                "priority": 3
            },
            "html": {},
            "javascript": {
                "showUnused": true,
                "updateImportsOnFileMove": {
                    "enable": true
                },
                "implementationsCodeLens": {
                    "enable": false
                },
                "referencesCodeLens": {
                    "enable": false
                },
                "preferences": {
                    "importModuleSpecifier": "auto",
                    "importModuleSpecifierEnding": "auto",
                    "quoteStyle": "single",
                    "useAliasesForRenames": true
                },
                "validate": {
                    "enable": true
                },
                "suggestionActions": {
                    "enabled": true
                },
                "suggest": {
                    "names": true,
                    "enabled": true,
                    "paths": true,
                    "autoImports": true,
                    "completeFunctionCalls": true,
                    "includeAutomaticOptionalChainCompletions": true
                },
                "format": {
                    "enabled": true,
                    "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,
                    "semicolons": "ignore"
                }
            },
            "typescript": {
                "showUnused": true,
                "updateImportsOnFileMove": {
                    "enable": true
                },
                "implementationsCodeLens": {
                    "enable": false
                },
                "referencesCodeLens": {
                    "enable": false
                },
                "preferences": {
                    "importModuleSpecifier": "auto",
                    "importModuleSpecifierEnding": "auto",
                    "quoteStyle": "auto",
                    "useAliasesForRenames": true
                },
                "suggestionActions": {
                    "enabled": true
                },
                "validate": {
                    "enable": true
                },
                "suggest": {
                    "enabled": true,
                    "paths": true,
                    "autoImports": true,
                    "completeFunctionCalls": true,
                    "includeAutomaticOptionalChainCompletions": true
                },
                "format": {
                    "enabled": true,
                    "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,
                    "semicolons": "ignore"
                },
                "workspaceSymbols": {
                    "scope": "allOpenProjects"
                }
            },
            "prettier": {
                "formatterPriority": 1,
                "disableLanguages": [
                    "vue"
                ],
                "eslintIntegration": true,
                "tslintIntegration": false,
                "stylelintIntegration": false,
                "requireConfig": false,
                "onlyUseLocalVersion": true,
                "disableSuccessMessage": false,
                "statusItemText": "Prettier",
                "ignorePath": ".prettierignore",
                "printWidth": 80,
                "tabWidth": 2,
                "singleQuote": true,
                "trailingComma": "all",
                "bracketSpacing": true,
                "jsxBracketSameLine": false,
                "jsxSingleQuote": false,
                "htmlWhitespaceSensitivity": "css",
                "endOfLine": "lf",
                "parser": "none",
                "semi": false,
                "useTabs": false,
                "proseWrap": "preserve",
                "arrowParens": "always"
            },
            "stylusSupremacy": {}
        },
        "globalSnippetDir": "/Library/Application Support/Code/User/snippets/vetur"
    },
    "trace": "verbose",
    "workspaceFolders": [
        {
            "uri": "file:///",
            "name": ""
        }
    ],
    "clientInfo": {
        "name": "coc.nvim",
        "version": "0.0.78"
    }
}

[Trace - 9:17:04 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "Loaded bundled typescript@4.0.2."
}

Loaded bundled typescript@4.0.2.
[Trace - 9:17:04 PM] Received notification 'window/logMessage'.
Params: {
    "type": 4,
    "message": "Vetur initialized"
}

Vetur initialized
[Trace - 9:17:04 PM] Received response 'initialize - (0)' in 756ms.
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,
        "executeCommandProvider": {
            "commands": [
                "vetur.applyRefactorCommand"
            ]
        },
        "foldingRangeProvider": true
    }
}

[Trace - 9:17:04 PM] Sending notification 'initialized'.
Params: {}

[Trace - 9:17:04 PM] 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": true
            }
        },
        "emmet": {
            "showExpandedAbbreviation": "always",
            "showAbbreviationSuggestions": true,
            "includeLanguages": {
                "htmldjango": "html"
            },
            "variables": {},
            "syntaxProfiles": {},
            "excludeLanguages": [
                "markdown"
            ],
            "showSuggestionsAsSnippets": true,
            "preferences": {},
            "optimizeStylesheetParsing": true,
            "priority": 3
        },
        "html": {},
        "javascript": {
            "showUnused": true,
            "updateImportsOnFileMove": {
                "enable": true
            },
            "implementationsCodeLens": {
                "enable": false
            },
            "referencesCodeLens": {
                "enable": false
            },
            "preferences": {
                "importModuleSpecifier": "auto",
                "importModuleSpecifierEnding": "auto",
                "quoteStyle": "single",
                "useAliasesForRenames": true
            },
            "validate": {
                "enable": true
            },
            "suggestionActions": {
                "enabled": true
            },
            "suggest": {
                "names": true,
                "enabled": true,
                "paths": true,
                "autoImports": true,
                "completeFunctionCalls": true,
                "includeAutomaticOptionalChainCompletions": true
            },
            "format": {
                "enabled": true,
                "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,
                "semicolons": "ignore"
            }
        },
        "typescript": {
            "showUnused": true,
            "updateImportsOnFileMove": {
                "enable": true
            },
            "implementationsCodeLens": {
                "enable": false
            },
            "referencesCodeLens": {
                "enable": false
            },
            "preferences": {
                "importModuleSpecifier": "auto",
                "importModuleSpecifierEnding": "auto",
                "quoteStyle": "auto",
                "useAliasesForRenames": true
            },
            "suggestionActions": {
                "enabled": true
            },
            "validate": {
                "enable": true
            },
            "suggest": {
                "enabled": true,
                "paths": true,
                "autoImports": true,
                "completeFunctionCalls": true,
                "includeAutomaticOptionalChainCompletions": true
            },
            "format": {
                "enabled": true,
                "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,
                "semicolons": "ignore"
            },
            "workspaceSymbols": {
                "scope": "allOpenProjects"
            }
        },
        "prettier": {
            "formatterPriority": 1,
            "disableLanguages": [
                "vue"
            ],
            "eslintIntegration": true,
            "tslintIntegration": false,
            "stylelintIntegration": false,
            "requireConfig": false,
            "onlyUseLocalVersion": true,
            "disableSuccessMessage": false,
            "statusItemText": "Prettier",
            "ignorePath": ".prettierignore",
            "printWidth": 80,
            "tabWidth": 2,
            "singleQuote": true,
            "trailingComma": "all",
            "bracketSpacing": true,
            "jsxBracketSameLine": false,
            "jsxSingleQuote": false,
            "htmlWhitespaceSensitivity": "css",
            "endOfLine": "lf",
            "parser": "none",
            "semi": false,
            "useTabs": false,
            "proseWrap": "preserve",
            "arrowParens": "always"
        },
        "stylusSupremacy": {}
    }
}

[Trace - 9:17:04 PM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:////src/components/Counter.vue",
        "languageId": "vue",
        "version": 1,
        "text": "\n\n\n"
    }
}

[Trace - 9:17:04 PM] Received request 'client/registerCapability - (0)'.
Params: {
    "registrations": [
        {
            "id": "dde97465-9fe6-45fb-8732-cd14a42bbcc8",
            "method": "textDocument/formatting",
            "registerOptions": {
                "documentSelector": [
                    "vue"
                ]
            }
        }
    ]
}

[Trace - 9:17:04 PM] Sending response 'client/registerCapability - (0)'. Processing request took 1ms
No result returned.

[Trace - 9:17:05 PM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:////src/components/Counter.vue",
    "diagnostics": []
}
Nnoerregaard commented 4 years ago

I'm experiencing this issue as well :(

chemzqm commented 4 years ago

It's problem of vls

JoosepAlviste commented 4 years ago

It's problem of vls

I installed vls 0.5.1 globally and configured both VSCode and coc-vetur to use it:

    "vetur.dev.vlsPath": "<my_global_node_modules>/node_modules/vls",

The issue still happens in coc-vetur but doesn't in VSCode, so I think that the problem might still be in coc-vetur.

I tried looking into the differences from 0.4.2 to 0.5.0, but couldn't find a straight-forward changelog...

chemzqm commented 4 years ago

Caused by missing configuration.

JoosepAlviste commented 4 years ago

Thanks for taking a look! It seems to work correctly now. The new vetur.validation.templateProps option also works nicely!