WorkspaceCompletionSupport.st
changeset 4870 2714e7b0261e
parent 4810 c273ec93c680
child 4873 b61e9d930b48
child 5047 091548040432
--- a/WorkspaceCompletionSupport.st	Sun Jan 26 14:53:11 2014 +0100
+++ b/WorkspaceCompletionSupport.st	Tue Jan 28 20:27:02 2014 +0100
@@ -89,31 +89,34 @@
     "/ append snipplet, if any (can be easily reached via CRSR-up)
     suggestionOffset := 0.
     indexOfSnippet := nil.
-    (keyAndSnippet := editView findAbbreviationKeyBeforeCursor) notNil ifTrue:[
-        |abbrev sniplet i line|
-
-        abbrev := keyAndSnippet first.
-        sniplet := keyAndSnippet second.
+    UserPreferences current appendAbbreviationsToCompletionSuggestions ifTrue:[
+        (keyAndSnippet := editView findAbbreviationKeyBeforeCursor) notNil ifTrue:[
+            |abbrev sniplet i line|
 
-        "/ if the abbreviation is simply at the end of a longer word, ignore the abbrev.
-        line := editView lineStringBeforeCursor.
-        i := line findLast:[:ch | ch isLetterOrDigit not].
-        (i < (line size - abbrev size - 1)) ifFalse:[
-            sniplet := sniplet copyWithout:$!!.
+            abbrev := keyAndSnippet first.
+            sniplet := keyAndSnippet second.
+
+            "/ if the abbreviation is simply at the end of a longer word, ignore the abbrev.
+            line := editView lineStringBeforeCursor.
+            i := line findLast:[:ch | ch isLetterOrDigit not].
+            (i < (line size - abbrev size - 1)) ifFalse:[
+                sniplet := sniplet copyWithout:$!!.
 
-            "/ true, false and self are often found in both lists
-            (suggestions includes:sniplet) ifFalse:[   
-                suggestions isEmpty ifFalse:[ suggestions := suggestions copyWith: '-' ]. 
-                suggestions := suggestions copyWith: ( '%1 %2'
-                                        bindWith:(sniplet asStringCollection first "contractTo:25")
-                                        with: ( ('("',abbrev,'" snippet)') colorizeAllWith:Color grey)).
-                indexOfSnippet := suggestions size.
+                "/ true, false and self are often found in both lists
+                (suggestions includes:sniplet) ifFalse:[   
+                    suggestions isEmpty ifFalse:[ suggestions := suggestions copyWith: '-' ]. 
+                    suggestions := suggestions copyWith: ( '%1 %2'
+                                            bindWith:(sniplet asStringCollection first "contractTo:25")
+                                            with: ( ('("',abbrev,'" snippet)') colorizeAllWith:Color grey)).
+                    indexOfSnippet := suggestions size.
 
-                "/ change below, when reversing the order in above code
-                "/ suggestionOffset := 2.
+                    "/ change below, when reversing the order in above code
+                    "/ suggestionOffset := 2.
+                ]
             ]
-        ]
+        ].
     ].
+
     suggestions isEmptyOrNil ifTrue:[
         self closeCompletionView.
         ^ self
@@ -236,10 +239,10 @@
 !WorkspaceCompletionSupport class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.6 2013-10-10 19:35:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.7 2014-01-28 19:27:02 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.6 2013-10-10 19:35:28 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/WorkspaceCompletionSupport.st,v 1.7 2014-01-28 19:27:02 cg Exp $'
 ! !