Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoToDefinition occasionally does nothing on THIS{DOT}MethodName #35

Open
Jimrnelson opened this issue Jan 14, 2025 · 13 comments
Open

GoToDefinition occasionally does nothing on THIS{DOT}MethodName #35

Jimrnelson opened this issue Jan 14, 2025 · 13 comments

Comments

@Jimrnelson
Copy link
Collaborator

But I did have two occasions here recently where it failed. The second one was just now. I had typed in this.SavePayment(), double-clicked SavePayment and selected Go to definition from the menu. Nothing. So I looked back over your last communication and saw that I should try thisform. Well, that did make it work. I can't say it's always about that, because I do try to use "thisform" only when the object is not the form and I use "this" when I'm in a method of the form. So if that were the only cause, I think I'd see it a lot more. But this time, using thisform did the trick.

Reported on Thor issues page by @GTGeek88

Jimrnelson added a commit to Jimrnelson/GoToDefinition that referenced this issue Jan 14, 2025
Fixed bug where using GoToDef on `This.SomeMethod` would do nothing under some circumstances: (VFPX#35)
- In a form (or form based class), in a method for the form itself (and thus `ThisForm.SomeMethod` would be equivalent).
- AND the currently selected object (as appears in the Properties Window) is an object in the form (but not the form itself)
@Jimrnelson
Copy link
Collaborator Author

@GTGeek88

This issue has been address in Version 2.17 (2025-01-14).

I was confounded as to how to even attack this intermittent problem until it happened to me.

Please let me know here if here are any further issues with GTD.

@GTGeek88
Copy link

GTGeek88 commented Feb 7, 2025

Ugh. It's been working well. I must have jinxed it. Just prior to using GoToDefinition, I was thinking that. Musta got it fixed, I thought. But then it happened. In a method of the form. I was using this.GetStats(). I selected GoToDefinition and nothing happened (this was for a new method I was creating, so it does not yet exist). I tried thisform.GetStats(). Nothing. And I see nothing unusual that I've done. Also, I did a check for updates and I'm current on all the Thor tools I use. I closed the form and reopened it. No change. I closed VFP and reopened it and GoToDefinition then worked properly.

@Jimrnelson
Copy link
Collaborator Author

@GTGeek88

I am running out of guesses here as to what might be going on for you.

However, I do have a random set of questions that might give me a hint.

When you find that it is doing nothing

  • Does it still work if you use it on something else?
  • Does it work if you change it to Thisform (instead of This)?
  • Open the properties sheet. Is the current object the form itself or some object within the form?
  • If you go the a blank line at the bottom of the command window and call GoToDef, do you get this?

Image

@Jimrnelson Jimrnelson reopened this Feb 10, 2025
@GTGeek88
Copy link

I will try all that if it happens again. As for #2, I did mention in my last communication that I tried both this and thisform, with no success. However, I think in a previous communication changing to thisform did make it work. Anyway, I'll keep you posted. Thanks for your responses.

@GTGeek88
Copy link

Ok, Jim, it just happened. For this and thisform. Even if thisform was used at the bottom of the code window. Even though the Properties window was showing the form itself as the active object and I was in a method of the form itself. However, the PEM Editor was not open. So I used Alt-F9 to open it, then tried again with GoToDefinition and it worked.

@GTGeek88
Copy link

GTGeek88 commented Feb 10, 2025

Well, damn, I spoke too soon. The GoToDefinition window came up and I came straight here and reported the above. But then I went back to VFP and I realized the form had no method name in it. So I closed it and tried again by clicking on the code window and using the feature. No luck. Then I closed PEM Editor, reopened it, and immediately tried the feature. It came up again with nothing in the method name field. It's coming up when PEM Editor has the focus and so it's not really working with the code window. So that was a false alarm. At present, I can't get it to work with the code window. But, like before, I quit VFP, restarted it, and then it worked fine.

@Jimrnelson
Copy link
Collaborator Author

It's coming up when PEM Editor has the focus and so it's not really working with the code window.

You mean this is failing when PEMEditor has the focus? I wouldn't expect it to -- it works only if the code window has the focus.

Or am I misinterpreting your test?

Please send a screenshot just before you call GoToDef.

Also, you did not answer this (from my earlier message)

When GoToDef is failing, if you go the a blank line at the bottom of the command window and call GoToDef, do you get this?

Image

@GTGeek88
Copy link

"Also, you did not answer this (from my earlier message)"

When I put the cursor on the last line of the code window (a blank line unto itself) and use GoToDefinition, I get a "blank" GoToDefinition window. The one where you do the work - confirm the name, choose if it's a property or method, etc.

When I put the cursor on the last line of the Command Window (blank line), I get the same behavior as just described.

When PEM Editor has the focus and I use the GoToDefinition feature, the GoToDefinition form comes up, but has no method name in the top field. It's an empty GoToDefinition form. That fooled my earlier because I just failed to pay enough attention. So when I realized that and put the focus back on the code window, highlighted the method name of this.() it still did not work. Not until I exited VFP and restarted it. Then it worked perfectly.

Image

@Jimrnelson
Copy link
Collaborator Author

@GTGeek88

So this helps, at least somewhat.

I suggest this: Do not select (highlight) the method name. There is no need to; simply execute GoToDef when the cursor is anywhere within the method name -- in fact, it can also be right before the first character or right after the last character.

You can actually do more than that by entering any parameters as well, and using GoToDef after the closing paren.

Image

All this, of course, if it works.

And, if that doesn't change anything, can you send an image of the entire code window ?

@GTGeek88
Copy link

Alright, I'll try that.

And I see that my use of less than and greater than signs did not work out like I wanted it to, so this "highlighted the method name of this.() it still did not work" was not supposed to look quite like that. But it probably does not matter now.

@GTGeek88
Copy link

I ran into the problem again. I tried not selecting the method name I was attempting to add. No dice. The only thing different was that when I put it at the end of this.GetSkipList(), after the closing parentheses, I did get the window to come up, but it was blank. I shut down VFP and restarted it and it worked fine.

Image

@Jimrnelson
Copy link
Collaborator Author

@GTGeek88

First, a question -- in the image you just sent, the pop-up form to add a method/property appeared, but the name was empty.

So are you saying that some of the time this window comes up with nothing in the name field and some of the time nothing happens at all?

Really, then, two different undesirable behaviors?

@GTGeek88
Copy link

GTGeek88 commented Feb 11, 2025

In the past, nothing ever happened. But I was always highlighting the method name via a double-click, then selecting GoToDefinition from the Thor Tools menu. Now, doing what you suggested, putting the cursor at the end of the line there after the closing parentheses, the blank form comes up. But the "old" way, highlighting the method name, results in nothing at all happening. And, like I was saying, it worked perfectly after exiting VFP and restarting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants