DoWhatIMeanSupport.st
author Claus Gittinger <cg@exept.de>
Sun, 03 Jul 2011 16:27:01 +0200
changeset 4045 b2d1e9bb8c37
parent 4044 1ad77f8196e3
child 4047 bd93629fe049
permissions -rw-r--r--
support non-class based code completion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2002 by eXept Software AG
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Object subclass:#DoWhatIMeanSupport
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:''
3853
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
    16
	classVariableNames:'LastSource LastParseTree LastChoices'
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'System-Support'
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
    21
Array variableSubclass:#InputCompletionResult
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
    22
	instanceVariableNames:''
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
    23
	classVariableNames:''
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
    24
	poolDictionaries:''
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
    25
	privateIn:DoWhatIMeanSupport
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
    26
!
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
    27
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
!DoWhatIMeanSupport class methodsFor:'documentation'!
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
copyright
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
"
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 COPYRIGHT (c) 2002 by eXept Software AG
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
              All Rights Reserved
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 This software is furnished under a license and may be used
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 only in accordance with the terms of that license and with the
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 inclusion of the above copyright notice.   This software may not
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 be provided or otherwise made available to, or used by, any
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
 other person.  No title to or ownership of the software is
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
 hereby transferred.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
!
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
documentation
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
"
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    misc collected UI support (functional)
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    47
    These used to be in the Smalltalk and SystemBrowser class; 
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    48
    however, they are only needed for programmers, and some of the stuff is useful in multiple
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    49
    places. 
3667
acb358ca4b0b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3660
diff changeset
    50
    Therefore it is:
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    51
        1) not needed for standalone executables
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    52
        2) published here to avoid multiple implementations
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    [author:]
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
        Claus Gittinger (cg@exept.de)
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    57
"
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    58
! !
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    59
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    60
!DoWhatIMeanSupport class methodsFor:'code completion'!
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    61
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    62
codeCompletionForClass:classOrNil codeView:codeView
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    63
    self codeCompletionForClass:classOrNil context:nil codeView:codeView
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    64
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    65
    "Modified (format): / 03-07-2011 / 15:49:49 / cg"
3557
a001bf3df400 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
    66
!
a001bf3df400 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
    67
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    68
codeCompletionForClass:classOrNil context:contextOrNil codeView:codeView
3900
82fa031be815 comment/format in: #codeCompletionForClass:context:codeView:
Claus Gittinger <cg@exept.de>
parents: 3896
diff changeset
    69
    "contextOrNil is the current context, if this is called from the debugger;
3557
a001bf3df400 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
    70
     nil, if called from the browser.
3900
82fa031be815 comment/format in: #codeCompletionForClass:context:codeView:
Claus Gittinger <cg@exept.de>
parents: 3896
diff changeset
    71
     If nonNil, we can make better guesses, because we actually know what a variable's type is.
82fa031be815 comment/format in: #codeCompletionForClass:context:codeView:
Claus Gittinger <cg@exept.de>
parents: 3896
diff changeset
    72
     This is not yet done, sigh"
3557
a001bf3df400 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3554
diff changeset
    73
    
3900
82fa031be815 comment/format in: #codeCompletionForClass:context:codeView:
Claus Gittinger <cg@exept.de>
parents: 3896
diff changeset
    74
    |crsrPos char interval source node checkedNode|
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    75
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    76
"/    classOrNil isNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    77
"/        self information:'No class'.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    78
"/        ^ self.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
    79
"/    ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    80
3731
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    81
    crsrPos := codeView characterPositionOfCursor-1.
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    82
    char := codeView characterAtCharacterPosition:crsrPos.
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    83
    [crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    84
        crsrPos := crsrPos - 1.
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    85
        char := codeView characterAtCharacterPosition:crsrPos.
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    86
    ].
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    87
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    88
    interval := codeView selectedInterval.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    89
    interval isEmpty ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    90
        interval := crsrPos to:crsrPos.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    91
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    92
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    93
    source := codeView contentsAsString string.
3731
eb92d54a47ac fixed code completion for selector
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
    94
    source := source copyTo:crsrPos.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
    95
3720
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
    96
    "/ this is too naive and stupid; if there is a syntactic error,
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
    97
    "/ we will not find a node for a long time (stepping back more and more,
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
    98
    "/ until reaching the beginning). This leads to a thousand and more times reparsing
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
    99
    "/ without any progress.
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   100
    "/ TODO: do it vice-versa, in that the parser does a callOut for every node generated
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   101
    "/ as it parses the code. Stop, when the interval is hit.
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   102
    "/ that will also work for syntactic incorrect source code.
3895
79124f2311a1 comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
   103
    node := self findNodeForInterval:interval in:source allowErrors:true.   
