nvim-treesitter / nvim-treesitter-textobjects

Apache License 2.0
2.2k stars 200 forks source link

feat(gleam): support functions and parameters #715

Open McCourtRC opened 1 week ago

McCourtRC commented 1 week ago

functions

// @function.outer start
pub fn foo(a a: String, b b: String) -> String {
  // @function.inner start  
  a <> b
  // @function.inner end
}
// @function.outer end

// anonymous functions
                     // @function.outer start
with_callback("foo", fn () {
  // @function.inner start 
  "bar"
  // @function.inner end
}                    // @function.outer end
)

parameters (NOTE: @parameter.outer includes trailing ,)

// function parameters
pub fn foo(a a: String, b b: String) -> String {
  a <> b
}

// arguments
foo(a: "foo", b: "bar")

// data constructor arguments
pub type Foo {
  Foo(a: String, b: String)
}