Skip to content

Commit

Permalink
actually use local module spans in lsp
Browse files Browse the repository at this point in the history
  • Loading branch information
kaikalii committed Jun 28, 2024
1 parent 37fd1b7 commit 44f78cf
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{

use crate::{
algorithm::invert::{invert_instrs, under_instrs},
ast::{Item, Modifier, PlaceholderOp, Ref, RefComponent, Word},
ast::{Item, Modifier, ModuleKind, PlaceholderOp, Ref, RefComponent, Word},
ident_modifier_args, instrs_are_pure,
lex::{CodeSpan, Sp},
parse::parse,
Expand Down Expand Up @@ -173,7 +173,16 @@ impl Spanner {
let mut spans = Vec::new();
for item in items {
match item {
Item::Module(m) => spans.extend(self.items_spans(&m.value.items)),
Item::Module(m) => {
match &m.value.kind {
ModuleKind::Named(name) => {
let binding_docs = self.binding_docs(&name.span);
spans.push(name.span.clone().sp(SpanKind::Ident(binding_docs)));
}
ModuleKind::Test => {}
}
spans.extend(self.items_spans(&m.value.items));
}
Item::Words(lines) => {
for line in lines {
spans.extend(self.words_spans(line))
Expand Down Expand Up @@ -265,9 +274,10 @@ impl Spanner {
if comment.is_none() {
match &binfo.kind {
BindingKind::Const(None) => comment = Some("constant".into()),
BindingKind::Import(_) => comment = Some("module".into()),
BindingKind::Import(_) | BindingKind::Module(_) => comment = Some("module".into()),
BindingKind::Macro => comment = Some("macro".into()),
_ => {}
BindingKind::Func(_) => {}
BindingKind::Const(_) => {}
}
}
let kind = match &binfo.kind {
Expand Down

0 comments on commit 44f78cf

Please sign in to comment.