3720
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   104
"/    [node isNil] whileTrue:[
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   105
"/        "/ expand to the left ...
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   106
"/        interval start > 1 ifFalse:[
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   107
"/            self information:'No parseNode found'.
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   108
"/            ^ self.
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   109
"/        ].
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   110
"/        interval start:(interval start - 1).
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   111
"/        node := self findNodeForInterval:interval in:source allowErrors:true.
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   112
"/    ].
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   113
    node isNil ifTrue:[
3895
79124f2311a1 comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
   114
        Transcript showCR:'No parseNode found'.
79124f2311a1 comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
   115
        self breakPoint:#cg.
3720
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   116
        self information:'No parseNode found'.
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   117
        ^ self.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   118
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   119
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   120
    (node isVariable
3366
67d627de3bc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3362
diff changeset
   121
    and:[ node parent notNil
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   122
    and:[ node parent isMessage
3366
67d627de3bc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3362
diff changeset
   123
    and:[ node stop < (codeView characterPositionOfCursor-1) ]]]) ifTrue:[
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   124
        node := node parent.
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   125
    ].
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   126
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   127
    node isVariable ifTrue:[
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   128
        self codeCompletionForVariable:node inClass:classOrNil codeView:codeView.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   129
        ^ self.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   130
    ].
3552
e631f2f7bb2a code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents: 3551
diff changeset
   131
    node isLiteral ifTrue:[
e631f2f7bb2a code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents: 3551
diff changeset
   132
        node value isSymbol ifTrue:[
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   133
            self codeCompletionForLiteralSymbol:node inClass:classOrNil codeView:codeView.
3552
e631f2f7bb2a code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents: 3551
diff changeset
   134
            ^ self.
e631f2f7bb2a code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents: 3551
diff changeset
   135
        ].
e631f2f7bb2a code completion for symbol literals
Claus Gittinger <cg@exept.de>
parents: 3551
diff changeset
   136
    ].
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   137
    classOrNil isNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   138
        ^ self.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   139
    ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   140
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   141
    checkedNode := node.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   142
    [checkedNode notNil] whileTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   143
        checkedNode isMessage ifTrue:[
3306
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   144
            "/ completion in a message-send
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   145
            self codeCompletionForMessage:checkedNode inClass:classOrNil codeView:codeView.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   146
            ^ self
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   147
        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   148
        checkedNode isMethod ifTrue:[
3900
82fa031be815 comment/format in: #codeCompletionForClass:context:codeView:
Claus Gittinger <cg@exept.de>
parents: 3896
diff changeset
   149
            "/ completion in a method's selector pattern
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   150
            self codeCompletionForMethod:checkedNode inClass:classOrNil codeView:codeView.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   151
            ^ self.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   152
        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   153
        checkedNode := checkedNode parent.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   154
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   155
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   156
    self information:'Node is neither variable nor message.'.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   157
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   158
    "Modified: / 04-07-2006 / 18:48:26 / fm"
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   159
    "Modified: / 03-07-2011 / 15:59:25 / cg"
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   160
! !
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   161
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   162
!DoWhatIMeanSupport class methodsFor:'code completion-helpers'!
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   163
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   164
askUserForCompletion:what for:codeView from:allTheBest
3853
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   165
    |list resources choice lastChoice|
3598
f7556388601b resources
Claus Gittinger <cg@exept.de>
parents: 3586
diff changeset
   166
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   167
    allTheBest isEmpty ifTrue:[ ^ nil ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   168
    allTheBest size == 1 ifTrue:[ ^ allTheBest first ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   169
3853
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   170
    list := allTheBest.
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   171
    LastChoices notNil ifTrue:[
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   172
        lastChoice := LastChoices at:what ifAbsent:nil.
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   173
        lastChoice notNil ifTrue:[
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   174
            list := {lastChoice. nil. } , (list copyWithout:lastChoice).
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   175
        ].
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   176
    ].
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   177
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   178
    list size < 30 ifTrue:[
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   179
        |menu idx exitKey|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   180
3853
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   181
        menu := PopUpMenu labels:list.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   182
        menu hideOnKeyFilter:[:key | |hide|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   183
                hide := ( #( CursorDown CursorUp Escape Return ) includes: key) not.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   184
                hide ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   185
                    exitKey := key.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   186
                ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   187
                hide].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   188
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   189
        idx := menu startUp.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   190
        idx == 0 ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   191
            exitKey notNil ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   192
                codeView keyPress:exitKey x:0 y:0.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   193
            ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   194
            ^ nil
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   195
        ].
3853
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   196
        choice := list at:idx.
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   197
    ] ifFalse:[
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   198
        resources := codeView application isNil 
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   199
                        ifTrue:[ codeView resources]
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   200
                        ifFalse:[ codeView application resources ].
3598
f7556388601b resources
Claus Gittinger <cg@exept.de>
parents: 3586
diff changeset
   201
                    
3853
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   202
        choice := Dialog
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   203
           choose:(resources string:'Choose ',what)
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   204
           fromList:list
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   205
           lines:20
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   206
           title:(resources string:'Code completion').
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   207
        choice isNil ifTrue:[^ nil].
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   208
    ].
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   209
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   210
    LastChoices isNil ifTrue:[
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   211
        LastChoices := Dictionary new.
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   212
    ].
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   213
    LastChoices at:what put:choice.
72343b2ef436 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3852
diff changeset
   214
    ^ choice
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   215
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   216
    "Created: / 10-11-2006 / 14:00:53 / cg"
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   217
!
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   218
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   219
codeCompletionForVariable:node inClass:classOrNil codeView:codeView
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   220
    |nonMetaClass crsrPos nm
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   221
     allVariables allDistances best nodeVal
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   222
     char start stop oldLen newLen oldVar
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   223
     getDistanceComputeBlockWithWeight addWithFactorBlock names allTheBest bestAssoc
3551
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   224
     globalFactor localFactor selectorOfMessageToNode tree implementors argIdx namesUsed kwPart|
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   225
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   226
    classOrNil notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   227
        nonMetaClass := classOrNil theNonMetaclass.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   228
    ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   229
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   230
    nm := node name.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   231
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   232
    "/ if we are behind the variable and a space has already been entered,
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   233
    "/ the user is probably looking for a message selector.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   234
    "/ If the variable represents a global, present its instance creation messages
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   235
    crsrPos := codeView characterPositionOfCursor.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   236
    char := codeView characterAtCharacterPosition:crsrPos-1.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   237
    char isSeparator ifTrue:[
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   238
        classOrNil isNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   239
            nodeVal := Smalltalk at:nm asSymbol.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   240
        ] ifFalse:[ 
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   241
            nodeVal := classOrNil topNameSpace at:nm asSymbol ifAbsent:[Smalltalk at:nm asSymbol].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   242
        ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   243
        nodeVal isBehavior ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   244
            |methods menu exitKey idx|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   245
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   246
            methods := nodeVal class methodDictionary values
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   247
                            select:[:m | |cat|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   248
                                cat := m category asLowercase.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   249
                                cat = 'instance creation'
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   250
                            ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   251
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   252
            menu := PopUpMenu labels:(methods collect:[:each | each selector]).
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   253
            menu hideOnKeyFilter:[:key | |hide|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   254
                    hide := ( #( CursorDown CursorUp Escape Return ) includes: key) not.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   255
                    hide ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   256
                        exitKey := key.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   257
                    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   258
                    hide].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   259
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   260
            idx := menu startUp.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   261
            idx == 0 ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   262
                exitKey notNil ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   263
                    codeView keyPress:exitKey x:0 y:0.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   264
                ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   265
                ^ self
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   266
            ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   267
            best := (methods at:idx) selector.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   268
            codeView
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   269
                undoableDo:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   270
                    codeView insertString:best atCharacterPosition:crsrPos.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   271
                    codeView cursorToCharacterPosition:crsrPos+best size.
3362
9b92a39d5ca8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3357
diff changeset
   272
                ]
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   273
                info:'completion'.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   274
            ^ self.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   275
        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   276
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   277
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   278
    (node parent notNil and:[node parent isMessage]) ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   279
        node == node parent receiver ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   280
            selectorOfMessageToNode := node parent selector
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   281
        ]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   282
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   283
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   284
    getDistanceComputeBlockWithWeight :=
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   285
        [:weight |
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   286
            [:each |
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   287
                |dist factor|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   288
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   289
                dist := each spellAgainst:nm.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   290
                factor := 1.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   291
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   292
                (each startsWith:nm) ifTrue:[
3551
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   293
                    factor := 6 * nm size.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   294
                ] ifFalse:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   295
                    (each asLowercase startsWith:nm asLowercase) ifTrue:[
3551
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   296
                        factor := 4 * nm size.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   297
                    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   298
                ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   299
                dist := dist + (weight*factor).
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   300
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   301
                each -> (dist * weight)
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   302
             ]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   303
        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   304
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   305
    addWithFactorBlock :=
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   306
        [:names :factor | |namesToAdd|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   307
            namesToAdd := names select:[:nameToAdd | nameToAdd ~= nm ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   308
            namesToAdd := namesToAdd reject:[:each | allVariables includes:each ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   309
            allVariables addAll:namesToAdd.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   310
            allDistances addAll:(namesToAdd collect:(getDistanceComputeBlockWithWeight value:factor)).
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   311
        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   312
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   313
    nm isUppercaseFirst ifTrue:[
3551
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   314
        globalFactor := 2.    "/ favour globals
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   315
        localFactor := 1.
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   316
    ] ifFalse:[
3551
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   317
        globalFactor := 1.    "/ favour locals
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   318
        localFactor := 2.
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   319
    ].
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   320
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   321
    allVariables := OrderedCollection new.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   322
    allDistances := OrderedCollection new.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   323
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   324
    "/ are we in the methods selector spec ?
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   325
    (node parent notNil 
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   326
    and:[node parent isMethod
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   327
    and:[node parent arguments includes:node]]) ifTrue:[
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   328
        "/ now thats cool: look how the naem of this argument is in other implementations
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   329
        "/ of this method, and take that as a basis of the selection
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   330
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   331
        implementors := SystemBrowser 
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   332
                            findImplementorsOf:(node parent selector) 
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   333
                            in:(Smalltalk allClasses)
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   334
                            ignoreCase:false.
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   335
        "/ which argument is it
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   336
        argIdx := node parent arguments indexOf:node.
3554
96238651bc4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   337
        implementors size > 50 ifTrue:[
96238651bc4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   338
            implementors := implementors asOrderedCollection copyTo:50.
96238651bc4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   339
        ].
3551
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   340
        namesUsed := (implementors 
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   341
                        collect:[:eachImplementor |
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   342
                            |parseTree|
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   343
                            parseTree := eachImplementor parseTree.
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   344
                            (parseTree notNil and:[parseTree arguments size > 0]) 
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   345
                                ifFalse:nil
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   346
                                ifTrue:[ (parseTree arguments at:argIdx) name] ]
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   347
                        thenSelect:[:a | a notNil]) asSet.  
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   348
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   349
        addWithFactorBlock value:namesUsed value:(2 * localFactor).
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   350
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   351
        classOrNil notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   352
            "/ also, look for the keyword before the argument, 
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   353
            "/ and see if there is such an instVar
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   354
            "/ if so, add it with -Arg
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   355
            node parent selector isKeyword ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   356
                kwPart := node parent selector keywords at:argIdx.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   357
                (classOrNil allInstVarNames includes:(kwPart copyWithoutLast:1)) ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   358
                    addWithFactorBlock 
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   359
                        value:(classOrNil allInstVarNames collect:[:nm| nm,'Arg'])
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   360
                        value:(1 * localFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   361
                ].
3551
0c83710ae45e much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
   362
            ].
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   363
        ]
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   364
    ] ifFalse:[
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   365
        classOrNil notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   366
            "/ locals in the block/method
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   367
            names := node allVariablesOnScope.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   368
            "/ if there were no variables (due to a parse error)
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   369
            "/ do another parse and see what we have
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   370
            names isEmpty ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   371
                tree := self treeForCode:(codeView contentsAsString string) allowErrors:true.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   372
                "/ better if we already have a body (include locals then)
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   373
                "/ otherwise, only the arguments are considered
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   374
                tree notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   375
                    names := (tree body ? tree) allVariablesOnScope.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   376
                ]
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   377
            ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   378
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   379
            addWithFactorBlock value:names value:(4 * localFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   380
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   381
            "/ instance variables
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   382
            addWithFactorBlock value:classOrNil instVarNames value:(3 * localFactor).
3470
5cbf651bb214 name completion: care also for private class names
Claus Gittinger <cg@exept.de>
parents: 3366
diff changeset
   383
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   384
            "/ inherited instance variables
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   385
            classOrNil superclass notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   386
                addWithFactorBlock value:classOrNil superclass allInstVarNames value:(2.5 * localFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   387
            ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   388
        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   389
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   390
        selectorOfMessageToNode notNil ifTrue:[
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   391
            |names responders nonResponders|
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   392
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   393
            "/ responding to that messsage
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   394
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   395
            classOrNil notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   396
                "/ private classes
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   397
                addWithFactorBlock value:(nonMetaClass privateClasses collect:[:cls | cls nameWithoutPrefix])
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   398
                                   value:(1.75 * globalFactor).
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   399
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   400
                "/ class variables
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   401
                names := nonMetaClass classVarNames.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   402
                responders := names select:[:classVar | (nonMetaClass classVarAt:classVar) respondsTo:selectorOfMessageToNode].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   403
                nonResponders := names reject:[:classVar | (nonMetaClass classVarAt:classVar) respondsTo:selectorOfMessageToNode].
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   404
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   405
                addWithFactorBlock value:responders value:(1.5 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   406
                addWithFactorBlock value:nonResponders value:(0.5 * 1.5 * globalFactor).
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   407
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   408
                "/ superclass var names
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   409
                nonMetaClass allSuperclassesDo:[:superClass |
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   410
                    names := superClass classVarNames.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   411
                    responders := names select:[:classVar | (superClass classVarAt:classVar) respondsTo:selectorOfMessageToNode].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   412
                    nonResponders := names reject:[:classVar | (superClass classVarAt:classVar) respondsTo:selectorOfMessageToNode].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   413
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   414
                    addWithFactorBlock value:responders value:(1 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   415
                    addWithFactorBlock value:nonResponders value:(0.5 * 1 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   416
                ].
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   417
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   418
                "/ namespace vars
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   419
                classOrNil nameSpace ~~ Smalltalk ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   420
                    names := classOrNil topNameSpace keys.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   421
                    names := names reject:[:nm | nm includes:$:].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   422
                    names := names select:[:nm | nm isUppercaseFirst ].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   423
                    responders := names select:[:nsVar | |c| c := classOrNil topNameSpace at:nsVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   424
                    nonResponders := names reject:[:nsVar | |c| c := classOrNil topNameSpace at:nsVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   425
                    addWithFactorBlock value:responders value:(1.5 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   426
                    addWithFactorBlock value:nonResponders value:(0.5 * 1.5 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   427
                ].
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   428
            ].
3470
5cbf651bb214 name completion: care also for private class names
Claus Gittinger <cg@exept.de>
parents: 3366
diff changeset
   429
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   430
            "/ globals
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   431
            names := Smalltalk keys.
3718
a720a0edb5c7 namespace globals
Claus Gittinger <cg@exept.de>
parents: 3693
diff changeset
   432
            "/ names := names reject:[:nm | nm includes:$:].
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   433
            names := names select:[:nm | nm isUppercaseFirst ].
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   434
            responders := names select:[:glblVar | |c| c := Smalltalk at:glblVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]].
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   435
            nonResponders := names reject:[:glblVar | |c| c := Smalltalk at:glblVar. c isBehavior not or:[c isLoaded and:[c respondsTo:selectorOfMessageToNode]]].
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   436
            addWithFactorBlock value:responders value:(1.5 * globalFactor).
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   437
            addWithFactorBlock value:nonResponders value:(0.5 * 1.5 * globalFactor).
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   438
        ] ifFalse:[
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   439
            classOrNil notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   440
                "/ private classes
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   441
                addWithFactorBlock value:(nonMetaClass privateClasses collect:[:cls | cls nameWithoutPrefix])
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   442
                                   value:(1.75 * globalFactor).
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   443
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   444
                "/ class variables
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   445
                addWithFactorBlock value:nonMetaClass classVarNames value:(1.5 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   446
                classOrNil superclass notNil ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   447
                    addWithFactorBlock value:nonMetaClass superclass allClassVarNames value:(1 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   448
                ].
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   449
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   450
                "/ namespace vars
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   451
                classOrNil nameSpace ~~ Smalltalk ifTrue:[
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   452
                    names := classOrNil nameSpace isNameSpace ifTrue:[classOrNil nameSpace keys] ifFalse:[classOrNil nameSpace privateClasses collect:[:c | c nameWithoutPrefix]].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   453
                    names := names select:[:nm | nm isUppercaseFirst ].
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   454
                    addWithFactorBlock value:names value:(1.5 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   455
                ].
3761
6584390d427d dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents: 3751
diff changeset
   456
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   457
                "/ pool variables
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   458
                classOrNil theNonMetaclass sharedPools do:[:poolName |
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   459
                    |pool names|
3761
6584390d427d dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents: 3751
diff changeset
   460
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   461
                    pool := Smalltalk at:poolName.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   462
                    names := pool classVarNames.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   463
                    addWithFactorBlock value:names value:(1.5 * globalFactor).
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   464
                ].
3761
6584390d427d dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents: 3751
diff changeset
   465
            ].
6584390d427d dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents: 3751
diff changeset
   466
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   467
            "/ globals
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   468
            names := Smalltalk keys.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   469
            names := names select:[:nm | nm isUppercaseFirst ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   470
            addWithFactorBlock value:names value:(1.5 * globalFactor).
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   471
        ].
3550
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   472
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   473
        "/ pseudos - assuming that thisContext is seldom used.
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   474
        "/ also assuming, that nil is short so its usually typed in.
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   475
        addWithFactorBlock value:#('self') value:(2.5 * localFactor).
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   476
        addWithFactorBlock value:#('nil') value:(0.5 * localFactor).
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   477
        addWithFactorBlock value:#('super' 'false') value:(2 * localFactor).
34c8ab9f403f much better method-argument-name completion
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
   478
        addWithFactorBlock value:#('thisContext') value:(1 * localFactor).
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   479
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   480
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   481
    bestAssoc := allDistances at:1.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   482
    bestAssoc := allDistances inject:bestAssoc into:[:el :best | el value > best value
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   483
                                                           ifTrue:[el]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   484
                                                           ifFalse:[best]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   485
                                                    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   486
3660
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   487
    allDistances sort:[:a :b | 
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   488
                                a value > b value ifTrue:[
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   489
                                    true
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   490
                                ] ifFalse:[
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   491
                                    a value = b value ifTrue:[
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   492
                                        a key < b key
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   493
                                    ] ifFalse:[
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   494
                                        false
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   495
                                    ]
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   496
                                ]
5b165ed81191 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3600
diff changeset
   497
                      ].
3554
96238651bc4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   498
    allTheBest := allDistances select:[:entry | entry value >= (bestAssoc value * 0.5)].
96238651bc4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   499
    allTheBest size > 15 ifTrue:[
96238651bc4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   500
        allTheBest := allDistances select:[:entry | entry value >= (bestAssoc value * 0.8)].
96238651bc4c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3552
diff changeset
   501
    ].
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   502
self halt.
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   503
    best := self askUserForCompletion:'variable' for:codeView at: node start from:(allTheBest collect:[:assoc | assoc key]).
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   504
    best isNil ifTrue:[^ self].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   505
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   506
"/ self showInfo:best.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   507
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   508
    start := node start.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   509
    stop := node stop.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   510
    oldVar := (codeView textFromCharacterPosition:start to:stop) asString string withoutSeparators.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   511
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   512
    codeView
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   513
        undoableDo:[ codeView replaceFromCharacterPosition:start to:stop with:best ]
3600
7398a06f6904 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
   514
        info:'Completion'.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   515
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   516
    (best startsWith:oldVar) ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   517
        oldLen := stop - start + 1.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   518
        newLen := best size.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   519
        codeView selectFromCharacterPosition:start+oldLen to:start+newLen-1.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   520
        codeView dontReplaceSelectionOnInput
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   521
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   522
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   523
    "Created: / 10-11-2006 / 13:16:33 / cg"
4044
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   524
    "Modified: / 16-02-2010 / 10:13:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1ad77f8196e3 comment/format in:
Claus Gittinger <cg@exept.de>
parents: 3984
diff changeset
   525
    "Modified: / 03-07-2011 / 16:17:05 / cg"
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   526
!
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   527
3300
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   528
findNodeForInterval:interval in:source
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   529
    |tree node|
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   530
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   531
    interval isEmpty ifTrue: [^ nil].
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   532
    RBParser isNil ifTrue: [^ nil].
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   533
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   534
    source = LastSource ifTrue:[
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   535
        tree := LastParseTree.
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   536
    ] ifFalse:[
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   537
        tree := RBParser
3300
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   538
                parseMethod:source
3905
ad2810a7e3de comment/format in: #findNodeForInterval:in:
Claus Gittinger <cg@exept.de>
parents: 3901
diff changeset
   539
                onError: [:str :err ":nodesSoFar" | 
ad2810a7e3de comment/format in: #findNodeForInterval:in:
Claus Gittinger <cg@exept.de>
parents: 3901
diff changeset
   540
                    "Transcript showCR:'Parse-Error: ',str." 
ad2810a7e3de comment/format in: #findNodeForInterval:in:
Claus Gittinger <cg@exept.de>
parents: 3901
diff changeset
   541
                    ^ nil].
ad2810a7e3de comment/format in: #findNodeForInterval:in:
Claus Gittinger <cg@exept.de>
parents: 3901
diff changeset
   542
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   543
        tree isNil ifTrue:[^ nil].
3300
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   544
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   545
        LastSource := source.
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   546
        LastParseTree := tree.
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   547
    ].
3300
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   548
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   549
    node := tree whichNodeIsContainedBy:interval.
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   550
    node isNil ifTrue: [
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   551
        node := tree bestNodeFor: interval.
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   552
        node isNil ifTrue: [
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   553
            node := self findNodeIn:tree forInterval:interval
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   554
        ].
3300
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   555
    ].
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   556
    ^ node
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   557
3905
ad2810a7e3de comment/format in: #findNodeForInterval:in:
Claus Gittinger <cg@exept.de>
parents: 3901
diff changeset
   558
    "Modified: / 08-06-2010 / 13:20:30 / cg"
3300
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   559
!
e0f4bf68e26a codeCompletion refactored
Claus Gittinger <cg@exept.de>
parents: 3299
diff changeset
   560
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   561
findNodeForInterval:interval in:source allowErrors:allowErrors
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   562
    |tree "errCount" firstIntersectingNode|
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   563
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   564
    interval isEmpty ifTrue: [^ nil].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   565
    RBParser isNil ifTrue: [^ nil].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   566
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   567
    source = LastSource ifTrue:[
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   568
        tree := LastParseTree.
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   569
    ] ifFalse:[
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   570
        tree := RBParser
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   571
                parseMethod:source
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   572
                onError: [:str :err :nodesSoFar |
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   573
                                |nodes|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   574
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   575
                                allowErrors ifTrue:[
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   576
                                    firstIntersectingNode notNil ifTrue:[^ firstIntersectingNode].
3586
f02d54641334 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3585
diff changeset
   577
                                    nodes := nodesSoFar asOrderedCollection
3306
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   578
                                                collect:[:nd | nd whichNodeIntersects:interval]
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   579
                                                thenSelect:[:nd | nd notNil ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   580
                                    nodes size == 1 ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   581
                                        ^ nodes first
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   582
                                    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   583
                                ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   584
                                ^ nil]
3720
f37c0d1757e3 use new rbparser callback-as-nodes-are-generated to find a node
Claus Gittinger <cg@exept.de>
parents: 3718
diff changeset
   585
                rememberNodes:true
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   586
                nodeGenerationCallback:[:node |
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   587
                    "/ we would like to return here as soon as the node has been created by the parser;
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   588
                    "/ however, at that time, its parent(chain) is not yet created and so we might not know
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   589
                    "/ what the semantic intepretation (especially: scope of variable) will be.
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   590
                    "/ therefore, we parse all, and return the found node at the end.
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   591
                    "//// ^ node.
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   592
                    firstIntersectingNode isNil ifTrue:[
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   593
                        (node intersectsInterval:interval) ifTrue:[
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   594
                            firstIntersectingNode := node
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   595
                        ].
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   596
                    ].
3895
79124f2311a1 comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3876
diff changeset
   597
                ].   
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   598
"/                onError: [:str :err | errCount := (errCount?0) + 1. self halt.]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   599
"/                proceedAfterError:true.
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   600
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   601
        tree notNil ifTrue:[
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   602
            LastSource := source.
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   603
            LastParseTree := tree.
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   604
        ].
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
   605
        ^ firstIntersectingNode
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   606
    ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   607
3306
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   608
    ^ self findNodeForInterval:interval inParseTree:tree.
3896
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   609
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   610
    "Modified: / 27-04-2010 / 17:59:17 / cg"
3306
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   611
!
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   612
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   613
findNodeForInterval:interval inParseTree:parseTree
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   614
    |node|
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   615
3306
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   616
    interval isEmpty ifTrue: [^ nil].
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   617
    parseTree isNil ifTrue:[^ nil].
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   618
40e860fd2f02 argument-name completion in a methods selector pattern
Claus Gittinger <cg@exept.de>
parents: 3303
diff changeset
   619
    node := parseTree whichNodeIsContainedBy:interval.
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   620
    node isNil ifTrue:[
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   621
        node := parseTree whichNodeIntersects:interval.
3680
1e79e8081859 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   622
        node isNil ifTrue: [
1e79e8081859 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   623
            node := self findNodeIn:parseTree forInterval:interval
1e79e8081859 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3667
diff changeset
   624
        ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   625
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   626
    ^ node
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   627
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   628
    "Modified: / 10-11-2006 / 13:13:58 / cg"
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   629
!
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   630
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   631
findNodeIn:tree forInterval:interval
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   632
    |nodeFound wouldReturn|
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   633
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   634
    nodeFound := nil.
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   635
    tree nodesDo:[:eachNode |
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   636
        (eachNode intersectsInterval:interval) ifTrue:[
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   637
            (nodeFound isNil or:[nodeFound == eachNode parent]) ifTrue:[
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   638
                nodeFound := eachNode
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   639
            ] ifFalse:[
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   640
                (nodeFound parent == eachNode parent
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   641
                and:[ eachNode start >= nodeFound start
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   642
                      and:[ eachNode stop <= nodeFound stop ] ]) ifTrue:[
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   643
                ] ifFalse:[
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   644
                    (nodeFound parent notNil
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   645
                    and:[nodeFound parent isCascade and:[eachNode parent isCascade]]) ifFalse:[^ nil]
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   646
                ]
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   647
            ]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   648
        ] ifFalse:[
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   649
            nodeFound notNil ifTrue:[
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   650
                "/ already found one - beyond that one; leave
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   651
                wouldReturn notNil ifTrue:[wouldReturn := nodeFound].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   652
            ]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   653
        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   654
    ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   655
"/ (wouldReturn notNil and:[wouldReturn ~~ node]) ifTrue:[self halt].
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   656
    ^ nodeFound
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   657
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   658
    "Modified: / 20-11-2006 / 12:31:12 / cg"
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   659
!
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   660
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   661
lookupClassForMessage:node inClass:classProvidingNamespace
3681
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   662
    |receiver nm nodeVal receiverClass|
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   663
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   664
    receiver := node receiver.
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   665
    receiver isVariable ifTrue:[
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   666
        nm := receiver name.
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   667
        nm = 'self' ifTrue:[
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   668
            ^ classProvidingNamespace
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   669
        ].
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   670
        nm = 'super' ifTrue:[
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   671
            ^ classProvidingNamespace superclass
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   672
        ].
3734
0e36383745e0 impreved node finding
Claus Gittinger <cg@exept.de>
parents: 3731
diff changeset
   673
        nm isUppercaseFirst ifTrue:[
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   674
            "/ wouldn't it be better to simply 'evaluate' the variable ?
3929
bf3f10bb97c7 changed: #lookupClassForMessage:inClass:
sr
parents: 3905
diff changeset
   675
            Error handle:[:ex |
bf3f10bb97c7 changed: #lookupClassForMessage:inClass:
sr
parents: 3905
diff changeset
   676
            ] do:[
bf3f10bb97c7 changed: #lookupClassForMessage:inClass:
sr
parents: 3905
diff changeset
   677
                nodeVal := Parser new evaluate:nm in:nil receiver:(classProvidingNamespace basicNew).
bf3f10bb97c7 changed: #lookupClassForMessage:inClass:
sr
parents: 3905
diff changeset
   678
            ].
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   679
"/            (Smalltalk includesKey:nm asSymbol) ifTrue:[
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   680
"/                nodeVal := Smalltalk at:nm asSymbol.
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   681
"/            ].
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   682
            nodeVal notNil ifTrue:[
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   683
                ^ nodeVal class
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   684
            ]
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   685
        ]
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   686
    ].
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   687
    receiver isLiteral ifTrue:[
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   688
        ^ receiver value class
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   689
    ].
3681
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   690
    receiver isMessage ifTrue:[
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   691
        (receiver selector = 'new'
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   692
        or:[ receiver selector = 'new:' ]) ifTrue:[
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   693
            receiverClass := self lookupClassForMessage:receiver inClass:classProvidingNamespace.
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   694
            receiverClass notNil ifTrue:[
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   695
                receiverClass isBehavior ifTrue:[
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   696
                    receiverClass isMeta ifTrue:[
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   697
                        ^ receiverClass theNonMetaclass
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   698
                    ]
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   699
                ]
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   700
            ].
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   701
        ].
6dca6308d156 better selector completion for (class new) receivers
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
   702
    ].
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   703
    ^ nil
3929
bf3f10bb97c7 changed: #lookupClassForMessage:inClass:
sr
parents: 3905
diff changeset
   704
bf3f10bb97c7 changed: #lookupClassForMessage:inClass:
sr
parents: 3905
diff changeset
   705
    "Modified: / 24-08-2010 / 15:05:49 / sr"
3356
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   706
!
b1e3ccd1bcf2 better messageSelector completion
Claus Gittinger <cg@exept.de>
parents: 3331
diff changeset
   707
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   708
treeForCode:source allowErrors:allowErrors
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   709
    |tree|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   710
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   711
    source = LastSource ifTrue:[
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   712
        tree := LastParseTree.
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   713
    ] ifFalse:[
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   714
        tree := RBParser
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   715
                parseMethod:source
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   716
                onError: [:str :err :nodesSoFar :parser|
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   717
                        allowErrors ifTrue:[
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   718
                            ^ parser currentMethodNode
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   719
                        ].
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   720
                        ^ nil
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   721
                    ]
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   722
                proceedAfterError:false
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   723
                rememberNodes:true.
3896
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   724
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   725
        tree notNil ifTrue:[
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   726
            LastSource := source.
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   727
            LastParseTree := tree.
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   728
        ]
3475
8ed28a1e4e37 cache last parse tree (for flyByHelp)
Claus Gittinger <cg@exept.de>
parents: 3470
diff changeset
   729
    ].
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
   730
    ^ tree
3896
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   731
9a5437a71fdb comment/format in: #findNodeForInterval:in:allowErrors:
Claus Gittinger <cg@exept.de>
parents: 3895
diff changeset
   732
    "Modified: / 27-04-2010 / 17:57:37 / cg"
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
! !
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   735
!DoWhatIMeanSupport class methodsFor:'input completion support'!
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   736
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   737
classCategoryCompletion:aPartialCategory inEnvironment:anEnvironment
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   738
    "given a partial class category name, return an array consisting of
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   739
     2 entries: 1st: the best (longest) match
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   740
                2nd: collection consisting of matching categories"
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   741
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   742
    |matches best lcName|
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   743
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   744
    matches := IdentitySet new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   745
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   746
    "/ search for exact match
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   747
    anEnvironment allClassesDo:[:aClass |
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   748
        |category|
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   749
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   750
        category := aClass category.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   751
        (category notNil and:[category startsWith:aPartialCategory]) ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   752
            matches add:category
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   753
        ]
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   754
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   755
    matches isEmpty ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   756
        "/ search for case-ignoring match
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   757
        lcName := aPartialCategory asLowercase.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   758
        anEnvironment allClassesDo:[:aClass |
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   759
            |category|
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   760
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   761
            category := aClass category.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   762
            (category notNil and:[category asLowercase startsWith:lcName]) ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   763
                matches add:category
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   764
            ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   765
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   766
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   767
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   768
    matches isEmpty ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   769
        ^ Array with:aPartialCategory with:(Array with:aPartialCategory)
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   770
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   771
    matches size == 1 ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   772
        ^ Array with:matches first with:(matches asArray)
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   773
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   774
    matches := matches asSortedCollection.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   775
    best := matches longestCommonPrefix.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   776
    ^ Array with:best with:matches asArray
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   777
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   778
    "
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   779
     Smalltalk classCategoryCompletion:'Sys'    
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   780
     Smalltalk classCategoryCompletion:'System'              
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   781
     Smalltalk classCategoryCompletion:'System-BinaryStorage' 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   782
    "
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   783
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   784
    "Created: / 10-08-2006 / 13:06:45 / cg"
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   785
!
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   786
2830
dbf8a7499ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
   787
classNameEntryCompletionBlock
dbf8a7499ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
   788
    "this block can be used in a dialog to perform className completion"
dbf8a7499ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
   789
2977
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
   790
    ^ self entryCompletionBlockFor:#'classnameCompletion:inEnvironment:'
2830
dbf8a7499ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
   791
2977
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
   792
    "Modified: / 10-08-2006 / 13:22:02 / cg"
2830
dbf8a7499ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
   793
!
dbf8a7499ebc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2774
diff changeset
   794
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   795
classnameCompletion:aPartialClassName filter:filterBlock inEnvironment:anEnvironment
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   796
    "given a partial classname, return an array consisting of
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   797
     2 entries: 1st: the best (longest) match
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   798
                2nd: collection consisting of matching names"
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   799
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   800
    |searchName matches matchedNamesWithoutPrefix ignCaseMatches best isMatchString cls nsPrefix 
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   801
     others lcSearchName tryToMatch idx words w1 w2 rslt bestMatch matchesForLongestPrefix|
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   802
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   803
    aPartialClassName isEmpty ifTrue:[
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   804
        matches := Smalltalk allClassesForWhich:filterBlock.
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   805
        ^ InputCompletionResult bestName:aPartialClassName matchingNames:#()
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   806
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   807
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   808
    (words := aPartialClassName asCollectionOfWords) size > 1 ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   809
        w1 := words first.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   810
        w2 := words second.
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   811
        rslt := self classnameCompletion:w1 filter:filterBlock inEnvironment:anEnvironment.
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   812
        bestMatch := rslt first.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   813
        matches := rslt second.
3549
c7c19ab7e225 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3547
diff changeset
   814
        ('class' copyTo:(w2 size min:5)) = w2 ifTrue:[
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   815
            matches := matches collect:[:m | m , ' class'].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   816
            bestMatch := bestMatch , ' class'.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   817
        ].
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   818
        ^ InputCompletionResult bestName:bestMatch matchingNames:matches
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   819
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   820
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   821
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   822
    (aPartialClassName startsWith:'Smalltalk::') ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   823
        nsPrefix := 'Smalltalk::'.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   824
        searchName := aPartialClassName copyFrom:'Smalltalk::' size + 1
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   825
    ] ifFalse:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   826
        nsPrefix := ''.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   827
        searchName := aPartialClassName.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   828
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   829
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   830
    searchName := searchName asUppercaseFirst.
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   831
    lcSearchName := searchName asLowercase.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   832
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   833
    isMatchString := searchName includesMatchCharacters.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   834
    matches := OrderedCollection new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   835
    matchedNamesWithoutPrefix := Set new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   836
    ignCaseMatches := OrderedCollection new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   837
    others := OrderedCollection new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   838
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   839
    tryToMatch := 
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   840
        [:className :fullClassName|
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   841
            |addIt|
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   842
"/ (className startsWith:'JavaScript') ifTrue:[self halt].
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   843
            isMatchString ifTrue:[
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   844
                addIt := searchName match:className
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   845
            ] ifFalse:[
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   846
                addIt := className startsWith:searchName.
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   847
            ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   848
            addIt ifTrue:[
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   849
                matches add:(nsPrefix , fullClassName).
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   850
                matchedNamesWithoutPrefix add:className.
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   851
            ] ifFalse:[
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   852
                "/ try ignoring case
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   853
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   854
                isMatchString ifTrue:[
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   855
                    addIt := searchName match:className ignoreCase:true
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   856
                ] ifFalse:[
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   857
                    addIt := className asLowercase startsWith:lcSearchName.
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   858
                    addIt ifFalse:[
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   859
                        others add:className 
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   860
                    ]
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   861
                ].
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   862
                addIt ifTrue:[
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   863
                    ignCaseMatches add:(nsPrefix , fullClassName).
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   864
                    matchedNamesWithoutPrefix add:className.
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   865
                ].
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   866
            ].
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   867
            addIt
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   868
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   869
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   870
    anEnvironment allClassesForWhich:filterBlock do:[:aClass |
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   871
        |addIt fullClassName classNameWithoutPrefix|
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   872
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   873
        aClass isMeta ifFalse:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   874
            fullClassName := aClass name.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   875
            classNameWithoutPrefix := aClass nameWithoutPrefix.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   876
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   877
            addIt := tryToMatch value:fullClassName value:fullClassName.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   878
            addIt ifFalse:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   879
                classNameWithoutPrefix ~~ fullClassName ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   880
                    tryToMatch value:classNameWithoutPrefix value:fullClassName.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   881
                ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   882
            ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   883
        ]
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   884
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   885
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   886
"/    matches isEmpty ifTrue:[
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   887
"/        matches := ignCaseMatches.
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   888
"/    ].
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   889
    matches := matches , ignCaseMatches.
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   890
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   891
"/    matches isEmpty ifTrue:[
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   892
"/        matches := ignCaseMatches.
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   893
"/
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   894
"/"/    matches isEmpty ifTrue:[
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   895
"/"/        | nearBy |
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   896
"/"/        nearBy := SortedCollection new sortBlock:[:a :b | a key < b key].
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   897
"/"/        others do:[:className |
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   898
"/"/            |lcClassName dist cmpName|
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   899
"/"/
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   900
"/"/            lcClassName := className asLowercase.
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   901
"/"/            dist := lcClassName levenshteinTo:lcSearchName s:9 k:1 c:0 i:9 d:2.
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   902
"/"/
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   903
"/"/            cmpName := lcClassName copyTo:(lcSearchName size min:lcClassName size).
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   904
"/"/            dist := dist min:(cmpName levenshteinTo:lcSearchName s:9 k:1 c:0 i:9 d:2).
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   905
"/"/            cmpName := lcClassName copyTo:(lcSearchName size + 1 min:lcClassName size).
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   906
"/"/            dist := dist min:(cmpName levenshteinTo:lcSearchName s:9 k:1 c:0 i:9 d:2).
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   907
"/"/            dist < 4 ifTrue:[
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   908
"/"/                nearBy add:( dist -> (nsPrefix , className) ).
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   909
"/"/            ]
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   910
"/"/        ].
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   911
"/"/        matches := nearBy collect:[:eachPair | eachPair value].
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   912
"/"/    ].
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   913
"/    ].
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   914
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   915
    matches isEmpty ifTrue:[
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   916
        ^ InputCompletionResult bestName:searchName matchingNames:(Array with:searchName)
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   917
    ].                           
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   918
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   919
    matches size == 1 ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   920
        best := matches first.
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   921
        ^ InputCompletionResult bestName:best matchingNames:(matches asArray)
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   922
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   923
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   924
    matches 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   925
        sort:[:name1 :name2 |
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   926
            "name1 comes before:name2 iff"
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   927
            ((name2 includes:$:) and:[(name1 includes:$:) not])
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   928
            or:[ ((name1 includes:$:) == (name2 includes:$:))
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   929
                  and:[ (name1 size < name2 size) 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   930
                        or: [ name1 < name2 ]]
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   931
               ]
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   932
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   933
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   934
    isMatchString ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   935
        best := searchName.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   936
    ] ifFalse:[
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   937
        matchesForLongestPrefix := matches select:[:m | m asLowercase startsWith:lcSearchName].
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   938
        best := ignCaseMatches isEmpty
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   939
                    ifTrue:[ matchesForLongestPrefix longestCommonPrefix ]
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   940
                    ifFalse:[ matchesForLongestPrefix longestCommonPrefixIgnoreCase:true ].
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
   941
3198
fea29ae859c9 classnamecompletion fixed when namespace is involved
Claus Gittinger <cg@exept.de>
parents: 3135
diff changeset
   942
        best size < aPartialClassName size "best size == 0" ifTrue:[
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   943
            best := matchedNamesWithoutPrefix longestCommonPrefix.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   944
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   945
        best size == 0 ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   946
            "if tried again, return next match"
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   947
            idx := ((matches indexOf:aPartialClassName) + 1) \\ matches size.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   948
            idx ~~ 1 ifTrue:[
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   949
                ^ InputCompletionResult bestName:(matches at:idx) matchingNames:(matches asArray)
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   950
            ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   951
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   952
        best size < aPartialClassName size ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   953
            best := aPartialClassName.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   954
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   955
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   956
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   957
    cls := anEnvironment classNamed:best.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   958
    (cls isBehavior and:[cls isNameSpace]) ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   959
        (matches conform:[:each | each = best
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   960
                                 or:[each startsWith:(best , '::')]])
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   961
        ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   962
            best := best , '::'
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   963
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   964
    ].
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   965
    ^ InputCompletionResult bestName:best matchingNames:matches asArray
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   966
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   967
    "
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   968
     Smalltalk classnameCompletion:'Arr'    
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   969
     Smalltalk classnameCompletion:'Arra' 
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
   970
     Smalltalk classnameCompletion:'arra'  
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   971
     Smalltalk classnameCompletion:'*rray' 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   972
    "
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   973
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   974
    "Created: / 10-08-2006 / 13:01:08 / cg"
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   975
!
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
   976
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   977
classnameCompletion:aPartialClassName inEnvironment:anEnvironment
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   978
    "given a partial classname, return an array consisting of
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   979
     2 entries: 1st: the best (longest) match
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   980
                2nd: collection consisting of matching names"
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   981
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   982
    ^ self
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   983
        classnameCompletion:aPartialClassName 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   984
        filter:[:cls | true] 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   985
        inEnvironment:anEnvironment
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   986
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   987
    "
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   988
     Smalltalk classnameCompletion:'Arr' 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   989
     Smalltalk classnameCompletion:'Arra' 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   990
     Smalltalk classnameCompletion:'arra' 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   991
     Smalltalk classnameCompletion:'*rray' 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   992
    "
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   993
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   994
    "Created: / 24-11-1995 / 17:24:45 / cg"
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   995
    "Modified: / 10-08-2006 / 13:01:30 / cg"
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   996
!
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
   997
2977
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
   998
entryCompletionBlockFor:completionSelector
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
   999
    "this block can be used in a dialog to perform className completion"
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1000
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1001
    ^ [:contents :field  |
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1002
          |s what m|
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1003
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1004
          s := contents withoutSpaces.
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1005
          field topView withCursor:(Cursor questionMark) do:[  
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1006
              what := self perform:completionSelector with:s with:Smalltalk.
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1007
          ].
3876
6e63fce83590 fixed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3867
diff changeset
  1008
2977
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1009
          field contents:(what first).
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1010
          (what at:2) size ~~ 1 ifTrue:[
3693
9d0059e1374b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3681
diff changeset
  1011
              UserPreferences current beepInEditor ifTrue:[                
9d0059e1374b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3681
diff changeset
  1012
                field device beep
9d0059e1374b beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3681
diff changeset
  1013
              ]
2977
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1014
          ]
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1015
      ].
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1016
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1017
    "Created: / 10-08-2006 / 13:21:37 / cg"
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1018
!
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1019
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1020
globalNameCompletion:aPartialGlobalName inEnvironment:anEnvironment
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1021
    "given a partial globalName, return an array consisting of
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1022
     2 entries: 1st: the best (longest) match
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1023
                2nd: collection consisting of matching names"
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1024
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1025
    ^ self globalNameCompletion:aPartialGlobalName inEnvironment:anEnvironment match:true
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1026
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1027
    "
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1028
     Smalltalk globalnameCompletion:'Arr' 
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1029
     Smalltalk globalnameCompletion:'Arra' 
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1030
     Smalltalk globalnameCompletion:'arra' 
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1031
     Smalltalk globalnameCompletion:'*rray' 
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1032
    "
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1033
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1034
    "Created: / 10-08-2006 / 13:06:23 / cg"
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1035
!
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1036
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1037
globalNameCompletion:aPartialGlobalName inEnvironment:anEnvironment match:doMatch
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1038
    "given a partial globalName, return an array consisting of
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1039
     2 entries: 1st: the best (longest) match
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1040
                2nd: collection consisting of matching names"
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1041
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1042
    |searchName matches ignCaseMatches best isMatchString|
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1043
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1044
    searchName := aPartialGlobalName.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1045
    searchName isEmpty ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1046
        ^ Array with:searchName with:#()
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1047
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1048
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1049
    (searchName at:1) isLowercase ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1050
        searchName := searchName copy asUppercaseFirst
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1051
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1052
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1053
    isMatchString := doMatch and:[ searchName includesMatchCharacters ].
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1054
    matches := OrderedCollection new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1055
    ignCaseMatches := OrderedCollection new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1056
    anEnvironment keysDo:[:aGlobalName |
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1057
        | addIt|
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1058
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1059
        isMatchString ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1060
            addIt := searchName match:aGlobalName
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1061
        ] ifFalse:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1062
            addIt := aGlobalName startsWith:searchName
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1063
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1064
        addIt ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1065
            matches add:aGlobalName
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1066
        ] ifFalse:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1067
            "/ try ignoring case
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1068
            isMatchString ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1069
                addIt := searchName match:aGlobalName ignoreCase:true
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1070
            ] ifFalse:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1071
                addIt := aGlobalName asLowercase startsWith:searchName asLowercase
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1072
            ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1073
            addIt ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1074
                ignCaseMatches add:aGlobalName
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1075
            ]
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1076
        ]
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1077
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1078
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1079
    matches isEmpty ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1080
        matches := ignCaseMatches
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1081
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1082
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1083
    matches isEmpty ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1084
        ^ Array with:searchName with:(Array with:searchName)
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1085
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1086
    matches size == 1 ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1087
        ^ Array with:matches first with:(matches asArray)
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1088
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1089
    matches := matches asSortedCollection.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1090
    isMatchString ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1091
        best := searchName.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1092
    ] ifFalse:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1093
        best := matches longestCommonPrefix.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1094
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1095
    ^ Array with:best with:matches asArray
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1096
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1097
    "
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1098
     Smalltalk globalnameCompletion:'Arr' 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1099
     Smalltalk globalnameCompletion:'Arra' 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1100
     Smalltalk globalnameCompletion:'arra' 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1101
     Smalltalk globalnameCompletion:'*rray' 
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1102
    "
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1103
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1104
    "Created: / 10-08-2006 / 13:06:23 / cg"
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1105
!
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1106
2975
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1107
nameSpaceCompletion:aPartialClassName inEnvironment:anEnvironment
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1108
    "given a partial name, return an array consisting of
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1109
     2 entries: 1st: the best (longest) match
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1110
                2nd: collection consisting of matching names"
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1111
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1112
    ^ self
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1113
        classnameCompletion:aPartialClassName 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1114
        filter:[:cls | cls isNameSpace] 
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1115
        inEnvironment:anEnvironment
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1116
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1117
    "
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1118
     DoWhatIMeanSupport nameSpaceCompletion:'To'  inEnvironment:Smalltalk  
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1119
    "
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1120
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1121
    "Created: / 10-08-2006 / 13:02:16 / cg"
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1122
!
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1123
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1124
packageCompletion:aPartialPackage inEnvironment:anEnvironment
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1125
    "given a partial package name, return an array consisting of
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1126
     2 entries: 1st: the best (longest) match
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1127
                2nd: collection consisting of matching packages"
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1128
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1129
    |matches best lcName|
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1130
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1131
    matches := IdentitySet new.
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1132
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1133
    "/ search for exact match
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1134
    anEnvironment allClassesDo:[:aClass |
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1135
        |package|
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1136
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1137
        package := aClass package.
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1138
        (package notNil and:[package startsWith:aPartialPackage]) ifTrue:[
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1139
            matches add:package
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1140
        ]
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1141
    ].
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1142
    matches isEmpty ifTrue:[
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1143
        "/ search for case-ignoring match
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1144
        lcName := aPartialPackage asLowercase.
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1145
        anEnvironment allClassesDo:[:aClass |
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1146
            |package|
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1147
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1148
            package := aClass package.
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1149
            (package notNil and:[package asLowercase startsWith:lcName]) ifTrue:[
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1150
                matches add:package
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1151
            ].
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1152
        ].
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1153
    ].
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1154
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1155
    matches isEmpty ifTrue:[
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1156
        ^ Array with:aPartialPackage with:(Array with:aPartialPackage)
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1157
    ].
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1158
    matches size == 1 ifTrue:[
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1159
        ^ Array with:matches first with:(matches asArray)
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1160
    ].
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1161
    matches := matches asSortedCollection.
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1162
    best := matches longestCommonPrefix.
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1163
    ^ Array with:best with:matches asArray
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1164
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1165
    "
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1166
     DoWhatIMeanSupport packageCompletion:'stx:' inEnvironment:Smalltalk   
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1167
     DoWhatIMeanSupport packageCompletion:'stx:libw' inEnvironment:Smalltalk                
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1168
    "
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1169
300462273a16 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2830
diff changeset
  1170
    "Created: / 10-08-2006 / 13:05:07 / cg"
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1171
!
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1172
2977
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1173
packageNameEntryCompletionBlock
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1174
    "this block can be used in a dialog to perform className completion"
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1175
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1176
    ^ self entryCompletionBlockFor:#'packageCompletion:inEnvironment:'
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1177
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1178
    "Created: / 10-08-2006 / 13:22:31 / cg"
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1179
!
3e4b5adccfd6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2975
diff changeset
  1180
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1181
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1182
    "given a partial selector, return an array consisting of
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1183
     2 entries: 1st: the longest match
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1184
                2nd: collection consisting of matching implemented selectors"
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1185
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1186
    ^ self selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment match:false
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1187
!
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1188
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1189
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment match:doMatch
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1190
    "given a partial selector, return an array consisting of
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1191
     2 entries: 1st: the longest match
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1192
                2nd: collection consisting of matching implemented selectors"
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1193
3955
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1194
    ^ self 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1195
        selectorCompletion:aPartialSymbolName 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1196
        inEnvironment:anEnvironment 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1197
        match:doMatch 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1198
        ignoreCase:false
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1199
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1200
    "
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1201
     DoWhatIMeanSupport selectorCompletion:'inst*p' inEnvironment:Smalltalk match:true 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1202
     DoWhatIMeanSupport selectorCompletion:'inst*pl' inEnvironment:Smalltalk match:true 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1203
     DoWhatIMeanSupport selectorCompletion:'at:p' inEnvironment:Smalltalk match:true 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1204
     DoWhatIMeanSupport selectorCompletion:'nextP' inEnvironment:Smalltalk match:true
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1205
     DoWhatIMeanSupport selectorCompletion:'nextp' inEnvironment:Smalltalk match:true
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1206
    "
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1207
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1208
    "Modified: / 07-06-1996 / 08:44:33 / stefan"
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1209
    "Modified: / 26-10-2010 / 20:30:27 / cg"
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1210
!
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1211
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1212
selectorCompletion:aPartialSymbolName inEnvironment:anEnvironment match:doMatch ignoreCase:ignoreCase
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1213
    "given a partial selector, return an array consisting of
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1214
     2 entries: 1st: the longest match
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1215
                2nd: collection consisting of matching implemented selectors"
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1216
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1217
    |matches best lcSym isMatch|
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1218
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1219
    matches := IdentitySet new.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1220
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1221
    isMatch := doMatch and:[aPartialSymbolName includesMatchCharacters].
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1222
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
  1223
    anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1224
        (isMatch 
3955
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1225
            ifTrue:[ (aPartialSymbolName match:eachSelector ignoreCase:ignoreCase) ]
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1226
            ifFalse:[ ignoreCase 
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1227
                        ifTrue:[ (eachSelector asLowercase startsWith:aPartialSymbolName asLowercase) ]  
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1228
                        ifFalse:[ (eachSelector startsWith:aPartialSymbolName) ] ])
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1229
         ifTrue:[
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
  1230
            matches add:eachSelector
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1231
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1232
    ].
3955
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1233
    (matches isEmpty and:[ignoreCase not]) ifTrue:[
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1234
        "/ search for case-ignoring match
3867
03f7ad841731 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3864
diff changeset
  1235
        lcSym := aPartialSymbolName asLowercase.
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
  1236
        anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1237
            (isMatch 
3867
03f7ad841731 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3864
diff changeset
  1238
                ifTrue:[ (aPartialSymbolName match:eachSelector ignoreCase:true) ]
3863
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1239
                ifFalse:[ (eachSelector asLowercase startsWith:lcSym) ])
Claus Gittinger <cg@exept.de>
parents: 3854
diff changeset
  1240
             ifTrue:[
3751
eafbe64ab0fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3734
diff changeset
  1241
                matches add:eachSelector
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1242
            ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1243
        ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1244
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1245
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1246
    matches isEmpty ifTrue:[
3864
10c7db09a580 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3863
diff changeset
  1247
        ^ Array with:aPartialSymbolName with:#() "/ (Array with:aPartialSymbolName)
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1248
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1249
    matches size == 1 ifTrue:[
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1250
        ^ Array with:matches first with:(matches asArray)
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1251
    ].
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1252
    matches := matches asSortedCollection.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1253
    best := matches longestCommonPrefix.
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1254
    ^ Array with:best with:matches asArray
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1255
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1256
    "
3867
03f7ad841731 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3864
diff changeset
  1257
     DoWhatIMeanSupport selectorCompletion:'inst*p' inEnvironment:Smalltalk match:true 
03f7ad841731 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3864
diff changeset
  1258
     DoWhatIMeanSupport selectorCompletion:'inst*pl' inEnvironment:Smalltalk match:true 
03f7ad841731 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3864
diff changeset
  1259
     DoWhatIMeanSupport selectorCompletion:'at:p' inEnvironment:Smalltalk match:true 
03f7ad841731 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3864
diff changeset
  1260
     DoWhatIMeanSupport selectorCompletion:'nextP' inEnvironment:Smalltalk match:true
03f7ad841731 changed: #selectorCompletion:inEnvironment:match:
Claus Gittinger <cg@exept.de>
parents: 3864
diff changeset
  1261
     DoWhatIMeanSupport selectorCompletion:'nextp' inEnvironment:Smalltalk match:true
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1262
    "
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1263
3955
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1264
    "Modified: / 07-06-1996 / 08:44:33 / stefan"
94fb4a47d108 added: #selectorCompletion:inEnvironment:match:ignoreCase:
Claus Gittinger <cg@exept.de>
parents: 3929
diff changeset
  1265
    "Created: / 26-10-2010 / 20:30:06 / cg"
2661
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1266
! !
f68913f2facf moved all input completion methods from Smalltalk to here.
Claus Gittinger <cg@exept.de>
parents: 2560
diff changeset
  1267
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
!DoWhatIMeanSupport class methodsFor:'rename support'!
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
goodRenameDefaultFor:oldName lastOld:lastOldName lastNew:lastNewName
2513
de7a2f5335c2 comments
Claus Gittinger <cg@exept.de>
parents: 2468
diff changeset
  1271
    "generate a reasonable default for a rename operation.
de7a2f5335c2 comments
Claus Gittinger <cg@exept.de>
parents: 2468
diff changeset
  1272
     (used for rename category etc.)"
2468
beeedb5f57f4 comment
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
  1273
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1274
    |prefix suffix lastNewSize lastOldSize left right inserted deleted|
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1275
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1276
    lastNewName isNil ifTrue:[ ^ nil].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1277
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1278
    lastNewSize := lastNewName size.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1279
    lastOldSize := lastOldName size.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1280
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1281
    (lastNewName endsWith:lastOldName) ifTrue:[
2514
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1282
        "last rename was 
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1283
            'foo' -> 'Xfoo'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1284
         then, a good default for
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1285
            'bar' would be 'Xbar'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1286
        "
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
        prefix := lastNewName copyTo:(lastNewSize - lastOldSize).
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
        ^ (prefix , oldName).
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
    ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
    (lastOldName endsWith:lastNewName) ifTrue:[
2514
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1291
        "last rename was 
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1292
            'Xfoo' -> 'foo'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1293
         then, a good default for
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1294
            'Xbar' would be 'bar'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1295
        "
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
        prefix := lastOldName copyTo:(lastOldSize - lastNewSize).
2514
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1297
        (oldName startsWith:prefix) ifTrue:[
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1298
            ^ (oldName copyFrom:prefix size+1).
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1299
        ]
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1300
    ].
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1301
    (lastOldName asLowercase = lastNewName asLowercase) ifTrue:[
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1302
        (lastOldName first ~= lastNewName first) ifTrue:[
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1303
            (lastOldName first isLowercase = oldName first isLowercase) ifTrue:[
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1304
                "last rename was 
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1305
                    'xfoo' -> 'Xfoo'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1306
                 then, a good default for
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1307
                    'xbar' would be 'Xbar'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1308
                "
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1309
                lastOldName first isLowercase ifTrue:[
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1310
                    ^ oldName first asUppercase asString , (oldName copyFrom:2).
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1311
                ] ifFalse:[
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1312
                    ^ oldName first asLowercase asString , (oldName copyFrom:2).
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1313
                ]
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1314
            ]
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1315
        ].
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1316
    ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1317
    (lastOldName withoutSeparators = lastNewName) ifTrue:[
2514
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1318
        "last rename was 
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1319
            '  foo   ' -> 'foo'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1320
         then, a good default for
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1321
            '  bar   ' would be 'bar'
4f8d8658289a comments
Claus Gittinger <cg@exept.de>
parents: 2513
diff changeset
  1322
        "
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1323
        ^ oldName withoutSeparators.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1324
    ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1325
    (lastNewName startsWith:lastOldName) ifTrue:[
2557
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1326
        "last rename was 
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1327
            'foo' -> 'fooX'
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1328
         then, a good default for
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1329
            'bar' would be 'barX'
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1330
        "
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1331
        suffix := lastNewName copyLast:(lastNewSize - lastOldSize).
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1332
        ^ (oldName , suffix).
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1333
    ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1334
    (lastOldName startsWith:lastNewName) ifTrue:[
2557
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1335
        "last rename was 
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1336
            'fooX' -> 'foo'
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1337
         then, a good default for
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1338
            'barX' would be 'bar'
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1339
        "
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
        suffix := lastOldName copyLast:(lastOldSize - lastNewSize).
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1341
        (oldName endsWith:suffix) ifTrue:[
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1342
            ^ (oldName copyWithoutLast:suffix size).
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1343
        ]
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1344
    ].
2558
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1345
2557
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1346
    prefix := lastOldName commonPrefixWith:lastNewName.
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1347
    suffix := lastOldName commonSuffixWith:lastNewName.
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1348
2558
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1349
    (prefix size > 0) ifTrue:[
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1350
        (suffix size > 0) ifTrue:[
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1351
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1352
            prefix := prefix copyTo:(((lastNewName size - suffix size) min:(lastOldName size - suffix size)) min:prefix size).
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1353
2558
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1354
            "last rename was 
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1355
                'fooR' -> 'fooXR'
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1356
             then, a good default for
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1357
                'barR' would be 'barXR'
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1358
            "
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1359
            left := lastOldName copyTo:prefix size.
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1360
            right := lastOldName copyLast:suffix size.
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1361
            lastNewSize > lastOldSize ifTrue:[
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1362
                inserted := (lastNewName copyFrom:(left size + 1)) copyWithoutLast:(right size).
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1363
                inserted size > 0 ifTrue:[
3532
c79c6acf377d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3475
diff changeset
  1364
                    (oldName startsWith:prefix) ifTrue:[
c79c6acf377d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3475
diff changeset
  1365
                        ^ (oldName copyTo:prefix size) , inserted , (oldName copyFrom:prefix size + 1) 
c79c6acf377d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3475
diff changeset
  1366
                    ].
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1367
                ].
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1368
            ].
3585
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1369
            (oldName string endsWith:suffix string) ifTrue:[
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1370
                deleted := (lastOldName string copyFrom:(prefix size + 1)) copyWithoutLast:(suffix size).
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1371
                (oldName size-suffix size-deleted size + 1) >= 1 ifTrue:[
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1372
                    ((oldName copyFrom:oldName size-suffix size-deleted size + 1) copyTo:deleted size) = deleted ifTrue:[
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1373
                        "last rename was 
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1374
                            'fooXR' -> 'fooR'
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1375
                         then, a good default for
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1376
                            'barXS' would be 'barS'
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1377
                        "
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1378
                        ^ (oldName copyTo:oldName size-suffix size-deleted size) , suffix
b127cf1ed41f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3557
diff changeset
  1379
                    ]
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1380
                ]
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1381
            ]
2558
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1382
        ].
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1383
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1384
        (oldName endsWith:(lastOldName copyFrom:prefix size+1)) ifTrue:[
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1385
            "last rename was 
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1386
                'fooX' -> 'fooY'
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1387
             then, a good default for
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1388
                'barX' would be 'barY'
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1389
            "
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1390
            left := oldName copyWithoutLast:(lastOldName copyFrom:prefix size+1) size.
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1391
            right := lastNewName copyFrom:prefix size+1.
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1392
            ^ left , right
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1393
        ] 
2557
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1394
    ].
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1395
2382
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1396
    ^ nil
2557
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1397
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1398
    "
2558
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1399
     self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'fooXX'
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1400
     self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'XXfoo'
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1401
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1402
     self goodRenameDefaultFor:'barXX' lastOld:'fooXX' lastNew:'foo' 
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1403
     self goodRenameDefaultFor:'XXbar' lastOld:'XXfoo' lastNew:'foo'
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1404
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1405
     self goodRenameDefaultFor:'barXX' lastOld:'fooXX' lastNew:'fooYY' 
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1406
     self goodRenameDefaultFor:'XXbar' lastOld:'XXfoo' lastNew:'foo'  
81ef3253fd23 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2557
diff changeset
  1407
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1408
     self goodRenameDefaultFor:'bar2' lastOld:'foo1' lastNew:'foo01'  
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1409
     self goodRenameDefaultFor:'barXY' lastOld:'fooXY' lastNew:'fooY'
2560
cc5ba9cf02b8 insertion
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
  1410
     self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'fXoo'            
cc5ba9cf02b8 insertion
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
  1411
     self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'fXXXoo'          
2559
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1412
     self goodRenameDefaultFor:'bar' lastOld:'foo' lastNew:'foXXXo'  
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1413
f9f489baf23f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1414
     self goodRenameDefaultFor:'bar001' lastOld:'foo001' lastNew:'foo002_001'  
2560
cc5ba9cf02b8 insertion
Claus Gittinger <cg@exept.de>
parents: 2559
diff changeset
  1415
     self goodRenameDefaultFor:'CoastCore-CSFoo' lastOld:'CoastCore-CSBar' lastNew:'Coast-Core-CSBar'  
2557
b1d8a61319d9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2553
diff changeset
  1416
    "
2382
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1417
!
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1418
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1419
goodRenameDefaultForFile:oldName lastOld:lastOldName lastNew:lastNewName
2513
de7a2f5335c2 comments
Claus Gittinger <cg@exept.de>
parents: 2468
diff changeset
  1420
    "generate a reasonable default for a file rename operation.
de7a2f5335c2 comments
Claus Gittinger <cg@exept.de>
parents: 2468
diff changeset
  1421
     (Try to rename multiple files in the new fileBrowser, 
de7a2f5335c2 comments
Claus Gittinger <cg@exept.de>
parents: 2468
diff changeset
  1422
     to see what this is doing)"
2468
beeedb5f57f4 comment
Claus Gittinger <cg@exept.de>
parents: 2434
diff changeset
  1423
2382
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1424
    |prefix suffix t
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1425
     lastOldWOSuffix lastNewWOSuffix oldWOSuffix lastOldRest oldRest lastNewRest
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1426
     lastRemoved lastInserted default|
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1427
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1428
    default := self goodRenameDefaultFor:oldName lastOld:lastOldName lastNew:lastNewName.
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1429
    default notNil ifTrue:[ ^ default].
d89d86edaae4 separated default for arbitrary renames and deault for files.
Claus Gittinger <cg@exept.de>
parents: 2376
diff changeset
  1430
3135
7ad9ff29225e changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents: 2977
diff changeset
  1431
    lastOldWOSuffix := lastOldName asFilename nameWithoutSuffix.
7ad9ff29225e changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents: 2977
diff changeset
  1432
    lastNewWOSuffix := lastNewName asFilename nameWithoutSuffix.
7ad9ff29225e changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents: 2977
diff changeset
  1433
    oldWOSuffix := oldName asFilename nameWithoutSuffix.
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1434
2434
e7758915432e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
  1435
    "/ suffix change ?
e7758915432e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
  1436
    lastOldWOSuffix = lastNewWOSuffix ifTrue:[
e7758915432e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
  1437
        lastOldName asFilename suffix ~= lastNewName asFilename suffix ifTrue:[
e7758915432e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
  1438
            ^ (oldName asFilename withSuffix:(lastNewName asFilename suffix)) pathName
e7758915432e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
  1439
        ].
e7758915432e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
  1440
    ].
e7758915432e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2382
diff changeset
  1441
2553
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1442
    default := self goodRenameDefaultFor:oldWOSuffix lastOld:lastOldWOSuffix lastNew:lastNewWOSuffix.
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1443
    default notNil ifTrue:[ 
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1444
        lastOldRest := lastOldName copyFrom:lastOldWOSuffix size + 1.
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1445
        lastNewRest := lastNewName copyFrom:lastNewWOSuffix size + 1.
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1446
        oldRest := oldName copyFrom:oldWOSuffix size + 1.
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1447
        
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1448
        ^ default , lastNewRest
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1449
    ].
9925f0aca022 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2517
diff changeset
  1450
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1451
    prefix := lastOldWOSuffix commonPrefixWith:oldWOSuffix.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1452
    (lastNewWOSuffix startsWith:prefix) ifTrue:[
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1453
        lastOldRest := lastOldWOSuffix copyFrom:prefix size + 1.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1454
        lastNewRest := lastNewWOSuffix copyFrom:prefix size + 1.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1455
        oldRest := oldWOSuffix copyFrom:prefix size + 1.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1456
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1457
        (lastNewRest endsWith:lastOldRest) ifTrue:[
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1458
            t := lastNewRest copyWithoutLast:lastOldRest size.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1459
            ^ ((prefix , t , oldRest) asFilename withSuffix:oldName asFilename suffix) name
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1460
        ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1461
    ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1462
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1463
    suffix := lastOldWOSuffix commonSuffixWith:lastNewWOSuffix.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1464
    suffix size > 0 ifTrue:[
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1465
        "/ last change changed something at the beginning
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1466
        prefix := oldWOSuffix commonPrefixWith:lastOldWOSuffix.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1467
        prefix size > 0 ifTrue:[
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
            "/ this name starts with the same characters
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1469
            lastRemoved := lastOldWOSuffix copyWithoutLast:suffix size.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1470
            lastInserted := lastNewWOSuffix copyWithoutLast:suffix size.
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1471
            (lastRemoved startsWith:lastInserted) ifTrue:[
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1472
                oldWOSuffix size >= lastInserted size ifTrue:[
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1473
                    ^ (oldWOSuffix copyTo:lastInserted size) , (oldName copyFrom:lastRemoved size + 1)
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1474
                ]
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1475
            ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
            ^ lastInserted , (oldName copyFrom:lastRemoved size + 1)
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
        ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1478
    ].
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1479
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1480
    ^ nil
3135
7ad9ff29225e changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents: 2977
diff changeset
  1481
7ad9ff29225e changed #classCategoryLoadFromRepository
Claus Gittinger <cg@exept.de>
parents: 2977
diff changeset
  1482
    "Modified: / 07-11-2006 / 13:58:39 / cg"
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
! !
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1484
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1485
!DoWhatIMeanSupport class methodsFor:'typing distance'!
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1486
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1487
isKey:k1 nextTo:k2
2774
82e1d84243f4 comment
Stefan Vogel <sv@exept.de>
parents: 2667
diff changeset
  1488
    "return true, if k1 and k2 are adjacent keys on the keyboard.
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  1489
     This is used to specially priorize plausible typing errors of adjacent keys.
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  1490
     CAVEAT: hard coded us- and german keyboards here."
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1491
3316
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1492
    ^ self isKey:k1 nextTo:k2 onKeyboard:(self keyboard)
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1493
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1494
    "
3299
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  1495
     self isKey:$a nextTo:$a   
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  1496
     self isKey:$a nextTo:$s   
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  1497
     self isKey:$a nextTo:$q   
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  1498
     self isKey:$a nextTo:$w   
1cd4b22434a6 code completion stuff moved to here (for reuse)
Claus Gittinger <cg@exept.de>
parents: 3198
diff changeset
  1499
     self isKey:$a nextTo:$z   
2517
a5323c17b767 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
  1500
     self isKey:$a nextTo:$x 
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1501
    "
3316
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1502
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1503
    "Modified: / 16-01-2008 / 17:17:31 / cg"
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1504
!
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1505
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1506
isKey:k1 nextTo:k2 onKeyboard:keys
2774
82e1d84243f4 comment
Stefan Vogel <sv@exept.de>
parents: 2667
diff changeset
  1507
    "return true, if k1 and k2 are adjacent keys on the keyboard defined by keys"
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1508
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1509
    |row1 row2 col1 col2|
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1510
2774
82e1d84243f4 comment
Stefan Vogel <sv@exept.de>
parents: 2667
diff changeset
  1511
    row1 := keys findFirst:[:eachRow | col1 := eachRow indexOf:k1. col1 ~~ 0].
2517
a5323c17b767 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
  1512
    row1 == 0 ifTrue:[^ false].
2774
82e1d84243f4 comment
Stefan Vogel <sv@exept.de>
parents: 2667
diff changeset
  1513
    row2 := keys findFirst:[:eachRow | col2 := eachRow indexOf:k2. col2 ~~ 0].
2517
a5323c17b767 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
  1514
    row2 == 0 ifTrue:[^ false].
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1515
2774
82e1d84243f4 comment
Stefan Vogel <sv@exept.de>
parents: 2667
diff changeset
  1516
    ^ (row1-row2) abs <= 1 and:[(col1-col2) abs <= 1]
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1517
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1518
    "
2774
82e1d84243f4 comment
Stefan Vogel <sv@exept.de>
parents: 2667
diff changeset
  1519
     self isKey:$a nextTo:$q
2517
a5323c17b767 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
  1520
     self isKey:$a nextTo:$x
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1521
    "
3316
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1522
!
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1523
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1524
keyboard
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1525
    "the keyboard layout (to find possible typing errors)"
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1526
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1527
    |lang|
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1528
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1529
    lang := UserPreferences current language.
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1530
    lang == #de ifTrue:[
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1531
        ^ #( 
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1532
               '1234567890-'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1533
               '*qwertzuiop'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1534
               '**asdfghjkl:'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1535
               '***yxcvbnm' ).
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1536
    ].
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1537
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1538
    lang == #fr ifTrue:[
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1539
        ^ #( 
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1540
               '1234567890'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1541
               '*azertyuiop'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1542
               '**qsdfghjklm'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1543
               '***wxcvbn,' ).
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1544
    ].
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1545
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1546
    ^ #( 
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1547
           '1234567890-'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1548
           '*qwertyuiop'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1549
           '**asdfghjkl:'
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1550
           '***zxcvbnm' ).
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1551
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1552
    "
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1553
     self keyboard 
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1554
    "
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1555
745c8130b3a5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3310
diff changeset
  1556
    "Created: / 16-01-2008 / 17:17:13 / cg"
2515
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1557
! !
69cbb89c127e +isKey:nextTo: for simple typo detection
Claus Gittinger <cg@exept.de>
parents: 2514
diff changeset
  1558
3854
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1559
!DoWhatIMeanSupport::InputCompletionResult class methodsFor:'instance creation'!
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1560
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1561
bestName:bestNameArg matchingNames:matchingNamesArg
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1562
    ^ self with:bestNameArg with:matchingNamesArg
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1563
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1564
    "
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1565
     self bestName:123 matchingNames:345
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1566
    "
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1567
! !
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1568
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1569
!DoWhatIMeanSupport::InputCompletionResult methodsFor:'accessing'!
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1570
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1571
bestName
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1572
    ^ self at:1
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1573
!
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1574
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1575
matchingNames
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1576
    ^ self at:2
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1577
! !
d7904ce12bb6 changed: #classnameCompletion:filter:inEnvironment:
Claus Gittinger <cg@exept.de>
parents: 3853
diff changeset
  1578
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1579
!DoWhatIMeanSupport class methodsFor:'documentation'!
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1580
3761
6584390d427d dont forget pool variables when looking for the best variable match
Claus Gittinger <cg@exept.de>
parents: 3751
diff changeset
  1581
version_CVS
4045
b2d1e9bb8c37 support non-class based code completion
Claus Gittinger <cg@exept.de>
parents: 4044
diff changeset
  1582
    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.78 2011-07-03 14:27:01 cg Exp $'
2376
41e0228c4c58 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1583
! !