Closed laoshaw closed 2 years ago
Syntax errors, etc. will be displayed as diagnostics messages.
You can check with "sign" (>>
) or "popup/floatwin". You can also run the :CocDiagnostics
command to see the list in the location list.
They are enabled by default. If they are not working in your environment, it may be something wrong with your environment. Check coc.nvim or Vim8/Neovim documentation
https://user-images.githubusercontent.com/188642/162340165-3c07b199-8ba3-42fb-b82d-029f1099119f.mp4
I'm trying to debug what is wrong on my end.
does I need both CocInstall and PlugInstall to install, or any one of them will do?
I assumed one of them will do, so I did CocInstall, for whatever reason it does not report errors. I tried PlugInstall it says:
'Warning @yaegassy/coc-volar@0.15.2: The engine "coc" appears to be invalid'
PlugInstall did not help, still no errors report.
CocDiagnostics does not report anything either. I disabled ALE(no more vls?), make sure I always disabled vim-vue and all other settings related to vue, to no help.
Is there any way I can dump some debug info about coc-volar?
If you installed with :CocInstall
, you do not need to install with vim-plug. As output in the log, if both are installed, the :CocInstall
side is enabled. Please uninstall coc-volar installed by vim-plug as it is not needed. Please check the vim-plug documentation on how to uninstall it.
Create a project with create-vite
and try syntax errors in the <script setup lang="ts">
block.
Prepare (Example):
cd /tmp
yarn create vite --template vue-ts example
cd example
yarn
nvim
Check:
:e src/App.vue
I use Neovim regularly. I tried it with Vim8 just to be sure, and it works correctly.
https://user-images.githubusercontent.com/188642/162346161-530ea644-7f83-46bb-8fa8-65bf4b413b09.mp4
Yes a clean env works here as well, but I had this .eslintrc.js from previous work and it seems the one causing the trouble:
module.exports = {
root: true,
env: {
browser: true,
node: true,
es2021: true,
},
extends: [
"plugin:vue/vue3-recommended",
"eslint:recommended",
"@vue/typescript/recommended",
"prettier",
"@vue/prettier/@typescript-eslint",
],
parser: "vue-eslint-parser",
plugins: ["vue"],
parserOptions: {
ecmaVersion: 2021,
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-unused-vars": ["error", { args: "none" }],
"@typescript-eslint/interface-name-prefix": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["off", { argsIgnorePattern: "^_" }],
},
};
there are quite some tutorials online, I am not sure if I still need this eslintrc.js for vite3+typescript+vim, or part of it. will debug more.
If you want to use eslint
, install coc-eslint
. volar does not respect eslint settings, etc.
Normally when I save in vim, it will reformat my vue file. If there is a syntax error, volar will refuse to reformat my vue file silently.
is it possible for volar to provide hints for those wrong syntax or typos in the code? I just spent an hour to check my code and found there is a place I put `;' instead of ',' inside export default.
in c/c++ etc vim scenario, vim can highlight the syntax errors for quick fixes. I wonder if volar can do that too? or it is already there but I just don't know how to set it up?