stkb / Rewrap

Rewrap extension for VSCode and Visual Studio
https://marketplace.visualstudio.com/items/stkb.rewrap
Other
501 stars 61 forks source link

Support custom language configuration through settings #262

Open gpaul opened 3 years ago

gpaul commented 3 years ago

The list of supported languages is specified in Parsing.Documents.fs and via a simple (and very elegant, I must say) "parser" DSL.

There is a small set of predefined combinators (cLine, cBlock, etc). It would be extremely useful to be able to define one's own language using the vscode extension settings for this extension. In particular, it makes playing around with new languages simpler, without having to install the toolchain, compiling the extension locally, verifying that it works, and then upstreaming language support in a pull request.

Please consider exposing the DSL as JSON in the extension settings.

gpaul commented 3 years ago

Something like:

customLanguages: [
  ["Thrift", "", ".thrift",
    { "sourceCode": [
      {"type": "cLine"},
      {"type": "line", args: ["#"]},
      {"type": "cBlock"},
    ]}
  }
]
bolinfest commented 3 years ago

Indeed, this also makes basic things difficult, such as my use of Flow (https://flow.org/) instead of JavaScript so /* */ comments do not get wrapped correctly.

bolinfest commented 3 years ago

Hack is another language that is not listed in https://github.com/stkb/Rewrap/blob/c62907ddb633e55a49b0df32a4a36381ac70ef02/core/Parsing.Documents.fs