DoWhatIMeanSupport.st
changeset 6105 82efed08b020
parent 6082 96c1001f95ef
child 6126 d57220547995
--- a/DoWhatIMeanSupport.st	Sun Aug 11 03:40:49 2019 +0200
+++ b/DoWhatIMeanSupport.st	Sun Aug 11 14:25:39 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG
 	      All Rights Reserved
@@ -108,35 +110,7 @@
     "Created: / 18-09-2013 / 13:34:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
-!DoWhatIMeanSupport class methodsFor:'code completion - obsolete'!
-
-codeCompletionForClass:classOrNil context:contextOrNil codeView:codeView
-    <resource: #obsolete>
-    "contextOrNil is the current context, if this is called from the debugger;
-     nil, if called from the browser.
-     If nonNil, we can make better guesses, because we actually know what a variable's type is.
-     This is not yet done, sigh"
-
-    ^ self
-	codeCompletionForLanguage: nil class:classOrNil context:contextOrNil codeView:codeView
-
-    "Modified: / 18-09-2013 / 13:34:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-codeCompletionForMethod:methodOrNil orClass:classOrNil context:contextOrNil codeView:codeView into:actionBlock
-    <resource: #obsolete>
-    "contextOrNil is the current context, if this is called from the debugger;
-     nil, if called from the browser.
-     If nonNil, we can make better guesses, because we actually know what a variable's type is.
-     This is not yet done, sigh"
-
-    ^ self new
-	codeCompletionForMethod:methodOrNil orClass:classOrNil
-	context:contextOrNil
-	codeView:codeView into:actionBlock
-! !
-
-!DoWhatIMeanSupport class methodsFor:'code completion-helpers'!
+!DoWhatIMeanSupport class methodsFor:'code completion - helpers'!
 
 findNodeForInterval:interval in:source
     "utility"
@@ -253,6 +227,34 @@
     "Modified: / 20-11-2006 / 12:31:12 / cg"
 ! !
 
+!DoWhatIMeanSupport class methodsFor:'code completion - obsolete'!
+
+codeCompletionForClass:classOrNil context:contextOrNil codeView:codeView
+    <resource: #obsolete>
+    "contextOrNil is the current context, if this is called from the debugger;
+     nil, if called from the browser.
+     If nonNil, we can make better guesses, because we actually know what a variable's type is.
+     This is not yet done, sigh"
+
+    ^ self
+	codeCompletionForLanguage: nil class:classOrNil context:contextOrNil codeView:codeView
+
+    "Modified: / 18-09-2013 / 13:34:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+codeCompletionForMethod:methodOrNil orClass:classOrNil context:contextOrNil codeView:codeView into:actionBlock
+    <resource: #obsolete>
+    "contextOrNil is the current context, if this is called from the debugger;
+     nil, if called from the browser.
+     If nonNil, we can make better guesses, because we actually know what a variable's type is.
+     This is not yet done, sigh"
+
+    ^ self new
+	codeCompletionForMethod:methodOrNil orClass:classOrNil
+	context:contextOrNil
+	codeView:codeView into:actionBlock
+! !
+
 !DoWhatIMeanSupport class methodsFor:'input completion support'!
 
 classCategoryCompletion:aPartialCategory inEnvironment:anEnvironment
@@ -1752,30 +1754,7 @@
     "Modified: / 02-11-2018 / 20:17:48 / Claus Gittinger"
 ! !
 
-!DoWhatIMeanSupport methodsFor:'code completion - obsolete'!
-
-codeCompletionForClass:classOrNilArg context:contextOrNil codeView:codeViewArg
-    <resource: #obsolete>
-    "OBSOLETE; migrating to use the the new 'xxx: into:' protocol.
-     contextOrNil is the current context, if this is called from the debugger;
-     nil, if called from the browser.
-     If nonNil, we can make better guesses, because we actually know what a variable's type is.
-     This is not yet done, sigh"
-
-    ^self codeCompletionForLanguage: nil class:classOrNilArg context:contextOrNil codeView:codeViewArg
-
-    "Modified: / 04-07-2006 / 18:48:26 / fm"
-    "Modified: / 28-08-2013 / 17:15:25 / cg"
-    "Modified: / 18-09-2013 / 14:15:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-codeCompletionForMethod:methodOrNilArg orClass:classOrNilArg context:contextOrNilArg codeView:codeViewArg into:actionBlock
-    <resource: #obsolete>
-    ^ self
-	codeCompletionForSmalltalkMethod:methodOrNilArg orClass:classOrNilArg context:contextOrNilArg codeView:codeViewArg into:actionBlock
-! !
-
-!DoWhatIMeanSupport methodsFor:'code completion-helpers'!
+!DoWhatIMeanSupport methodsFor:'code completion - helpers'!
 
 askUserForCompletion:what for:codeView at:position from:allTheBest
     |list choice lastChoice|
