mirror of https://github.com/Wilfred/difftastic/
highlight modules (#2)
* highlight modules * highlight remote type modules as modules * make string replace variable parameter example less ambiguouspull/204/head
parent
5b9ac0c6a7
commit
e254d08b7c
@ -0,0 +1,13 @@
|
|||||||
|
; Scopes
|
||||||
|
(function_body) @local.scope
|
||||||
|
|
||||||
|
; Definitions
|
||||||
|
(let pattern: (identifier) @local.definition)
|
||||||
|
(function_parameter name: (identifier) @local.definition)
|
||||||
|
(list_pattern (identifier) @local.definition)
|
||||||
|
(list_pattern assign: (identifier) @local.definition)
|
||||||
|
(tuple_pattern (identifier) @local.definition)
|
||||||
|
(record_pattern_argument pattern: (identifier) @local.definition)
|
||||||
|
|
||||||
|
; References
|
||||||
|
(identifier) @local.reference
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
import gleam/io
|
||||||
|
// ^ module
|
||||||
|
// ^ module
|
||||||
|
// ^ module
|
||||||
|
import animal/cat as kitty
|
||||||
|
// ^ module
|
||||||
|
// ^ module
|
||||||
|
|
||||||
|
pub fn main() {
|
||||||
|
io.println("hello world")
|
||||||
|
// <- module
|
||||||
|
}
|
||||||
|
|
||||||
|
type MyType {
|
||||||
|
MyType(func: fn() -> Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn record_access_case(param: MyType) {
|
||||||
|
let binding = MyType(func: fn() { 42 })
|
||||||
|
let _ = binding.func()
|
||||||
|
// ^ variable
|
||||||
|
let _ = param.func()
|
||||||
|
// ^ variable.parameter
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pipe_operator_case(string: String) {
|
||||||
|
string
|
||||||
|
// <- variable.parameter
|
||||||
|
|> iodata.new
|
||||||
|
// ^ module
|
||||||
|
|> iodata.reverse
|
||||||
|
// ^ module
|
||||||
|
}
|
||||||
|
|
||||||
|
fn remote_type_case() {
|
||||||
|
gleam.Ok(1)
|
||||||
|
// <- module
|
||||||
|
// ^ punctuation.delimeter
|
||||||
|
// ^ type
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue