Skip to content

Emit R6Class methods as workspace symbols #861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jul 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/ark/src/lsp/completions/sources/composite/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ fn completions_from_workspace_arguments(
return Ok(None);
},
indexer::IndexEntryData::Variable { .. } => return Ok(None),
indexer::IndexEntryData::Method { .. } => return Ok(None),
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be worth trying to give these a unique name? Like, trying to sniff out the R6 class name to include as well?

Imagine if I implemented two of three of these similar interfaces in the same file, then I'd have no way of telling them apart

What does Rust do for something like this?

https://github.com/DavisVaughan/almanac/blob/main/R/cache-rrule.R
https://github.com/DavisVaughan/almanac/blob/main/R/cache-radjusted.R

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rust doesn't emit methods as Workspace symbols so this issue doesn't arise.

I think the file name is good enough to disambiguate most of the time? But we could probably make your suggestion work like this: MyClass$get_events()

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that would be kind of cool to also make it distinct as an R6 method? Maybe no parens, so MyClass$get_events

// Only 1 call worth of arguments are added to the completion set.
Expand Down
3 changes: 3 additions & 0 deletions crates/ark/src/lsp/completions/sources/composite/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ fn completions_from_workspace(
};
completions.push(completion);
},

// Methods are currently only indexed for workspace symbols
indexer::IndexEntryData::Method { .. } => {},
}
});

Expand Down
Loading
Loading