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

SCP puts quotes in the wrong place #4460

Closed
daFreeMan opened this issue Oct 25, 2018 · 3 comments
Closed

SCP puts quotes in the wrong place #4460

daFreeMan opened this issue Oct 25, 2018 · 3 comments
Assignees
Labels
bug Identifies work items for known bugs feature-autocomplete

Comments

@daFreeMan
Copy link
Contributor

Win10, Excel 2016 (desktop), RD .4047

Starting with this text:

  ExecuteStoredProcedure ("AddAppointmentCountForAClinic", False,dbconfig.SQLConString, & _
                          | thisClinic.ClinicID ,

I type " and it yields this text:

  ExecuteStoredProcedure ("AddAppointmentCountForAClinic", False,dbconfig.SQLConString, & _
                           thisClinic.ClinicID ,"|"

Yes, the cursor is at the beginning (indented) of the 2nd line, yet the "" ends up at the end of the 2nd line.

@retailcoder retailcoder added bug Identifies work items for known bugs feature-autocomplete labels Oct 25, 2018
@retailcoder retailcoder self-assigned this Oct 25, 2018
retailcoder added a commit to retailcoder/Rubberduck that referenced this issue Oct 26, 2018
retailcoder added a commit to retailcoder/Rubberduck that referenced this issue Oct 26, 2018
retailcoder added a commit to retailcoder/Rubberduck that referenced this issue Oct 26, 2018
@daFreeMan
Copy link
Contributor Author

Sadly, build .4058 doesn't seem to have fixed this, or at least I can't tell because Excel crashes. Every. Single. Time.

Starting with this code (a continuation of the originally reported code):

returnCode = ExecuteStoredProcedure("AddAppointmentCountForAClinic", False, dbConfig.SQLConString, _
                                    "@clinicID", surveyListRS.Fields("ClinicID").value, adInteger, _|
                                    "@startDate", reportDate, adDate)

With the caret (as indicated) at the end of the 2nd line, I hit Enter. The caret moves to the beginning of the next line in column 1, then Excel crashes.

However, if I start with this code:

    returnCode = ExecuteStoredProcedure("AddAppointmentCountForAClinic", False, dbConfig.SQLConString, "@clinicID", surveyListRS.Fields("ClinicID").value, adInteger, "@startDate", reportDate, adDate)

with the caret anywhere (except in an already quoted string) and hit " I get a 2nd " as expected.

This is the RD log from a crash:
RubberduckLog.4058.txt

And this is the log from the successful SCPs:
RubberduckLog.txt

Are there any Windows logs I can provide to help track down the issue?

@retailcoder
Copy link
Member

@daFreeMan thanks. Likely I missed an off-by-one and the service is throwing an IndexOutOfRangeException. A quick patch that should probably be in place anyway, would be to have a try/catch+logging in the AC service, which could then just resume without handling the keypress.
Note that this is an entirely different problem than originally presented though: handling " and handling ENTER are two distinct code paths - the originally reported issue is indeed fixed, as far as I can tell. Does ENTER at the end of the 2nd line still crash with smart-concat disabled? I suspect the prettifier code is making a mistake in the calculation of the indent on the new empty line.

@daFreeMan
Copy link
Contributor Author

Now no repo on the crash, however, hitting enter after line 2 does leave the cursor at the left margin, so auto-indent has been borked.

Interestingly, when I went back into the settings for AC to test your request, Enable AC was selected, but none of the sub-options were selected. I tested with AC disabled, then, 1-by-1 enabled each additional option and repeated the Enter and had no crash.

Guess we'll leave this one closed.

IvenBach pushed a commit to IvenBach/Rubberduck that referenced this issue Oct 31, 2018
IvenBach pushed a commit to IvenBach/Rubberduck that referenced this issue Oct 31, 2018
IvenBach pushed a commit to IvenBach/Rubberduck that referenced this issue Oct 31, 2018
IvenBach pushed a commit to IvenBach/Rubberduck that referenced this issue Oct 31, 2018
@Vogel612 Vogel612 modified the milestone: 2.4.1 Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies work items for known bugs feature-autocomplete
Projects
None yet
Development

No branches or pull requests

3 participants