Skip to content
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
30 changes: 17 additions & 13 deletions src/languageOutPut/languageOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,27 +149,31 @@ class FunctionTplStr {
// 拼接type和param参数
getTypeVal (item = {}) {
const typeVal = this.getTodoType(item)

// type 和 param 都不存在
if (item.type === undefined && item.param === undefined) {
return typeVal
}

// 配置不要类型捕获
let res = ''
if (this.config.configObj.functionParamsShape === 'no type') {
// return 没有param
if (item.param === undefined) {
return ''
}
return `${item.param}`
}
// 默认值没有匹配到param
if (item.type === undefined && item.param === undefined) {
return typeVal
}
const typeParamOrder = this.config.configObj.typeParamOrder
let res = ''
if (typeParamOrder === 'type param') {
res = `${typeVal} ${item.param}`
} else if (typeParamOrder === 'param type') {
res = `${item.param} ${typeVal}`
} else if (typeParamOrder === 'param') {
res = `${item.param}`
} else {
const typeParamOrder = this.config.configObj.typeParamOrder
if (typeParamOrder === 'type param') {
res = `${typeVal} ${item.param}`
} else if (typeParamOrder === 'param type') {
res = `${item.param} ${typeVal}`
} else if (typeParamOrder === 'param') {
res = `${item.param}`
}
}

// 在type param 后面增加字符串 可能是冒号,方便输入参数描述
const functionParamAddStr = this.config.configObj.functionParamAddStr
if (functionParamAddStr) {
Expand Down