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

Whole Words option should support the "$" symbol for JS files #141

Closed
mindrones opened this issue Jan 13, 2017 · 6 comments
Closed

Whole Words option should support the "$" symbol for JS files #141

mindrones opened this issue Jan 13, 2017 · 6 comments

Comments

@mindrones
Copy link

Basically the same request as #73 but for javascript :), that is, in state$.subscribe(state => {...}), double-clicking on state$ should highlight state$ and not state and vice-versa.

In language-javascript package settings, I tried removing the $ from the chars I had by default in the Non-Word Characters setting but it didn't work.

Thanks!

@richrace
Copy link
Member

It's basically an issue with \b word boundaries in the regex.

This is the problem area: https://github.com/richrace/highlight-selected/blob/master/lib/highlighted-area-view.coffee#L116-L121

Potential solution is using a regex like this: [@\$]?\bstate\b[\$]? and replace the @$ etc with specified values in this package config. For example a hash hash["attribute"] would not want to select the " or [] characters.

However, if you were to remove the non-word characters from Atom's actual config so when you either double click the word or use cmd + d / ctrl + d you'd actually select all the text. But then you'd get the state$ as your selected text. And we would need to parse it first.

@mindrones
Copy link
Author

Gasp, seems word specific though?

@tonn
Copy link

tonn commented Apr 11, 2017

I remove regex-parse of selection content. So now any characters in selection is available to highlight.
Do know why this limitations was added to logic.

https://i.imgur.com/MhJju1r.png

Here is patch https://gist.github.com/tonn/0a4d7d7b5e769d573e1d7256754d0a81

@turigeza
Copy link

turigeza commented Sep 5, 2017

if ( this.options.constrainTo === 'window' ) this.$container = this.$document; else if ( this.options.constrainTo && (this.options.constrainTo !== 'parent') ) this.$container = $(this.options.constrainTo); else this.$container = this.$el.parent();

Just adding this as it is related. If you were to select the word "$container" the other $container words would not get highlighted as expected. This is true to javascript files.

@jonkwheeler
Copy link

Can we get this bumped up in priority?

In the mean time, you can uncheck "Only Highlight Whole Words" to get around it.

@richrace
Copy link
Member

See #174

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

5 participants