Skip to content

Implement hover and go-to-definition for /typepath::variable - #477

Open
ZeWaka wants to merge 1 commit into
SpaceManiac:masterfrom
ZeWaka:zw/typepath-lsp
Open

Implement hover and go-to-definition for /typepath::variable#477
ZeWaka wants to merge 1 commit into
SpaceManiac:masterfrom
ZeWaka:zw/typepath-lsp

Conversation

@ZeWaka

@ZeWaka ZeWaka commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

title - adds hover and go-to-definition for /typepath::variable

pretty short addition

Demo

Recording.2026-08-21.215326.mp4
image

Closes #443

UnscopedVar(Ident),
ScopedCall(Vec<Ident>, Ident),
ScopedVar(Vec<Ident>, Ident),
/// A static var access, e.g. `/type::var`

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this made more sense than trying to infer it elsewhere, and separates out the ::var bit

} else if let Some(typepath) = typepath_base.take() {
if kind == PropertyAccessKind::Scope {
self.annotate_precise(start..end, || {
Annotation::TypePathVar(typepath, ident.clone())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thus we can annotate only when we see the ::

self.follow_type_path(&iter, parts.as_slice())
{
let mut next = Some(ty);
// Search the target type and its parents for the variable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed for e.g.

/datum
	var/count = 0

/obj
	parent_type = /datum

/obj/proc/example()
	return /obj::count

@ZeWaka
ZeWaka marked this pull request as ready for review August 22, 2026 05:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request(?): Support for /typepath::variable

1 participant