Author Topic: Auto Lowercasing of Static Method Classname  (Read 11835 times)

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
Auto Lowercasing of Static Method Classname
« on: September 09, 2006, 10:53:14 PM »
I'm having an annoying problem and I'm hoping it's just a setting I haven't found yet.  In a Java file when I'm trying to use a static method by typing the classname, a dot, and the static method name,  SlickEdit is "helpfully" lowercasing the classname for me (when the dot it typed).  So trying to type:

User user = User.getUser(userid);

Ends up with:

User user = user.getUser(userid);

Which generates compiler errors.  Any way to turn this off?
  (*Chris*)
« Last Edit: September 13, 2006, 05:22:58 AM by PlanetPratt »

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Auto Lowercasing of Static Method Classname
« Reply #1 on: September 13, 2006, 09:31:50 PM »
I'm having an annoying problem and I'm hoping it's just a setting I haven't found yet.  In a Java file when I'm trying to use a static method by typing the classname, a dot, and the static method name,  SlickEdit is "helpfully" lowercasing the classname for me (when the dot it typed).  So trying to type:

User user = User.getUser(userid);

Ends up with:

User user = user.getUser(userid);

Which generates compiler errors.  Any way to turn this off?
  (*Chris*)

I briefly tried this (although I don't use Java) and it didn't do the lower casing (using slick 11.0.2/ Win XP) that you're getting.

Which version of slick do you use and can you post/attach a very minimal .java code that demonstrates the problem?

Graeme

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
Re: Auto Lowercasing of Static Method Classname
« Reply #2 on: September 17, 2006, 06:44:40 PM »
Well, that's sort of what I was hopeing.  That would seem to indicate it's not a bug in SlickEdit, but a setting... somewhere... in the vast number of configuration options that make up Slickedit.  Now the trick is to find the right one.  There really isn't any more code to show than what I posted.  I sent off a question to SlickEdit support almost a week ago and, other than the automated response, haven't heard anything back from them (which bothers me a bit).  I guess I'll make one more pass through the settings and see if I can't nail it down.  Thanks for trying it out.
  (*Chris*)

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Auto Lowercasing of Static Method Classname
« Reply #3 on: September 18, 2006, 01:48:34 AM »

Hmm.  I just tried again, intending to post a small snippet of code that you could compare with, so I tried

Code: [Select]
import java.awt.Graphics;
//...  stuff here
   public void paint(Graphics g){
//... stuff here
        Graphics graphics = Graphics.
   }

and when I typed the space after the equals sign, slick popped up a drop down list of suggestions, one of which was "graphics"  - I continued typing Graphics (uppercase G) and the drop down list was highlighting the "graphics" item all that time  - then I type the period ('.'), and the uppercase G changed to lowercase g   -  as if slick thinks I'm selecting the lowercase item from the drop down list.  Probably when I tried before, I cancelled the drop-down list with escape or I didn't type the "equals space"  ('= ') directly, so I didn't get the problem.

You didn't mention the dropdown list though ??.  If you type
User xuser = User.
does the lowercase problem still happen?

If that's the problem, you can turn off the drop-down list in this situation using the "Auto-list compatible parameters" checkbox on the Tagging tab of file extension setup (uncheck it).

(BTW - you didn't mention which version of slick you have.  I'm using 11.0.2)

Graeme

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
Re: Auto Lowercasing of Static Method Classname
« Reply #4 on: September 18, 2006, 02:08:15 AM »
I type pretty fast, so a lot of times, there's not enough time for the pop up to really show, but I'll bet we're seeing the same problem.  The only time I've notice it is when I'm typing variants of the same word so Book book = Book.getXXX();  I think SlickEdit is seeing that I just defined a variable named book and is "helping me out" by correcting my typing.  Rather annoying in this case.  I tried just turning off Symbols in the Auto-Complete dialog thinking that would work around the problem (even though both should be recognized as valid Symbols).  I also tried turning off Show list of matches and turning off Enable auto-completion completely, no dice.  It's seeming more and more like this might be a bug.
  (*Chris*)

P.S.  I'm running 11.0.2

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Auto Lowercasing of Static Method Classname
« Reply #5 on: September 18, 2006, 05:56:00 AM »

Sorry, I told you the wrong thing  - it's "Auto list compatible values"  - if I turn that off, the problem goes away along with the drop down list (for me).  Another way to prevent this happening is to insert the "equals space" or just the space using "copy/paste" (so you could have a macro do this), or even a macro that generates the whole word automatically by copying the second to previous word.  I'm surprised you can type fast enough to stop this drop down list.  I agree it looks like a slick bug.

Graeme

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
Re: Auto Lowercasing of Static Method Classname
« Reply #6 on: September 18, 2006, 06:34:13 AM »
Weird, it still happens for me with both "Auto-insert matching parameter" and "Auto-list compatible parameters" turned off.  I even tried with both those off and "Enable auto-completion" disabled on the Auto-Complete tab.  I think we entering pretty solid bug territory.  Thanks for your help looking at this.
  (*Chris*)

jbezem

  • Community Member
  • Posts: 87
  • Hero Points: 8
Re: Auto Lowercasing of Static Method Classname
« Reply #7 on: September 18, 2006, 07:07:45 AM »
Just my 5cents:
It might be a matter of specification: If I type the beginning of a function name, see that the correct name of the function is selected in the drop-down, I can type the opening parenthesis and SE will complete the name for me.
Now, if I want to enter a call for exactly that function which has the name I typed, and not the name offered in the drop-down box, I need to press escape to prevent the drop-down from enhancing the rest of the selected but unwanted name.
I think we need to enhance the specification, so that if the name is typed in full compared to the selected item, no completion is to be executed on typing a period '.' or whatever, since that seems to be the case.
Requiring the autocompletion to differentiate between static and non-static member functions might be a little overdone :)

