Skip to content
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

CodeEditorContribution syntax highlighting not working #128

Open
mmeester opened this issue Jan 5, 2023 · 2 comments
Open

CodeEditorContribution syntax highlighting not working #128

mmeester opened this issue Jan 5, 2023 · 2 comments

Comments

@mmeester
Copy link

mmeester commented Jan 5, 2023

I'm trying to get the CodeEditorContribution sample to work to have syntax highlighted in repos, but whatever I try it's not working and my code looks like being plain text all the time

@jincao1
Copy link

jincao1 commented May 25, 2024

Did you ever manage to get this working?

@jincao1
Copy link

jincao1 commented May 25, 2024

This seems to be how you declare the syntax highlighting now I think. You don't even need to do any typescript but would need to convert the Monaco syntax into the contribution properties... Would be good if these examples were kept up to date and is functional...

From this repo:
https://github.com/SuperNowyNick/az-devops-bpmn-tools/blob/913a2cfb6a0680c4e1537c461a98ed34a8a17107/vss-extension.json

{
    "id": "bpmn-language",
    "type": "ms.vss-features.code-editor-language",
    "description": "Add BPMN syntax highlighting",
    "targets": ["ms.vss-features.editor"],
    "properties": {
        "extensions": [".bpmn"],
        "mimetypes": ["application/bpmn+xml"],
        "language": {
            "displayName": "BPMN",
            "defaultToken": "",
            "tokenPostfix": ".bpmn",
            "ignoreCase": true,
            "tokenizer": {
                "root": [
                    ["<\\?xml", "metatag", "@xmlInfo"],
                    ["<!--", "comment", "@comment"],
                    [
                        "(<)(\\w+)",
                        [
                            "delimiter",
                            { "token": "tag", "next": "@bpmn" }
                        ]
                    ],
                    [
                        "(<\\/)(\\w+)(:)(\\w+)",
                        ["delimiter", "tag", "delimiter", "type"]
                    ],
                    ["</", "delimiter"],
                    ["\\/>", "delimiter"],
                    ["[^<]+"]
                ],
                "xmlInfo": [
                    [">", "metatag", "@pop"],
                    ["[^>]+", "metatag.content"]
                ],
                "comment": [
                    ["-->", "comment", "@pop"],
                    ["[^-]+", "comment.content"],
                    [".", "comment.content"]
                ],
                "bpmn": [
                    ["(:)(\\w+)", ["delimiter", "type"]],
                    ["\"([^\"]*)\"", "attribute.value"],
                    ["'([^\"]*)'", "attribute.value"],
                    ["([\\w\\-]+)(=)", ["attribute.name", "delimiter"]],
                    ["\\/?>", "delimiter", "@pop"]
                ]
            }
        }
    }
}

Managed to get it to work doing this syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants