DoWhatIMeanSupport.st
changeset 5552 2fe0fa28ecf5
parent 5551 69c688e4d25b
child 5598 5b69ed53ef4b
equal deleted inserted replaced
5551:69c688e4d25b 5552:2fe0fa28ecf5
   939             ^ (oldName copyFrom:prefix size+1).
   939             ^ (oldName copyFrom:prefix size+1).
   940         ]
   940         ]
   941     ].
   941     ].
   942     (lastOldName asLowercase = lastNewName asLowercase) ifTrue:[
   942     (lastOldName asLowercase = lastNewName asLowercase) ifTrue:[
   943         (lastOldName first ~= lastNewName first) ifTrue:[
   943         (lastOldName first ~= lastNewName first) ifTrue:[
   944             (lastOldName first isLowercase = oldName first isLowercase) ifTrue:[
   944             (lastOldName isLowercaseFirst = oldName isLowercaseFirst) ifTrue:[
   945                 "last rename was
   945                 "last rename was
   946                     'xfoo' -> 'Xfoo'
   946                     'xfoo' -> 'Xfoo'
   947                  then, a good default for
   947                  then, a good default for
   948                     'xbar' would be 'Xbar'
   948                     'xbar' would be 'Xbar'
   949                 "
   949                 "
  1081      self goodRenameDefaultFor:'mti.odt2.level1HeadlineStyle'
  1081      self goodRenameDefaultFor:'mti.odt2.level1HeadlineStyle'
  1082                        lastOld:'mti.odt2.level1HeadlineMatchPattern'
  1082                        lastOld:'mti.odt2.level1HeadlineMatchPattern'
  1083                        lastNew:'Key_odt2_level1HeadlineMatchPattern'
  1083                        lastNew:'Key_odt2_level1HeadlineMatchPattern'
  1084     "
  1084     "
  1085 
  1085 
  1086     "Modified: / 24-07-2011 / 11:06:03 / cg"
  1086     "Modified: / 22-06-2017 / 06:56:55 / cg"
  1087 !
  1087 !
  1088 
  1088 
  1089 goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName
  1089 goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName
  1090     "generate a reasonable default for a file rename operation.
  1090     "generate a reasonable default for a file rename operation.
  1091      (Try to rename multiple files in the new fileBrowser,
  1091      (Try to rename multiple files in the new fileBrowser,
  1669         cursorLineSource := partialSource copy.
  1669         cursorLineSource := partialSource copy.
  1670 
  1670 
  1671         "/ this cares for doIt expressions in the last cursor line;
  1671         "/ this cares for doIt expressions in the last cursor line;
  1672         "/ however, we skip this, if the source starts with a lowercase letter
  1672         "/ however, we skip this, if the source starts with a lowercase letter
  1673         "/ (then it is likely, that the user wants to define a new method)
  1673         "/ (then it is likely, that the user wants to define a new method)
  1674         (partialSource first isLowercase) ifFalse:[
  1674         (partialSource isLowercaseFirst) ifFalse:[
  1675 
  1675 
  1676             "/ first try parsing the current cursor line.
  1676             "/ first try parsing the current cursor line.
  1677             "/ this helps doIts in a workspace, where additional garbage is often before the actual expression to be evaluated
  1677             "/ this helps doIts in a workspace, where additional garbage is often before the actual expression to be evaluated
  1678             (i := partialSource lastIndexOf:Character cr) ~~ 0 ifTrue:[
  1678             (i := partialSource lastIndexOf:Character cr) ~~ 0 ifTrue:[
  1679                 "/ because cursorPositions and node-positions are required elsewhere to be correct,
  1679                 "/ because cursorPositions and node-positions are required elsewhere to be correct,
  1715         ^ self
  1715         ^ self
  1716     ].    
  1716     ].    
  1717     actionBlock value:suggestions value:actions value:title.
  1717     actionBlock value:suggestions value:actions value:title.
  1718 
  1718 
  1719     "Created: / 18-09-2013 / 15:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1719     "Created: / 18-09-2013 / 15:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1720     "Modified: / 08-04-2017 / 16:31:11 / cg"
  1720     "Modified: / 22-06-2017 / 06:56:30 / cg"
  1721 ! !
  1721 ! !
  1722 
  1722 
  1723 !DoWhatIMeanSupport methodsFor:'code completion - obsolete'!
  1723 !DoWhatIMeanSupport methodsFor:'code completion - obsolete'!
  1724 
  1724 
  1725 codeCompletionForClass:classOrNilArg context:contextOrNil codeView:codeViewArg
  1725 codeCompletionForClass:classOrNilArg context:contextOrNil codeView:codeViewArg
  3437             "/ (further down the code), add them also
  3437             "/ (further down the code), add them also
  3438             tree variableNodesDo:[:var |
  3438             tree variableNodesDo:[:var |
  3439                 |name|
  3439                 |name|
  3440 
  3440 
  3441                 name := var name.
  3441                 name := var name.
  3442                 (name first isLowercase or:[isLeftSideOfAssignment not]) ifTrue:[
  3442                 (name isLowercaseFirst or:[isLeftSideOfAssignment not]) ifTrue:[
  3443                     (setOfNames includes:name) ifFalse:[
  3443                     (setOfNames includes:name) ifFalse:[
  3444                         names add:name.
  3444                         names add:name.
  3445                         setOfNames add:name
  3445                         setOfNames add:name
  3446                     ]
  3446                     ]
  3447                 ]
  3447                 ]
  3596                     ]
  3596                     ]
  3597                 ].
  3597                 ].
  3598 
  3598 
  3599                 "/ only consider all globals, if the first char of the completed name is uppercase;
  3599                 "/ only consider all globals, if the first char of the completed name is uppercase;
  3600                 "/ otherwise, only consider names with a caseInsensitve prefix match
  3600                 "/ otherwise, only consider names with a caseInsensitve prefix match
  3601                 nm first isUppercase ifFalse:[
  3601                 nm isUppercaseFirst ifFalse:[
  3602                     names := names select:[:globalName | globalName asLowercase startsWith: nm].
  3602                     names := names select:[:globalName | globalName asLowercase startsWith: nm].
  3603                 ].
  3603                 ].
  3604                 addWithFactorBlock value:names value:(1.5 * globalFactor).
  3604                 addWithFactorBlock value:names value:(1.5 * globalFactor).
  3605             ].
  3605             ].
  3606         ].
  3606         ].
  3746                    ].
  3746                    ].
  3747     actionBlock value:suggestionsWithInfo value:editActions value:nil.
  3747     actionBlock value:suggestionsWithInfo value:editActions value:nil.
  3748 
  3748 
  3749     "Created: / 10-11-2006 / 13:16:33 / cg"
  3749     "Created: / 10-11-2006 / 13:16:33 / cg"
  3750     "Modified: / 16-02-2010 / 10:13:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  3750     "Modified: / 16-02-2010 / 10:13:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  3751     "Modified: / 05-05-2017 / 17:20:35 / cg"
       
  3752     "Modified (comment): / 12-06-2017 / 12:34:46 / mawalch"
  3751     "Modified (comment): / 12-06-2017 / 12:34:46 / mawalch"
       
  3752     "Modified: / 22-06-2017 / 06:56:42 / cg"
  3753 !
  3753 !
  3754 
  3754 
  3755 editActionToInsert:aString
  3755 editActionToInsert:aString
  3756     ^ [:index |
  3756     ^ [:index |
  3757         codeView
  3757         codeView