ZIm/crates/language/src
Bennet Bo Fenner 22cf73acec
indent guides: Use primary buffer language to determine tab size (#12506)
When indent guides were still WIP, I thought it might be a good idea to
detect the tab size for every line individually, so we can handle files
with mixed indentations. However, while optimizing the performance of
indent guides I found that getting the language at a given anchor was
pretty expensive, therefore I only resolved the language for the first
visible row. However, this could lead to some weird flickering, where
the indent guides would use different tab sizes depending on the first
visible row (see #12492). This can be fixed by just using the primary
buffer language size.

So as of right now indent guides cannot handle files with mixed
indentations. Im not sure if anyone actually does/expects this, but one
use case I could imagine is something like this:
User x has a svelte file, where the tab size is set to `4`. However the
svelte code uses typescript inside a script tag, which User x wants to
use a tab size of `2`. The approach used here would not work for this,
but then again I think our formatter does not even support something
like this. Im probably overcomplicating things, so let's stick with the
simple solution for now.

Release Notes:

- Fixed an issue where indent guides would use an incorrect tab size
([#12492](https://github.com/zed-industries/zed/issues/12492)).
2024-05-30 22:55:47 +02:00
..
syntax_map Add a setting for custom associations between languages and files (#9290) 2024-03-13 10:23:30 -07:00
buffer.rs indent guides: Use primary buffer language to determine tab size (#12506) 2024-05-30 22:55:47 +02:00
buffer_tests.rs indent guides: Fix tab handling (#12249) 2024-05-24 18:24:03 +02:00
diagnostic_set.rs Send along diagnostics when requesting code actions (#10281) 2024-04-08 17:54:06 +02:00
highlight_map.rs Docs for indent_size_for_line and co 2024-01-09 20:50:34 +01:00
language.rs Allow specifying a custom limit for /search results (#12423) 2024-05-29 14:11:05 +02:00
language_registry.rs Add glob support for custom file type language (#12043) 2024-05-20 10:13:35 +02:00
language_settings.rs Indent guides (#11503) 2024-05-23 15:50:59 +02:00
markdown.rs Fix Markdown code rendering in tooltips ignoring languages (#10607) 2024-04-16 12:49:35 +02:00
outline.rs Rust 1.78 (#11314) 2024-05-05 15:02:50 +02:00
proto.rs Revert "Revert "language: Remove buffer fingerprinting (#9007)"" (#9671) 2024-04-12 18:40:35 +02:00
syntax_map.rs Add support for detecting tests in source files, and implement it for Rust (#11195) 2024-05-05 16:32:48 +02:00
task_context.rs tasks: Provide task variables from matching runnable ranges in task modal (#12237) 2024-05-24 21:00:23 +02:00