Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Distinguish between public and private function display in Elixir #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 8 additions & 2 deletions lua/symbols-outline/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ local folding = require 'symbols-outline.folding'

local M = {}

local function starts_with(str, start)
return str:sub(1, #start) == start
end

---Parses result from LSP into a table of symbols
---@param result table The result from a language server.
---@param depth number? The current depth of the symbol in the hierarchy.
Expand Down Expand Up @@ -38,10 +42,12 @@ local function parse_result(result, depth, hierarchy, parent)
range = value.location.range
end

local kind = starts_with(value.name or '', 'defp ') and 6 or value.kind

local node = {
deprecated = value.deprecated,
kind = value.kind,
icon = symbols.icon_from_kind(value.kind),
kind = kind,
icon = symbols.icon_from_kind(kind),
name = value.name or value.text,
detail = value.detail,
line = selectionRange.start.line,
Expand Down