WorkspaceCompletionSupport.st
branchdelegated_gc_hg
changeset 5128 787b617a99e5
parent 5097 2d0d83f6599d
child 5129 9549b0a1dbf5
child 5220 5251ecf0c9bb
child 5694 111c73cd9b4b
equal deleted inserted replaced
5085:52e9f87d45c8 5128:787b617a99e5
    28 
    28 
    29 !WorkspaceCompletionSupport methodsFor:'private'!
    29 !WorkspaceCompletionSupport methodsFor:'private'!
    30 
    30 
    31 computeCompletions
    31 computeCompletions
    32 
    32 
    33     |suggestions implementations actions anyFound contextOrNil|
    33     |suggestions implementations actions contextOrNil|
    34 
    34 
    35     "/ a hack
    35     "/ a hack
    36     (editView topView isKindOf: DebugView) ifTrue:[
    36     (editView topView isKindOf: DebugView) ifTrue:[
    37         contextOrNil := editView topView selectedContext.
    37         contextOrNil := editView topView selectedContext.
    38     ].
    38     ].
    39 
    39 
    40     UserInformation ignoreIn:[
    40     UserInformation ignoreIn:[
    41         anyFound := false.
       
    42         DoWhatIMeanSupport 
    41         DoWhatIMeanSupport 
    43             codeCompletionFor: editView codeAspect
    42             codeCompletionFor: editView codeAspect
    44             language: editView editedLanguage
    43             language: editView editedLanguage
    45             method:editView editedMethod
    44             method:editView editedMethod
    46             orClass:editView editedClass 
    45             orClass:editView editedClass 
    49             into:[:listOfSuggestions :listOfActions :titleWhenAsking |
    48             into:[:listOfSuggestions :listOfActions :titleWhenAsking |
    50 "/ (listOfSuggestions contains:[:l | l isEmptyOrNil]) ifTrue:[self halt].
    49 "/ (listOfSuggestions contains:[:l | l isEmptyOrNil]) ifTrue:[self halt].
    51                     suggestions := listOfSuggestions collect:[:entry | entry isArray ifTrue:[entry first] ifFalse:[entry]].
    50                     suggestions := listOfSuggestions collect:[:entry | entry isArray ifTrue:[entry first] ifFalse:[entry]].
    52                     implementations := listOfSuggestions collect:[:entry | entry isArray ifTrue:[entry second] ifFalse:[nil]].                            
    51                     implementations := listOfSuggestions collect:[:entry | entry isArray ifTrue:[entry second] ifFalse:[nil]].                            
    53                     actions := listOfActions.
    52                     actions := listOfActions.
    54                     anyFound := true.
       
    55                     nil "/ must return nil to avoid DWIM to do it itself (for now)
    53                     nil "/ must return nil to avoid DWIM to do it itself (for now)
    56             ]
    54             ]
    57     ].
    55     ].
    58     "/ anyFound ifFalse:[self halt].
       
    59     "/ Transcript show:'suggestions: '; showCR:suggestions.
    56     "/ Transcript show:'suggestions: '; showCR:suggestions.
    60     "/ Transcript show:'actions: '; showCR:actions.  
    57     "/ Transcript show:'actions: '; showCR:actions. 
    61     editView sensor
    58     editView sensor
    62         pushUserEvent:#'suggestionsArrived:implementations:actions:autoSelect:'
    59         pushUserEvent:#'suggestionsArrived:implementations:actions:autoSelect:'
    63         for:self
    60         for:self
    64         withArguments:{suggestions . implementations . actions . autoSelect }
    61         withArguments:{suggestions . implementations . actions . autoSelect }
    65 
    62 
   105                 "/ true, false and self are often found in both lists
   102                 "/ true, false and self are often found in both lists
   106                 (suggestions includes:sniplet) ifFalse:[   
   103                 (suggestions includes:sniplet) ifFalse:[   
   107                     suggestions isEmpty ifFalse:[ suggestions := suggestions copyWith: '-' ]. 
   104                     suggestions isEmpty ifFalse:[ suggestions := suggestions copyWith: '-' ]. 
   108                     suggestions := suggestions copyWith: ( '%1 %2'
   105                     suggestions := suggestions copyWith: ( '%1 %2'
   109                                             bindWith:(sniplet asStringCollection first "contractTo:25")
   106                                             bindWith:(sniplet asStringCollection first "contractTo:25")
   110                                             with: ( ('("',abbrev,'" snippet)') colorizeAllWith:Color grey)).
   107                                             with: ( ('("',abbrev,'" snippet)') colorizeAllWith:Color gray)).
   111                     indexOfSnippet := suggestions size.
   108                     indexOfSnippet := suggestions size.
   112 
   109 
   113                     "/ change below, when reversing the order in above code
   110                     "/ change below, when reversing the order in above code
   114                     "/ suggestionOffset := 2.
   111                     "/ suggestionOffset := 2.
   115                 ]
   112                 ]
   237 ! !
   234 ! !
   238 
   235 
   239 !WorkspaceCompletionSupport class methodsFor:'documentation'!
   236 !WorkspaceCompletionSupport class methodsFor:'documentation'!
   240 
   237 
   241 version
   238 version
   242     ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.7 2014-01-28 19:27:02 cg Exp $'
   239     ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.9 2014-07-08 21:17:07 cg Exp $'
   243 !
   240 !
   244 
   241 
   245 version_CVS
   242 version_CVS
   246     ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.7 2014-01-28 19:27:02 cg Exp $'
   243     ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.9 2014-07-08 21:17:07 cg Exp $'
   247 ! !
   244 ! !
   248 
   245