From 8d4fbba18a005c65412657be1fdb0616ea2cb28e Mon Sep 17 00:00:00 2001 From: Travis Smith Date: Tue, 6 May 2014 17:14:43 -0400 Subject: [PATCH] Customize @param output w/ `jsdocs_type_info`, Added jsdocs_type_info setting --- Base File.sublime-settings | 3 +++ jsdocs.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Base File.sublime-settings b/Base File.sublime-settings index 185115c..585f711 100644 --- a/Base File.sublime-settings +++ b/Base File.sublime-settings @@ -52,6 +52,9 @@ // A map to determine the value of variables, should hungarian notation (or similar) be in use "jsdocs_notation_map": [], + + // Customize @param description based on type, should be type: description, e.g. "array": "${1:[descriptiona]}", + "jsdocs_type_info": {}, // Since there seems to be no agreed standard for "@return" or "@returns", use this setting to rename it as you wish. "jsdocs_return_tag": "@return", diff --git a/jsdocs.py b/jsdocs.py index c333913..08931c1 100644 --- a/jsdocs.py +++ b/jsdocs.py @@ -355,7 +355,12 @@ def formatFunction(self, name, args, retval, options={}): typeInfo = self.getTypeInfo(argType, argName) format_str = "@param %s%s" - if (self.viewSettings.get('jsdocs_param_description')): + + typeInfoSettings = self.viewSettings.get("jsdocs_type_info") + typeInfoName = escape(argType or self.guessTypeFromName(argName) or "[type]") + if typeInfoSettings[typeInfoName]: + format_str += " "+typeInfoSettings[typeInfoName] + elif (self.viewSettings.get('jsdocs_param_description')): format_str += " ${1:[description]}" out.append(format_str % (