rustle icon indicating copy to clipboard operation
rustle copied to clipboard

General utilities rewrite

Open pintariching opened this issue 2 years ago • 7 comments

One place to start would be rewriting all the utilities from here: https://github.com/sveltejs/svelte/tree/master/src/compiler/utils

A lot of them are used further up in the parsing and compiling.

  • [ ] clone.ts
  • [x] error.ts
  • [ ] extract_svelte_ignore.ts
  • [ ] flatten.ts
  • [x] full_char_code_at.ts
  • [ ] fuzzymatch.ts
  • [x] get_code_frame.ts
  • [ ] link.ts
  • [ ] list.ts
  • [ ] mapped_code.ts
  • [x] names.ts
  • [x] namespaces.ts
  • [ ] nodes_match.ts
  • [x] patterns.ts

pintariching avatar Aug 11 '22 15:08 pintariching

I would love to help with this :)

Antonio-Bennett avatar Aug 12 '22 09:08 Antonio-Bennett

@Antonio-Bennett Feel free to open a PR on anything you like 😁

pintariching avatar Aug 12 '22 09:08 pintariching

@pintariching okay thanks! Anything you're currently working on that I shouldn't duplicate?

Antonio-Bennett avatar Aug 12 '22 09:08 Antonio-Bennett

Most of it is commited to main right now, so feel free to pick up anything

pintariching avatar Aug 12 '22 10:08 pintariching

I need to review the PR implement locate_character module before implementing the error :)

linrium avatar Aug 13 '22 16:08 linrium

  • trim.ts
    • contains two functions trim_start and trim_end I suppose we won't need these since Rust standard library already has these [1] [2]
  • push_array.ts
    • Same. Already implement in Rust standard library

akshatagarwl avatar Aug 15 '22 21:08 akshatagarwl

Yeah that makes sense. No point in implementing these.

pintariching avatar Aug 16 '22 08:08 pintariching

Hi there, I'd love to help with this (although I am pretty new to rust). It occurs to me that some of these functions will not be required as Rust's type safety will make it difficult for them to be called so it will be fixed at the calling level. For example the flatten function will take [1, [2, 3, [4, 5]]] => [1, 2, 3, 4, 5] but this would be challenging to even create a vec with this shape. It seems that we'd be doing some funny encoding (and wrapping stuff in Boxes) to just decode it after?? (Excuse me if I have completely missed some very basic concept in Rust!!)

mplayer78 avatar Aug 29 '22 17:08 mplayer78

It could be that the flatten function doesn't need to be used as with trim_start and trim_end. I haven't seen where it's used yet. If you're new and want a challenge you can try and implementing it as a challenge, but know that it may not be used :sweat_smile:

pintariching avatar Aug 31 '22 20:08 pintariching