Compare commits

...

4 Commits

Author SHA1 Message Date
Takumi Matsuura c77ebbe6be
Merge 183a561f1b into 395a71bf53 2025-07-24 22:16:36 +09:00
kiara 395a71bf53
languages: nix formatter (#14046) 2025-07-23 12:51:17 -04:00
Ian Hobson 1e4bf6704a
Update Koto grammar and queries, add formatter (#14049) 2025-07-23 12:47:47 -04:00
Takumi Matsuura 183a561f1b Fix jump label rendering for multi-byte characters 2025-06-07 12:32:02 +09:00
4 changed files with 33 additions and 17 deletions

View File

@ -6661,9 +6661,20 @@ fn jump_to_label(cx: &mut Context, labels: Vec<Range>, behaviour: Movement) {
if labels.is_empty() {
return;
}
let alphabet_char = |i| {
let alphabet_char = |i, use_fullwidth: bool| {
let mut res = Tendril::new();
res.push(alphabet[i]);
let ch = alphabet[i];
// Use full-width characters for wide characters to prevent rendering issues
let display_ch = if use_fullwidth {
match ch {
'a'..='z' => char::from_u32(ch as u32 - 'a' as u32 + '' as u32).unwrap_or(ch),
'A'..='Z' => char::from_u32(ch as u32 - 'A' as u32 + '' as u32).unwrap_or(ch),
_ => ch,
}
} else {
ch
};
res.push(display_ch);
res
};
@ -6673,11 +6684,13 @@ fn jump_to_label(cx: &mut Context, labels: Vec<Range>, behaviour: Movement) {
.iter()
.enumerate()
.flat_map(|(i, range)| {
let pos = range.from();
let use_fullwidth = text.char(pos).width().unwrap_or(1) >= 2;
[
Overlay::new(range.from(), alphabet_char(i / alphabet.len())),
Overlay::new(pos, alphabet_char(i / alphabet.len(), use_fullwidth)),
Overlay::new(
graphemes::next_grapheme_boundary(text, range.from()),
alphabet_char(i % alphabet.len()),
graphemes::next_grapheme_boundary(text, pos),
alphabet_char(i % alphabet.len(), use_fullwidth),
),
]
})

View File

@ -1022,6 +1022,7 @@ shebangs = []
comment-token = "#"
language-servers = [ "nil", "nixd" ]
indent = { tab-width = 2, unit = " " }
formatter = { command = "nixfmt" }
[[grammar]]
name = "nix"
@ -4243,10 +4244,11 @@ comment-token = "#"
block-comment-tokens = ["#-", "-#"]
indent = { tab-width = 2, unit = " " }
language-servers = ["koto-ls"]
formatter = {command = "koto", args = ["--format"]}
[[grammar]]
name = "koto"
source = { git = "https://github.com/koto-lang/tree-sitter-koto", rev = "b420f7922d0d74905fd0d771e5b83be9ee8a8a9a" }
source = { git = "https://github.com/koto-lang/tree-sitter-koto", rev = "2ffc77c14f0ac1674384ff629bfc207b9c57ed89" }
[[language]]
name = "gpr"

View File

@ -5,11 +5,13 @@
"*"
"/"
"%"
"^"
"+="
"-="
"*="
"/="
"%="
"^="
"=="
"!="
"<"
@ -99,12 +101,18 @@
(export
(identifier) @namespace)
(call
function: (identifier) @function.method)
(chain
start: (identifier) @function)
(chain
lookup: (identifier) @variable.other.member)
(call
function: (identifier)) @function
(call_arg
(identifier) @variable.other.member)
[
(true)
(false)
@ -139,13 +147,10 @@
(self) @variable.builtin
(variable
type: (identifier) @type)
(type
_ @type)
(arg
(_ (identifier) @variable.parameter))
(ellipsis) @variable.parameter
(function
output_type: (identifier) @type)

View File

@ -11,10 +11,6 @@
(call_args
((call_arg) @parameter.inside . ","? @parameter.around) @parameter.around)
(chain
call: (tuple
((element) @parameter.inside . ","? @parameter.around) @parameter.around))
(map
((entry_inline) @entry.inside . ","? @entry.around) @entry.around)