scip: Populate SymbolInformation::kind

SymbolInformation::kind is finer-grained than the SCIP symbol suffix.
This also fixes a bug where all type aliases where treated like type
parameters.

```
trait SomeTrait {
  type AssociatedType; // ← this is SomeTrait#[AssociatedType]
}

type MyTypeAlias = u8; // ← this used to be [MyTypeAlias]
                       //   and now is MyTypeAlias#
```
This commit is contained in:
Nicolas Guichard 2023-12-08 16:48:42 +01:00
parent 566bb77f91
commit 73d9c77f2a
5 changed files with 248 additions and 75 deletions

View file

@ -17,7 +17,7 @@ use crate::navigation_target::UpmappingResult;
use crate::{
hover::hover_for_definition,
inlay_hints::AdjustmentHintsMode,
moniker::{def_to_moniker, MonikerResult},
moniker::{def_to_kind, def_to_moniker, MonikerResult, SymbolInformationKind},
parent_module::crates_for,
Analysis, Fold, HoverConfig, HoverResult, InlayHint, InlayHintsConfig, TryToNav,
};
@ -49,6 +49,7 @@ pub struct TokenStaticData {
pub display_name: Option<String>,
pub enclosing_moniker: Option<MonikerResult>,
pub signature: Option<String>,
pub kind: SymbolInformationKind,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@ -180,6 +181,7 @@ impl StaticIndex<'_> {
.zip(def.enclosing_definition(self.db))
.and_then(|(cc, enclosing_def)| def_to_moniker(self.db, enclosing_def, cc)),
signature: def.label(self.db),
kind: def_to_kind(self.db, def),
});
self.def_map.insert(def, it);
it