microsoft / microsoft/monaco-editor
[Feature Request] Positive lookbehind not working
Open
Nobody has claimed this yet.
feature-request
tokenization
- Dominant language
- JavaScript
- Stars
- 46.8k
- Forks
- 4.1k
- Avg merge
- 17h 58m
- Merged PRs (30d)
- 1
Description
Reproducible in vscode.dev or in VS Code Desktop?
- Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
- Not reproducible in the monaco editor playground
Monaco Editor Playground Code
monaco.editor.defineTheme('LuaTheme', {
colors: {},
base: 'vs',
inherit: true,
rules: [
{ token: 'attribute', foreground: 'ff0000', fontStyle: 'bold' }
]
});
monaco.languages.setMonarchTokensProvider('lua', {
tokenizer: {
root: [
[/(?<=\.)[a-zA-Z0-9]+/, 'attribute']
]
}
})
monaco.editor.create(document.getElementById('container'), {
language: 'lua',
theme: 'LuaTheme'
});
Reproduction Steps
No response
Actual (Problematic) Behavior
When providing the input 'test.test.test' it does not match anything.
Expected Behavior
It should match the second and third 'test'.
Additional Context
I tried the positive lookahead, which is working fine.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Monaco Editor playground example and the monaco.languages.setMonarchTokensProvider entry point shown in the issue. Reproduce the test.test.test input with the provided Lua tokenizer and compare positive lookbehind with the working lookahead case. Done means the second and third test segments receive the expected token without breaking the existing tokenizer behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100