Merge branch 'master' into feat/diagnostic-picker-display-lsp

pull/13758/head
Michael Davis 2025-06-13 10:53:24 -04:00 committed by GitHub
commit ae0611cf7c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 22 deletions

View File

@ -585,8 +585,7 @@ impl<T: 'static + Send + Sync, D: 'static + Send + Sync> Picker<T, D> {
// retrieve the `Arc<Path>` key. The `path` in scope here is a `&Path` and
// we can cheaply clone the key for the preview highlight handler.
let (path, preview) = self.preview_cache.get_key_value(path).unwrap();
if matches!(preview, CachedPreview::Document(doc) if doc.language_config().is_none())
{
if matches!(preview, CachedPreview::Document(doc) if doc.syntax().is_none()) {
helix_event::send_blocking(&self.preview_highlight_handler, path.clone());
}
return Some((Preview::Cached(preview), range));
@ -624,27 +623,27 @@ impl<T: 'static + Send + Sync, D: 'static + Send + Sync> Picker<T, D> {
if content_type.is_binary() {
return Ok(CachedPreview::Binary);
}
Document::open(
let mut doc = Document::open(
&path,
None,
false,
editor.config.clone(),
editor.syn_loader.clone(),
)
.map_or(
Err(std::io::Error::new(
.or(Err(std::io::Error::new(
std::io::ErrorKind::NotFound,
"Cannot open document",
)),
|doc| {
)))?;
let loader = editor.syn_loader.load();
if let Some(language_config) = doc.detect_language_config(&loader) {
doc.language = Some(language_config);
// Asynchronously highlight the new document
helix_event::send_blocking(
&self.preview_highlight_handler,
path.clone(),
);
}
Ok(CachedPreview::Document(Box::new(doc)))
},
)
} else {
Err(std::io::Error::new(
std::io::ErrorKind::NotFound,

View File

@ -66,16 +66,15 @@ impl<T: 'static + Send + Sync, D: 'static + Send + Sync> AsyncHook
return;
};
if doc.language_config().is_some() {
if doc.syntax().is_some() {
return;
}
let loader = editor.syn_loader.load();
let Some(language_config) = doc.detect_language_config(&loader) else {
let Some(language) = doc.language_config().map(|config| config.language()) else {
return;
};
let language = language_config.language();
doc.language = Some(language_config);
let loader = editor.syn_loader.load();
let text = doc.text().clone();
tokio::task::spawn_blocking(move || {

View File

@ -648,6 +648,7 @@ comment-token = "#"
indent = { tab-width = 2, unit = " " }
grammar = "ruby"
language-servers = [ "crystalline" ]
formatter = { command = "crystal", args = ["tool", "format", "-"] }
[[language]]
name = "c-sharp"

View File

@ -235,6 +235,8 @@
(template_string)
] @string
(escape_sequence) @constant.character.escape
(regex) @string.regexp
(number) @constant.numeric.integer