erlang-language-platform/editors/code/third-party
Roberto Aloi 833d235e84 Support for embedded Markdown comments
Summary:
Erlang/OTP 27 introduces Markdown comments. While this makes it in theory simpler to author in-code documentation, the VS Code extension does not yet recognize comments as Markdown.

This change makes VS Code recognize doc blocks as Markdown, using the concept of an [embedded language](https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#embedded-languages).

This provides features such as:

* Syntax highlighting for italic, bold, code blocks, etc
* Matching parentheses
* Ability to embed Erlang code blocks with syntax highlighting
* Etc

While this simply works(TM), it makes the doc block too evident and distracting:

{F1978476087}

To preserve the look-and-feel of the old edoc-style comment, we override the default colour for the embedded markdown block. This seems to work fine in both light and dark mode and can always be overridden by a user using the `settings.json` file:

```
"editor.tokenColorCustomizations": {
        "textMateRules": [
            {
                "scope": "meta.embedded.block.markdown",
                "settings": {
                    "foreground": "MY_FAVOURITE_COLOUR"
                }
            }
        ],
    }
```

The change is being upstreamed [here](https://github.com/erlang-ls/grammar/pull/18).

Reviewed By: alanz

Differential Revision: D75152988

fbshipit-source-id: 3922007c13678be99fb27c99e53f8597c7dcba8f
2025-05-28 00:15:25 -07:00
..
grammar Support for embedded Markdown comments 2025-05-28 00:15:25 -07:00
README.md Initial commit 2023-08-02 07:54:59 -07:00

External resources used in this LSP client

The subdirectory grammar is a direct copy of https://github.com/erlang-ls/grammar.git

It should probably go into the appropriate place for external software, and have its license checked for use. It appears to be permissive, but IANAL.