@@ -2532,7 +2511,7 @@
 "/
 "/    info := best storeString.
 "/    implClass notNil ifTrue:[
-"/        info := implClass name , ' » ' , info.
+"/        info := implClass name , ' » ' , info.
 "/    ].
 "/    self information:info.
 "/].
@@ -4141,26 +4120,23 @@
         Thus, I can construct a partial the parent chain.
     "
 
-    |intersectingNodes smallestIntersectingNode firstIntersectingNode
+    |language intersectingNodes smallestIntersectingNode firstIntersectingNode
      lastIntersectingNode onErrorBlock
      nodeGenerationHook parserClass parser currentScopeNodes bestNode|
 
     partialString := nil.
     interval isEmpty ifTrue: [^ nil].
 
-    languageOrNil notNil ifTrue:[
-        parserClass := languageOrNil parserClass.
-    ] ifFalse:[
+    (language := languageOrNil) isNil ifTrue:[
         classOrNil notNil ifTrue:[
-            parserClass := classOrNil programmingLanguage parserClass.
+            language := classOrNil programmingLanguage
+        ] ifFalse:[
+            language := SmalltalkLanguage instance
         ]
     ].
-    parserClass notNil ifTrue:[
-        "/ hack
-        parserClass == Parser ifTrue: [
-            parserClass := RBParser.
-        ].
-    ] ifFalse:[
+    parserClass := language parserClass.
+    (parserClass ? RBParser) == Parser ifTrue:[
+        "/ hack use RBParser, when Parser was returned by language
         parserClass := RBParser.
     ].
     parserClass isNil ifTrue: [^ nil].
@@ -5006,7 +4982,7 @@
     ^ selectors
 ! !
 
-!DoWhatIMeanSupport methodsFor:'code completion-helpers-old'!
+!DoWhatIMeanSupport methodsFor:'code completion - helpers-old'!
 
 codeCompletionForLiteralSymbol:node inClass:classOrNil codeView:codeView
     |sym possibleCompletions best start stop oldLen newLen oldVar|
@@ -5270,7 +5246,7 @@
 "/
 "/    info := best storeString.
 "/    implClass notNil ifTrue:[
-"/        info := implClass name , ' » ' , info.
+"/        info := implClass name , ' » ' , info.
 "/    ].
 "/    self information:info.
 
@@ -5745,7 +5721,30 @@
     "Modified (format): / 03-03-2019 / 22:53:58 / Claus Gittinger"
 ! !
 
-!DoWhatIMeanSupport methodsFor:'helpers-naive type inference'!
+!DoWhatIMeanSupport methodsFor:'code completion - obsolete'!
+
+codeCompletionForClass:classOrNilArg context:contextOrNil codeView:codeViewArg
+    <resource: #obsolete>
+    "OBSOLETE; migrating to use the the new 'xxx: into:' protocol.
+     contextOrNil is the current context, if this is called from the debugger;
+     nil, if called from the browser.
+     If nonNil, we can make better guesses, because we actually know what a variable's type is.
+     This is not yet done, sigh"
+
+    ^self codeCompletionForLanguage: nil class:classOrNilArg context:contextOrNil codeView:codeViewArg
+
+    "Modified: / 04-07-2006 / 18:48:26 / fm"
+    "Modified: / 28-08-2013 / 17:15:25 / cg"
+    "Modified: / 18-09-2013 / 14:15:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+codeCompletionForMethod:methodOrNilArg orClass:classOrNilArg context:contextOrNilArg codeView:codeViewArg into:actionBlock
+    <resource: #obsolete>
+    ^ self
+	codeCompletionForSmalltalkMethod:methodOrNilArg orClass:classOrNilArg context:contextOrNilArg codeView:codeViewArg into:actionBlock
+! !
+
+!DoWhatIMeanSupport methodsFor:'helpers - naive type inference'!
 
 addClassesFromAssignmentTo:varName in:aTree to:setOfTypes
     "/ assignments...
@@ -6657,6 +6656,10 @@
     "
 
     "Created: / 27-12-2018 / 12:11:31 / Claus Gittinger"
+!
+
+language:aProgrammingLanguage
+    languageOrNil := aProgrammingLanguage
 ! !
 
 !DoWhatIMeanSupport::InputCompletionResult class methodsFor:'instance creation'!