vlang/vscode-vlang

Method has highlight of storage.type.numeric

danieldaeschle opened this issue · 8 comments

image
It should be entity.name.function.v

It's been a while since I have properly wrote tmLanguages. I remember that we could have lookbehinds. Should dig into my previous codes and the documentation. In the other languages that I have read, the convention (when it comes to the methods) is that they define the whole structure together. So they define a rule where say this.that is read as a whole and parsed into the origin, method accessor, method/property. Since we don't have this V's grammar, all we can do is to have the boundary checks \b which is not applied to .. Assign me to this, and I'll define the whole grammar approach. But I will also dig into it to see if we could have had the lookbehind for the ..

The lookbehind should be easy. You just test for a whitespace before. I can't think about a case where a type has no whitespace before. Then group the actual name and assign the highlight to that group.

A few comes to my mind actually:

fn something()int{
   // if our dev has no taste in putting spaces...
}

type Union=int|f32

Some languages don't highlight codes that do not meet the standard formatting. I remember many of this examples in the Go and Rust grammars. I think we can use the lookbehind like that and do not assume the cases above. But don't know really. Let's keep it for a bad scenario.

This is a negitve lookahead that matches everything except of .: (?!\.).*

Let me test with it and I'll come back

Linking the issue #66 to this. Fixing that eases one problem of fixing this.