prettier-plugin-go-template icon indicating copy to clipboard operation
prettier-plugin-go-template copied to clipboard

Can't make it work in VSCode on gohtml with pnpm

Open BigBoulard opened this issue 3 years ago • 1 comments

Hi,

Here are the steps I've walked through:

package installation (globally)

 > pnpm i -g prettier-plugin-go-template
 WARN  prettier-plugin-go-template has no binaries
+ prettier-plugin-go-template 0.0.13

get the global pnpm node_modules path

> pnpm root -g
/users/me/Library/pnpm/global/5/node_modules

set Prettier: Prettier Path in VSCode

/users/me/Library/pnpm/global/5/node_modules/prettier

Add a .prettierrc config file

{
  "overrides": [
    {
      "files": ["*.gohtml"],
      "options": {
        "parser": "go-template"
      }
    }
  ],
  "goTemplateBracketSpacing": true
}

outcome: nothing. Prettier is not available for .gohtml files

BigBoulard avatar Mar 22 '23 17:03 BigBoulard

You might be missing the plugin part in the config:

{
  "plugins": ["prettier-plugin-go-template"],
  "overrides": [
    {
      "files": ["*.html"],
      "options": {
        "parser": "go-template"
      }
    }
  ]
}

Do also note that I am using this with just html files and I've configured the following in my user settings json:

  "files.associations": {
    "*.tmpl": "html",
    "*.gohtml": "html"
  }

that way, gohtml is treated as just html in VSCode. I haven't yet managed to make the plugin work myself, but perhaps the above is an approach for you.

pinkpigeonltd avatar Nov 01 '23 14:11 pinkpigeonltd