Skip to content

Commit 76af07f

Browse files
committed
Distinguish constants, functions, and constructors in object tree
1 parent 96870fe commit 76af07f

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

crates/dm-langserver/src/main.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,15 @@ impl Engine {
437437
let is_declaration = var.declaration.is_some();
438438
entry.vars.push(extras::ObjectTreeVar {
439439
name: name.to_owned(),
440-
kind: lsp_types::SymbolKind::FIELD,
440+
kind: if var
441+
.declaration
442+
.as_ref()
443+
.map_or(false, |d| d.var_type.flags.is_const())
444+
{
445+
lsp_types::SymbolKind::CONSTANT
446+
} else {
447+
lsp_types::SymbolKind::FIELD
448+
},
441449
location: self
442450
.convert_location(
443451
var.value.location,
@@ -456,7 +464,13 @@ impl Engine {
456464
for value in proc.value.iter() {
457465
entry.procs.push(extras::ObjectTreeProc {
458466
name: name.to_owned(),
459-
kind: lsp_types::SymbolKind::METHOD,
467+
kind: if ty.is_root() {
468+
lsp_types::SymbolKind::FUNCTION
469+
} else if is_constructor_name(name) {
470+
lsp_types::SymbolKind::CONSTRUCTOR
471+
} else {
472+
lsp_types::SymbolKind::METHOD
473+
},
460474
location: self
461475
.convert_location(value.location, &value.docs, &[&ty.path, "/proc/", name])
462476
.ok(),

0 commit comments

Comments
 (0)