Skip to content

Commit

Permalink
Merge pull request #1 from chenweiyi/master
Browse files Browse the repository at this point in the history
feat: keep the suggestions concise
  • Loading branch information
zcf0508 authored Sep 6, 2023
2 parents 94a155f + 88af1bc commit 43ecf96
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/suggest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,13 @@ export function gen(
splitedGraph.forEach(g => {
const nodes = Array.from(g.keys());
if(splitedGraph.length > 1) {
suggests.push(`Node${
nodes.length> 1 ? 's': ''
} [${
nodes.length > 10
? nodes.slice(0, 10).map(node => node.label).join(',') + '...('+nodes.length+')'
: nodes.map(node => node.label).join(',')
}] ${
nodes.length> 1 ? 'are': 'is'
} isolated${
nodes.length > 2 ? ', perhaps you can refactor them to an isolated file.' : '.'
}`);
if (nodes.length > 1) {
suggests.push(`Nodes[${
nodes.length > 10
? nodes.slice(0, 10).map(node => node.label).join(',') + '...('+nodes.length+')'
: nodes.map(node => node.label).join(',')
}] are isolated, perhaps you can refactor them to an isolated file.`);
}
}
if(nodes.every(node => !usedNodes.has(node.label))) {
suggests.push(`Node${
Expand Down

0 comments on commit 43ecf96

Please sign in to comment.