Skip to content

Make server-side search respect Context Lines feature of Search Editor #1290

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

Merged
merged 7 commits into from
Jan 5, 2024

Conversation

gjsjohnmurray
Copy link
Contributor

This PR fixes #1286

@isc-bsaviano
Copy link
Contributor

@gjsjohnmurray I think the CI keeps failing because we need to update @vscode/test-electron to the latest version. Can you do that in this branch so I can test this change?

@gjsjohnmurray
Copy link
Contributor Author

@isc-bsaviano done, and CI now happy.

@isc-bsaviano
Copy link
Contributor

Thanks for that @gjsjohnmurray. I gave this a try and while the code looks fine, I think it's performing much worse than before when there are many matches. I think that the issue is with your previewFrom and previewTo calculations. I think you need parentheses, so line - options.beforeContext || 0 becomes line - (options.beforeContext || 0).

@gjsjohnmurray
Copy link
Contributor Author

Good catch! I have pushed the fix.

@isc-bsaviano
Copy link
Contributor

You fix is better, but I'm still seeing some slowness. The slowness occurs when I start with an empty search box (I'm using the regular search view, not the editor) and type a string to search. Using the current beta, the previous searches are cancelled very quickly when a new character is typed and the final search is shown quickly once typing is stopped. Using this dev vsix, the old searches are not being cancelled fast enough so there is lag when new characters are typed where the search results shown are for the older search. I'm not sure how this could be caused by your change since the context lines options will be undefined.

@gjsjohnmurray
Copy link
Contributor Author

As you say, it's not clear why the changes should have impacted performance noticeably for you. Anyway, I've pushed some changes that may improve things and I hope don't break anything.

@isc-bsaviano
Copy link
Contributor

@gjsjohnmurray Once again, I really like your edit but the search still gets "stuck" on the previous query while you type. Maybe we can add more checks of token.isCancellationRequested? I would add a check at the top of searchMatchToLine and the forEach callback for the Set. Sorry for not being able to provide better reproduction details, I just want to avoid performance degradation for the most common search case.

@gjsjohnmurray
Copy link
Contributor Author

@isc-bsaviano please re-test

@isc-bsaviano
Copy link
Contributor

@gjsjohnmurray Just tested again and am seeing the same behavior. Here's two screen recordings, one with beta.3 and the other with your most recent dev.1290:

beta3.mov
dev1290.mov

@gjsjohnmurray
Copy link
Contributor Author

What is the $ZV of the server you are connecting to?

@isc-bsaviano
Copy link
Contributor

isc-bsaviano commented Dec 29, 2023

It's an internal kit. I tried again with a 2023.3 community edition kit and am seeing the same behavior.

@gjsjohnmurray
Copy link
Contributor Author

Here's what I get with VS Code 1.85.1 Windows connecting to a local Docker instance of the containers.intersystems.com/intersystems/iris-community:2023.3 image

junk

@isc-bsaviano
Copy link
Contributor

Interesting. I'm on an M1 Mac, which appears to be the only difference in our setup.

@gjsjohnmurray
Copy link
Contributor Author

And strange that your dev.1290 recording ends with "0 results in 1 file".

@isc-bsaviano
Copy link
Contributor

isc-bsaviano commented Dec 29, 2023

Oh, that's because I cut the recording off a fraction of a second early. It eventually returned the correct results. Maybe that's showing up because context was sent before the match even though there shouldn't be any in this case. I don't see how that could happen from your code though.

@isc-bsaviano
Copy link
Contributor

@gjsjohnmurray I copied your changes into one of my branches and in "Extension Development Host" mode everything looked fine. I'm going to approve this and assume that the issue is unique to me. If we see any complaints from the field we can take a closer look then.

isc-bsaviano
isc-bsaviano previously approved these changes Jan 5, 2024
@isc-bsaviano isc-bsaviano merged commit 52bdffd into intersystems-community:master Jan 5, 2024
@gjsjohnmurray gjsjohnmurray deleted the fix-1286 branch January 5, 2024 18:15
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

Successfully merging this pull request may close these issues.

Server-side (isfs) search ignores Context Lines feature of Search Editor
2 participants