[Bug][Monarch] A newline is not supported in Monarch token #3714
Unanswered
BeishaoCao-db
asked this question in
Q&A
Replies: 2 comments
-
Maybe you're looking for Edit: no, that probably won't work since the tokenizer goes line-by-line. You'll never get a token with multiple lines. |
Beta Was this translation helpful? Give feedback.
0 replies
-
@Prinzhorn Thanks for your clarification! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Code
Reproduction Steps
https://microsoft.github.io/monaco-editor/monarch.html
[ /LANGUAGE\s+PYTHON\s+AS\s+\$\$/, { token: 'keyword', bracket: '@open', next: '@python_block', nextEmbedded: 'python' }, ],
and one python block:
python_block: [[/\$\$/, { token: 'keyword', next: '@popall', nextEmbedded: '@pop' }]],
LANGUAGE PYTHON AS $$
will open a python block, but if we enter a newline inside the token likeLANGUAGE PYTHON AS \n $$
and it won't be consider as a token.\s
in the matching rule but not include\n
? And is there a way to achieve that we define a token and support newline? Currently my guess is monaco will tokenize the code line by line and it cause this behaviorActual (Problematic) Behavior
We can see that
LANGUAGE PYTHON AS $$
will open a python block, but if we enter a newline inside the token likeLANGUAGE PYTHON AS $$
and it won't be consider as a token.Expected Behavior
EXPECT:
Add a newline inside won't affect
LANGUAGE PYTHON AS \n $$
to become a tokenAdditional Context
why we have
\s
in the matching rule but not include\n
? And is there a way to achieve that we define a token and support newline? Currently my guess is monaco will tokenize the code line by line and it cause this behavior and is there any workaround?Beta Was this translation helpful? Give feedback.
All reactions