-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix comment rendering in function definitions #51
base: master
Are you sure you want to change the base?
Fix comment rendering in function definitions #51
Conversation
I am wondering if there should be multi-line comments ( |
Is this correct? Won't this break something like: def foo // my comment here
(n: Int => String at {io})
{ prog: () => Unit } = prog() EDIT: As a nitpick, it's best to test with syntactically valid code, the |
We are deprecating them for |
I also thought about the solution of keeping the "definitions": {
"patterns": [
{
"begin": "\\s*(extern)\\s+((?:(?:\\{[^\\}]*\\}|[a-zA-Z][a-z-A-Z0-9_$]*)\\s+)?)\\s*(def)\\s+([a-zA-Z][a-z-A-Z0-9_$]*)\\b",
"end": "(?=\\n)|(?<=\\S)\\s*(?==(?!>))",
"captures": {
"1": { "name": "storage.modifier.extern.effekt" },
"2": { "patterns": [{ "include": "#capabilities" }] },
"3": { "name": "keyword.declaration.function.extern.effekt" },
"4": { "name": "entity.name.function.effekt" }
},
"patterns": [
{ "include": "#parameters" },
{
"begin": "//", <-- this is new
"end": "$",
"name": "comment.line.double-slash.effekt"
}
]
},
|
Problem:
Comments after function signatures were not highlighted properly, since the function parsing rule was consuming too much text.
Resolves #44
Fix:
Adjusted the
end
pattern indefinitions
to stop at//
, allowing the comment rule to apply correctly.Change:
Added the
//
chars to the end rule :Tested: Works after reloading VSCode with the examples:
Before:
With changes:
Now,
//
renders as an actual comment. ✨