diff --git a/crates/base_db/src/lib.rs b/crates/base_db/src/lib.rs index 7a5d8d91c4..232eca05e1 100644 --- a/crates/base_db/src/lib.rs +++ b/crates/base_db/src/lib.rs @@ -109,6 +109,13 @@ impl FileKind { _ => false, } } + + pub fn is_elp_supported(self) -> bool { + match self { + Self::SrcModule | Self::TestModule | Self::Header | Self::Escript => true, + _ => false, + } + } } pub trait FileLoader { diff --git a/crates/elp/src/handlers.rs b/crates/elp/src/handlers.rs index ab170ad6dd..63aa97b168 100644 --- a/crates/elp/src/handlers.rs +++ b/crates/elp/src/handlers.rs @@ -877,6 +877,9 @@ pub(crate) fn handle_code_lens( let lens_config = snap.config.lens(); let file_id = from_proto::file_id(&snap, ¶ms.text_document.uri)?; + if !snap.analysis.file_kind(file_id)?.is_elp_supported() { + return Ok(None); + } let line_index = snap.analysis.line_index(file_id)?; if let Ok(Some(project_id)) = snap.analysis.project_id(file_id) { let annotations = snap.analysis.annotations(file_id)?;