Repository: microsoft/TypeScript
File: src/services/inlayHints.ts (TypeScript)

Code before:
                        visitDisplayPartList(node.typeArguments, ", ");
                        parts.push({ text: ">" });
                    }
                    break;
                case SyntaxKind.TypeParameter:
                    Debug.assertNode(node, isTypeParameterDeclaration);
                    if (node.modifiers) {
                        visitDisplayPartList(node.modifiers, " ");
                    }
                    visitForDisplayParts(node.name);
                    if (node.constraint) {
                        parts.push({ text: " extends " });
                        visitForDisplayParts(node.constraint);
                    }
                    if (node.default) {
                        parts.push({ text: " = " });
                        visitForDisplayParts(node.default);
                    }
                    break;
                case SyntaxKind.Parameter:
                    Debug.assertNode(node, isParameter);
                    if (node.modifiers) {
                        visitDisplayPartList(node.modifiers, " ");
                    }
                    if (node.dotDotDotToken) {
                        parts.push({ text: "..." });
                    }
                    visitForDisplayParts(node.name);
                    if (node.questionToken) {
                        parts.push({ text: "?" });
                    }
                    if (node.type) {
                        parts.push({ text: ": " });
                        visitForDisplayParts(node.type);
                    }
                    break;
                case SyntaxKind.ConstructorType:
                    Debug.assertNode(node, isConstructorTypeNode);
                    parts.push({ text: "new " });
                    visitParametersAndTypeParameters(node);
                    parts.push({ text: " => " });
                    visitForDisplayParts(node.type);
                    break;
                case SyntaxKind.TypeQuery:
                    Debug.assertNode(node, isTypeQueryNode);
                    parts.push({ text: "typeof " });
                    visitForDisplayParts(node.exprName);
                    if (node.typeArguments) {
                        parts.push({ text: "<" });
                        visitDisplayPartList(node.typeArguments, ", ");
                        parts.push({ text: ">" });

Review comment (refactor):
This code duplicates the exact same logic that already exists in the `visitForDisplayParts` function for `SyntaxKind.Parameter` case (line 600-602 in context). The spacing logic should be handled consistently in one place rather than duplicated.
```suggestion
                    if (node.modifiers) {
                        visitDisplayPartList(node.modifiers, " ");
                    }
```

Code after:
                        visitDisplayPartList(node.typeArguments, ", ");
                        parts.push({ text: ">" });
                    }
                    break;
                case SyntaxKind.TypeParameter:
                    Debug.assertNode(node, isTypeParameterDeclaration);
                    if (node.modifiers) {
                        visitDisplayPartList(node.modifiers, " ");
                        parts.push({ text: " " });
                    }
                    visitForDisplayParts(node.name);
                    if (node.constraint) {
                        parts.push({ text: " extends " });
                        visitForDisplayParts(node.constraint);
                    }
                    if (node.default) {
                        parts.push({ text: " = " });
                        visitForDisplayParts(node.default);
                    }
                    break;
                case SyntaxKind.Parameter:
                    Debug.assertNode(node, isParameter);
                    if (node.modifiers) {
                        visitDisplayPartList(node.modifiers, " ");
                        parts.push({ text: " " });
                    }
                    if (node.dotDotDotToken) {
                        parts.push({ text: "..." });
                    }
                    visitForDisplayParts(node.name);
                    if (node.questionToken) {
                        parts.push({ text: "?" });
                    }
                    if (node.type) {
                        parts.push({ text: ": " });
                        visitForDisplayParts(node.type);
                    }
                    break;
                case SyntaxKind.ConstructorType:
                    Debug.assertNode(node, isConstructorTypeNode);
                    parts.push({ text: "new " });
                    visitParametersAndTypeParameters(node);
                    parts.push({ text: " => " });
                    visitForDisplayParts(node.type);
                    break;
                case SyntaxKind.TypeQuery:
                    Debug.assertNode(node, isTypeQueryNode);
                    parts.push({ text: "typeof " });
                    visitForDisplayParts(node.exprName);
                    if (node.typeArguments) {
                        parts.push({ text: "<" });