tell application "Script Debugger"
tell document 1
set {theLocation, theLength} to character range of selection
set theText to source text
set character range of selection to my paragraphRangeFor(theText, theLocation, theLength)
end tell
end tell
on paragraphRangeFor(theText, theLocation, theLength)
-- adjust for when last char of para is selected
if character (theLocation + theLength) of theText is in {return, linefeed} then set theLength to theLength - 1
-- get bits of paras before and after
set theBefore to paragraph -1 of text 1 through (theLocation - 1) of theText
set theAfter to paragraph 1 of text (theLocation + theLength + 1) through -1 of theText
-- build new selection range
set lastBeforeLength to length of theBefore
set newLocation to theLocation - lastBeforeLength
set newLength to lastBeforeLength + theLength + (length of theAfter) + 2
return {newLocation, newLength}
end paragraphRangeFor