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

Recent commit prevents Format Document from working on custom extension vue files. #2263

cabal95 opened this issue Dec 29, 2022 · 3 comments
bug Something isn't working


Copy link

cabal95 commented Dec 29, 2022

This commit (d7202e3) appears to have broken the Format Document command (probably all document formatting) when using custom extensions for Vue files.

In volar 1.0.16, our project that uses custom file extensions works fine with the format document command. After upgrading to the latest version (1.0.18) I noticed it no longer was formatting the documents when requested. After digging through the commits one by one this specific commit seems to be where it broke.

I looked through the changes in that commit and I don't see anything that should be causing this problem. But I have tried going back and forth between those two commits a couple times and it always works on the commit before but not on the commit mentioned above.

I'll keep poking around, but wanted to get it on the board since it was a recent change. If you have any specific ideas on researching this further I'd be happy to dig deeper.

Steps to reproduce:

  1. Check out the repository at the commit just PRIOR to the one mentioned above.
  2. Run "pnpm i" followed by "pnpm run build"
  3. Open repo in VS Code and run it.
  4. Add "obs" to volar.vueserver.additionalExtensions configuration setting.
  5. Add "src/**/*.obs" to tsconfig includes.
  6. Add "*.obs" -> "vue" to files.associations configuration setting.
  7. Rename "HelloWorld.vue" to "HelloWorld.obs".
  8. Open the Volar-Starter repo in the development environment VS Code.
  9. Make a change to the file that would be fixed by formatting (such as additional space between the "import" keyword and the opening brace).
  10. Activate the VS Code command "Format Document" and see that the spacing is correctly fixed.
  11. THEN update repo to the next commit - that is the one mentioned above.
  12. Remove node_modules and run "pnpmi" and "pnpm run build".
  13. Open repo in VS Code again and run it.
  14. Make the same change to the "HelloWorld.obs" file.
  15. Activate the VS Code command "Format Document" and see that nothing happens.

(Edit: Fixed link to commit to be in the main repo instead of my forked repo)

Copy link

Thanks for your detailed information! Will check it out.

@johnsoncodehk johnsoncodehk added the bug Something isn't working label Dec 30, 2022
Copy link

johnsoncodehk commented Dec 30, 2022

The problem is that vueCompilerOptions.extensions incorrect in syntax server, but before d7202e3 all document names all is untitled + document language, so the vueCompilerOptions.extensions is just getting ignored.

螢幕截圖 2022-12-31 06 38 33

Copy link
Contributor Author

cabal95 commented Jan 3, 2023

@johnsoncodehk Thanks for the quick response on this! I just tested against our main repo/branch and confirm it does indeed fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
bug Something isn't working
None yet

No branches or pull requests

2 participants