Am I making sense?

FWIW,

Johan

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
Re: Auto Lowercasing of Static Method Classname
« Reply #8 on: September 18, 2006, 07:20:41 AM »
I would agree if I had turned off that feature in the configuration and the problem went away.  But it didn't, it's still there going strong.

But I agree that the "helper function" shouldn't change valid, complete, code.  In this case it's changing from one symbol to another, when both were valid.  It should assume that if both are valid, I may have know what I was doing (not always a safe assumption, but ya gotta give me the benefit of the doubt =8^)
  (*Chris*)

P.S.  Wow, inflation even hit the inspired thought, what's next =8^)

jbezem

  • Community Member
  • Posts: 87
  • Hero Points: 8
Re: Auto Lowercasing of Static Method Classname
« Reply #9 on: September 18, 2006, 07:34:14 AM »
FWIW: If I disable 'Auto-list members' _and_ 'Auto-list compatible values' on the 'Tagging' tab, the sample Graeme gave works for me. Auto-complete is on, standard settings AFAICT.

Does that help? Maybe we can thus find the position in the code where this replacement is done...

Johan

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Auto Lowercasing of Static Method Classname
« Reply #10 on: September 18, 2006, 08:40:03 AM »

I'll just poke my nose in again ...  it's strange you don't get the dropdown list.  Another thing you could try is to get that to appear, then try to get rid of it (by first turning off that "auto-compatible values" thing rather than by turning off auto-completion completely).  Also my favourite cure  - try a temporary new config directory using the -sc some-folder-name switch when you invoke slickedit, where some-folder-name is a new empty directory.

Graeme

Dennis

  • Senior Community Member
  • Posts: 3965
  • Hero Points: 517
Re: Auto Lowercasing of Static Method Classname
« Reply #11 on: September 18, 2006, 03:42:47 PM »
What you are seeing is due to a combination of settings.  First, on Tools > Options > File Extension Setup, Tagging tab, if you have "Auto-list compatible values" (last item in the LEFT column) enabled -- it is enabled by default.  The second setting is your setting for "Update after ms idle", which is by default 0, which says to immediately show list-members or compatible values.  My guess you have change that setting to something like 250 ms.

With these settings, when you type:  "User user =<space>" SlickEdit will attempt to list variables in the current scope that match the type of "user".

In this case, "user" matches itself, and is put in the list and automatically selected when you type "User" (because the matching is case-insensitive).  When you type the dot after User, we substitute "User" with the word selected in the drop-down list, which is "user".

Now, if you have "Update after ms idle" set to delay, there is a TINY window of time, perhaps it perfectly matches the cadence of your typing where the list comes up immediately as you type dot.  If you are on Windows, you might notice the list flash up and go away in this case.  If you are on Unix, you might not see it at all because the window can be created and destroyed before the X-Server refreshes.

If you type the sequence very slowly just once, you will see exactly what is happening.

Now, is this a bug?  I can sympathize that it is annoying.  One could argue that the list should be case-sensitive, matching the case-sensitivity rules of the language.  However, one of the most loved features of list members is that it is not case sensitive, so you can type in all lower case and let it substitute the right mixed cased identifier.  You could argue that it should be more like Auto-Complete and just provide hints and not select anything by default, but then, this is also one of the most loved features of auto-list members, if you are looking for "str.GetLength()", you type "str.getl", immediately see that "GetLength()" is selected, and type the open parenthesis and keep going.

I think I have a solution that will serve as a good compromise, and I will file a feature request for us to add this to SlickEdit in a future version.  The idea is that for a case-sensitive language, use case-insensitive matching only if the word under the cursor is all lower case or the programming language is case-insensitive.  With this tweak, when you type "User", it would not be matched with the local variable "user", so nothing would be selected in the drop down, and thus nothing changes when you type dot.  This allows users to still type lazily without hitting the Shift key and get case correction via list members when they need it, but not when they explicitly type something containing capital letters.

jbezem

  • Community Member
  • Posts: 87
  • Hero Points: 8
Re: Auto Lowercasing of Static Method Classname
« Reply #12 on: September 18, 2006, 05:35:11 PM »
Good compromise, suits me fine.

Johan

Graeme

  • Senior Community Member
  • Posts: 2796
  • Hero Points: 347
Re: Auto Lowercasing of Static Method Classname
« Reply #13 on: September 18, 2006, 08:38:38 PM »

Um, well I didn't notice the "update after ms idle" setting on the "Tagging" tab coz there's one on the "auto complete" tab as well so my eyes blocked it out somehow!.  Even if Chris had this set to a non zero value, it doesn't explain why he's still getting the lower casing occurring when "auto-list compatible values" is off.

Graeme

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
Re: Auto Lowercasing of Static Method Classname
« Reply #14 on: September 19, 2006, 07:34:50 PM »
I must have confused "Auto-list compatible parameters" with "Auto-list compatible values" (they're so different, I don't know how I could have confused them =8^).  When I turn off "Auto-list compatible values" (and my "Update after (ms) idle" on the Tag tab is 300ms) that seems to solve the problem (of course I can't use that list any longer).  But I agree with Graeme, if it's supposed to wait 300ms before doing anything, why does it insert the value with almost 0ms delay?  I think the real fix would be to have to feature respect the value in that field.  If I wait, I want to select from the list (or escape to get rid of it), if I just keep-on-typin' don't mess me up.
  (*Chris*)