Fix: make Toolbar components support CallExpressionKw
This commit is contained in:
		
				
					committed by
					
						
						Nick Cameron
					
				
			
			
				
	
			
			
			
						parent
						
							12ed315244
						
					
				
				
					commit
					da3788afba
				
			@ -57,7 +57,7 @@ export function equalAngleInfo({
 | 
			
		||||
  )
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      toolTips.includes(node.callee.name as any)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,7 @@ export function setEqualLengthInfo({
 | 
			
		||||
  )
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      toolTips.includes(node.callee.name as any)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ export function horzVertInfo(
 | 
			
		||||
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      toolTips.includes(node.callee.name as any)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -98,7 +98,7 @@ export function intersectInfo({
 | 
			
		||||
  )
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      [
 | 
			
		||||
        ...toolTips,
 | 
			
		||||
        'startSketchAt', // TODO probably a better place for this to live
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ export function removeConstrainingValuesInfo({
 | 
			
		||||
    : selectionRanges
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      toolTips.includes(node.callee.name as any)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -45,11 +45,10 @@ export function absDistanceInfo({
 | 
			
		||||
      ? 'xAbs'
 | 
			
		||||
      : 'yAbs'
 | 
			
		||||
  const _nodes = selectionRanges.graphSelections.map(({ codeRef }) => {
 | 
			
		||||
    const tmp = getNodeFromPath<Expr>(
 | 
			
		||||
      kclManager.ast,
 | 
			
		||||
      codeRef.pathToNode,
 | 
			
		||||
      'CallExpression'
 | 
			
		||||
    )
 | 
			
		||||
    const tmp = getNodeFromPath<Expr>(kclManager.ast, codeRef.pathToNode, [
 | 
			
		||||
      'CallExpression',
 | 
			
		||||
      'CallExpressionKw',
 | 
			
		||||
    ])
 | 
			
		||||
    if (err(tmp)) return tmp
 | 
			
		||||
    return tmp.node
 | 
			
		||||
  })
 | 
			
		||||
@ -59,7 +58,7 @@ export function absDistanceInfo({
 | 
			
		||||
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      toolTips.includes(node.callee.name as any)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -57,7 +57,7 @@ export function angleBetweenInfo({
 | 
			
		||||
  )
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      toolTips.includes(node.callee.name as any)
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -61,7 +61,7 @@ export function horzVertDistanceInfo({
 | 
			
		||||
  )
 | 
			
		||||
  const isAllTooltips = nodes.every(
 | 
			
		||||
    (node) =>
 | 
			
		||||
      node?.type === 'CallExpression' &&
 | 
			
		||||
      (node?.type === 'CallExpression' || node?.type === 'CallExpressionKw') &&
 | 
			
		||||
      [
 | 
			
		||||
        ...toolTips,
 | 
			
		||||
        'startSketchAt', // TODO probably a better place for this to live
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user