rokucommunity / ropm

A package manager for the Roku platform.
MIT License
31 stars 5 forks source link

d.bs comments are in wrong spot #57

Open TwitchBronBron opened 1 year ago

TwitchBronBron commented 1 year ago

The namespace-wrapping logic for d.bs files needs to wrap around the leading documentation blocks. Consider this raw d.bs file from node_modules

' /**
' * Adds two numbers.
' * @category Math
' * @param {Dynamic} augend - The first number in an addition
' * @param {Dynamic} addend - The second number in an addition
' * @returns {Dynamic} value - Returns the total
' */
function add(augend, addend)
end function

ropm incorrectly transforms it to this:

' /**
' * Adds two numbers.
' * @category Math
' * @param {Dynamic} augend - The first number in an addition
' * @param {Dynamic} addend - The second number in an addition
' * @returns {Dynamic} value - Returns the total
' */
namespace rodash
    function add(augend, addend)
    end function
end namespace

when it should have been this:

namespace rodash
    ' /**
    ' * Adds two numbers.
    ' * @category Math
    ' * @param {Dynamic} augend - The first number in an addition
    ' * @param {Dynamic} addend - The second number in an addition
    ' * @returns {Dynamic} value - Returns the total
    ' */
    function add(augend, addend)
    end function
end namespace

I think this is the spot that needs updated. We need to walk upwards to set the starting line above any leading comments