Closed crbelaus closed 7 months ago
@scottming suggested using different icons for public and private functions, but they're actually meant to distinguish between methods and functions and don't have any intrinsic meaning.
@crbelaus How about if we put a little lock icon in front of private functions? Like this:
I tried making public functions function kinds and private functions method kinds, but in emacs at least, they use the same icon.
Personally I'd prefer written text def/defp
instead of another symbol in front. Second symbol looks overloaded to me. But this is UI and everyone to his taste.
Anything will do a long as there is something at all
@crbelaus How about if we put a little lock icon in front of private functions? Like this:
I favor the small lock icon: : \uea75
; it is very effective for quick visual recognition, and it will be easy to remove or modify when the official LSP adds more symbol tags in the future. Although 'def' and 'defp' are somewhat helpful in searches, they are a distraction when viewing symbols.(And I think we should rarely use prefixes def/defp
to search for document symbols; more often, we need quick visual recognition)
The proposed small lock icon sounds good 👍
I mentioned def
and defp
on the issue because that is what ElixirLS does but any other solution that helps identifying public and private functions is great.
I'd prefer def/defp
as it naturally extends to including defmacro
and defmacrop
as well. It would also be helpful to distinguish between functions and macros, and the lock does not give any of that info. (Workspace symbols doesn't currently include macro definitions but I expect that it will in short order.)
macros will have a different icon
I worry about defmacro/defmacrop + the function name + the arguments will be a lot of noise in the sidebar.
I worry about defmacro/defmacrop + the function name + the arguments will be a lot of noise in the sidebar.
@scohen Devil's advocate: I like that types, for instance, include @type
before them. If I'm looking at symbols and only care about types, I can quickly type @type
to narrow down to only those. The same could be useful for defs/defmacros.
That's fair and this stuff is super easy to change. Emacs just displays these things, i can't narrow them down at all, so that reasoning wasn't obvious to me.
The document symbols provider is not showing any information that allows you to identify whether a function is public or private.
The following is a screenshot from VSCode with Lexical showing all the symbols in a particular module. Only
changeset/2
andurl/2
are public functions, while the rest are private.For comparison, this is the same module with ElixirLS in this case. Notice the
def
anddefp
before the function names.I'm just opening this issue as a potential feature request open for discussion. I personally find this functionality very useful as it allows me to easily see the public interface of a particular module without having to perform a
def
search.