-
Notifications
You must be signed in to change notification settings - Fork 12
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
VSCode instructions did not work #38
Comments
The |
@gitKrystan Yes, I needed all of it. It was surprising to me. There may be something else going on, but I'm not sure what. |
What glimmer-related VSCode extensions do you have installed? |
I can confirm this! Struggled for a while to get it working. When explicitly calling With all of the config added that @wagenet posted above, it is finally working! 🎉
The Ember/Glimmer specific ones I have are
|
This includes these tweaks from @wagenet: ember-tooling/prettier-plugin-ember-template-tag#38 (comment)
We encountered the above only after switching from yarn 1 to pnpm 8...... So I am wondering if the OP and Simon are also using pnpm. That might be the key here, or a giant red herring. Specifically, the config I needed to add was;
"[gjs]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[gts]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"prettier.documentSelectors": ["**/*.gjs", "**/*.gts"] // this is all I needed to add here |
I finally saw this happen IRL when working on someone else's computer. I suspect that it's something to do with which VSCode extension is registering the It would be helpful if people could dump the output of Here's mine:
Actually...I switched computers recently and might now have a local repro... 🎉 |
I run vscode over a docker container (via the remote-containers extension) so there's local extensions and remote extensions, but here you go
|
Are you all using PNPM (and are you using PNPM workspaces)? I found some issues around how Prettier auto-loads plugins that seem like they would conflict with PNPM. Also found this in the changelog: https://github.com/prettier/prettier/blob/fc6419ab63a8b3bc2b4458bb5771fe64638ab013/changelog_unreleased/api/14759.md?plain=1#L3 |
Pnpm yes, workspaces no. I did actually encounter that prettier/pnpm/plugin searching as a separate issue (after switching to pnpm, prettier couldn't find my tailwindcss prettier plugin) but listing it explicitly in prettierrc plugins resolved that. |
Notes from my investigation today:
^^ In the case of my accidental repro (which is in a project using pnpm workspaces), the plugin is not in the same node modules folder More plugin autoload issues: Other plugin loading issues: Some people had luck with something like:
but I haven't gotten that working in my repro yet. I did confirm that @wagenet's hacks above work. |
That reminds me!,
But wait... By default, why wouldn't this gjs plugin, be hoisted?, Thus fixing the problem? It starts with prettier, and that matches the public-hoist-pattern Update! This is what i get for trying to do code things on my phone -- i missed the linked prettier thing -- removing the functionality that i wan talking about... Which is a very good thing. Makes folks install deps correctly, etc. |
I think that issue you linked prettier/prettier#13276 is exactly what the problem is. The workaround in that issue for VSCode are even the same as the OP gave here. The only difference is they use Yarn PnP rather than pnpm but it's kind of the same thing in that node_modules is a non-standard structure
Note that providing a string to the prettier plugins array is essentially the same as calling require https://prettier.io/docs/en/plugins.html#using-plugins
|
Can y'all try out v1.1.0 and see if any of your issues are resolved? Specifically, in @wagenet's config I was able to remove: Between #125 and #78 (Prettier totally revamped how they include plugins in v3) this issue might be resolved. 🎉 However, you all should be aware of: #113 |
It looks like I had already removed documentSelectors from my settings (I recently changed systems and had to redo all this stuff). I've now removed the ember-template-tag parser overrides section from my prettierrc.js Looks like vscode prettier format on save works! FWIW, the relevant vscode settings I have now are this. "[glimmer-js]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[glimmer-ts]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}, |
In case this helps anybody... Our situation is
If you are working inside the But, if you are working on a file inside the To fix it I needed to add
I did not need any of the previously mentioned |
Hey all, just adding another report: I'm using plugin version
I already had the below settings:
In case it's useful, here's my code --list-extensionsamazonwebservices.aws-toolkit-vscode attilabuti.vscode-mjml bierner.markdown-preview-github-styles bradlc.vscode-tailwindcss castwide.solargraph dbaeumer.vscode-eslint denoland.vscode-deno eamodio.gitlens EditorConfig.EditorConfig Equinusocio.vsc-material-theme equinusocio.vsc-material-theme-icons esbenp.prettier-vscode GitHub.copilot GitHub.copilot-chat golang.go JakeBecker.elixir-ls jprestidge.theme-material-theme jtr.vscode-position kaiwood.endwise lifeart.vscode-ember-unstable lifeart.vscode-glimmer-syntax ms-azuretools.vscode-docker ms-python.black-formatter ms-python.flake8 ms-python.isort ms-python.mypy-type-checker ms-python.python ms-python.vscode-pylance ms-toolsai.jupyter ms-toolsai.jupyter-keymap ms-toolsai.jupyter-renderers ms-toolsai.vscode-jupyter-cell-tags ms-toolsai.vscode-jupyter-slideshow ms-vscode-remote.remote-containers ms-vscode.makefile-tools ms-vscode.sublime-keybindings msjsdiag.vscode-react-native octref.vetur PKief.material-icon-theme redhat.vscode-commons redhat.vscode-yaml rubocop.vscode-rubocop Rubymaniac.vscode-direnv rust-lang.rust-analyzer samuelcolvin.jinjahtml Shopify.ruby-lsp stylelint.vscode-stylelint svelte.svelte-vscode tamasfe.even-better-toml timonwong.shellcheck typed-ember.glint-vscode vadimcn.vscode-lldb VisualStudioExptTeam.intellicode-api-usage-examples VisualStudioExptTeam.vscodeintellicode |
To get things to work with VSCode I had to make the following changes:
Note that these are glimmer-js and glimmer-ts not gjs and gts.
The text was updated successfully, but these errors were encountered: