nvarner / typst-lsp

A brand-new language server for Typst, plus a VS Code extension
MIT License
1.19k stars 77 forks source link

Does it support format code by typst-fmt(typstfmt)? #204

Closed Freed-Wu closed 1 year ago

Freed-Wu commented 1 year ago

Feature Request

https://github.com/astrale-sharp/typstfmt

Myriad-Dreamin commented 1 year ago

Recording an approach (out of lsp extension) for vscod{e,ium} here. https://github.com/typst/typst/pull/1811#issuecomment-1666478850

  • for VSCodium or VSCode install Custom Local Formatters
    "customLocalFormatters.formatters": [
      {
          "command": "typstformat --use-std-in --use-std-out [--use-configuration --file-location=${file}]",
          "languages": [
              "typst",
          ],
      }
    ],

    It is also possible to support typstfmt in the same way, but I have not investigated it. @astrale-sharp

astrale-sharp commented 1 year ago

Hey! I consider typstfmt now decent enough that you would want to do that but it does still break the code sometimes, i should be behind an experimental checkbox! I'll look into it if i have time today