@rehearsal/codefixes
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -38,3 +38,8 @@ import { ChangesFactory } from '@rehearsal/ts-utils'; | ||
const hint = hints.find((hint) => hint.position >= targetPosition && hint.position <= targetPosition + 1); | ||
if (!hint || hint.text.includes('any') || hint.text.includes('object')) { | ||
if (!hint || | ||
hint.text.includes('any') || | ||
hint.text.includes('object') || | ||
// Some hints will be truncated with three periods not ellipsis character. | ||
// This can break syntax if injected. | ||
hint.text.includes('...')) { | ||
return undefined; | ||
@@ -41,0 +46,0 @@ } |
@@ -22,20 +22,40 @@ import { extname } from 'node:path'; | ||
const transformedRange = glintService.transformManager.getTransformedRange(fileName, originalStart, originalEnd); | ||
// Check the parent to see if this is an arg | ||
const parentSourceNode = transformedRange?.mapping?.parent?.sourceNode; | ||
if (!parentSourceNode) { | ||
return; | ||
let argName; | ||
// If the transformedRange has a mapping it means it's from an hbs region | ||
if (transformedRange?.mapping) { | ||
// Check the parent to see if this is an arg | ||
const parentSourceNode = transformedRange?.mapping?.parent?.sourceNode; | ||
if (!parentSourceNode) { | ||
return; | ||
} | ||
// Determine if this is an argument | ||
let isPathExpressionAnArgument = false; | ||
if (parentSourceNode.type === 'PathExpression') { | ||
// Unable to easily cast to a type, this is a hack for now. | ||
isPathExpressionAnArgument = parentSourceNode.original.startsWith('@'); | ||
} | ||
if (!isPathExpressionAnArgument) { | ||
return; | ||
} | ||
// We may be able to get this from the diagnostic | ||
argName = | ||
transformedRange?.mapping?.sourceNode.type == 'Identifier' | ||
? transformedRange?.mapping?.sourceNode.name | ||
: null; | ||
} | ||
// Determine if this is an argument | ||
let isPathExpressionAnArgument = false; | ||
if (parentSourceNode.type === 'PathExpression') { | ||
// Unable to easily cast to a type, this is a hack for now. | ||
isPathExpressionAnArgument = parentSourceNode.original.startsWith('@'); | ||
else { | ||
// Check if it's a this.args statement | ||
const targetNode = glintDiagnostic.node; | ||
const parent = targetNode?.parent; | ||
if (targetNode && | ||
ts.isIdentifier(targetNode) && | ||
parent && | ||
ts.isPropertyAccessExpression(parent) && | ||
ts.isPropertyAccessExpression(parent.expression) && | ||
parent.expression.name.escapedText === 'args' && | ||
ts.isPropertyAccessExpression(parent.expression.parent) && | ||
parent.expression.expression.kind === ts.SyntaxKind.ThisKeyword) { | ||
argName = targetNode.escapedText.toString(); | ||
} | ||
} | ||
if (!isPathExpressionAnArgument) { | ||
return; | ||
} | ||
// We may be able to get this from the diagnostic | ||
const argName = transformedRange?.mapping?.sourceNode.type == 'Identifier' | ||
? transformedRange?.mapping?.sourceNode.name | ||
: null; | ||
if (!argName) { | ||
@@ -42,0 +62,0 @@ return; |
{ | ||
"name": "@rehearsal/codefixes", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Rehearsal Dependency Codefixes Collection", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"vscode-languageserver": "^8.1.0", | ||
"@rehearsal/ts-utils": "1.2.1" | ||
"@rehearsal/ts-utils": "1.2.2" | ||
}, | ||
@@ -47,5 +47,5 @@ "devDependencies": { | ||
"vitest": "^0.30.0", | ||
"@rehearsal/reporter": "1.2.1", | ||
"@rehearsal/migrate": "1.2.1", | ||
"@rehearsal/service": "1.2.1" | ||
"@rehearsal/reporter": "1.2.2", | ||
"@rehearsal/service": "1.2.2", | ||
"@rehearsal/migrate": "1.2.2" | ||
}, | ||
@@ -52,0 +52,0 @@ "peerDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1537021
17441
+ Added@rehearsal/ts-utils@1.2.2(transitive)
- Removed@rehearsal/ts-utils@1.2.1(transitive)
Updated@rehearsal/ts-utils@1.2.2