-
Notifications
You must be signed in to change notification settings - Fork 750
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
Add support for hlsearch variable #1040
base: master
Are you sure you want to change the base?
Conversation
} | ||
return false | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fine, but personally, I'd prefer an implementation like I outlined in this discussion comment - implement v:hlsearch
as a variable with state in VimVariableServiceBase
and move state from VimSearchGroup
to the variable service.
The v:hlsearch
variable would then be the source of truth of whether or not highlights were active, and there wouldn't be a need to check with all editors or introduce a new API.
typeText("n") | ||
enterCommand("echo v:hlsearch") | ||
assertExOutput("1") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned in the other PRs, extracting to a new file and splitting into separate functions would be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I suggest we wait until the other PR for the v:register
(#1046) variable is available so we can access the new Variable
interface.
vim-engine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/services/VimVariableServiceBase.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR!. What do you think about the @ citizenmatt suggestion?
@AlexPl292 I think I understand overall @citizenmatt's suggestion: Set the highlight status into a boolean value anytime a new highlighting occurs or anytime the highlighting is cleared, so that consulting the value would not require any processing. However, I'm not totally clear on the exact way to implement this. @citizenmatt Could you share a few more details on what you have in mind? |
Sure. It's not a value that we update when a highlight is shown or hidden, it's a value we update in order to show or hide highlights. It's the flag that controls whether the highlights are shown. It defaults to So, I would replace this read/write property in
with a read-only property, something like:
And then whenever we currently set ideavim/src/main/java/com/maddyhome/idea/vim/newapi/IjVimSearchGroup.kt Lines 132 to 135 in 82d18cf
would be something like:
And The only tricky bit is what else to pass to |
No description provided.