DanielGavin / ols

Language server for Odin
MIT License
440 stars 68 forks source link

Fix snippets for dynamic arrays and maps #303

Closed xb-bx closed 8 months ago

xb-bx commented 8 months ago

This PR fixes behavior of snippets for dynamic arrays and maps. Also added snippets for slices.

Current behavior:


arr := make([dynamic]int)
// becomes len(arr). it's fine
arr.len~ 
StructWithArray :: struct {
    arr_field: [dynamic]int
}
struc := StructWithArray {}
// becomes len(). should be len(struc.arr_field)
struc.arr_field.len~
return_array :: proc() -> [dynamic]int ---
// becomes len(). should be len(return_array())
return_array().len~ 

This PR fixes all of those cases and also adds snippets(len, for) for slices