limit maximum detail length at 1024 bytes (#1048)
This commit is contained in:
parent
b8eb6aab7f
commit
3c26892c7e
@ -1533,10 +1533,11 @@ pub fn formatDetailledLabel(item: *types.CompletionItem, arena: std.mem.Allocato
|
|||||||
if (item.detail == null)
|
if (item.detail == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var detailLen: usize = item.detail.?.len;
|
const detail = item.detail.?[0..@min(1024, item.detail.?.len)];
|
||||||
|
var detailLen: usize = detail.len;
|
||||||
var it: []u8 = try arena.alloc(u8, detailLen);
|
var it: []u8 = try arena.alloc(u8, detailLen);
|
||||||
|
|
||||||
detailLen -= std.mem.replace(u8, item.detail.?, " ", " ", it) * 3;
|
detailLen -= std.mem.replace(u8, detail, " ", " ", it) * 3;
|
||||||
it = it[0..detailLen];
|
it = it[0..detailLen];
|
||||||
|
|
||||||
// HACK: for enums 'MyEnum.', item.detail shows everything, we don't want that
|
// HACK: for enums 'MyEnum.', item.detail shows everything, we don't want that
|
||||||
|
Loading…
Reference in New Issue
Block a user