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

getSuggestionForWord method in ClickProvider seems to make every word hyperclick-able #11

Closed
jonboiser opened this issue Jan 6, 2020 · 2 comments · Fixed by #12
Closed
Labels
bug Something isn't working released

Comments

@jonboiser
Copy link

jonboiser commented Jan 6, 2020

I reported this as a side note in atom-community/atom-ide-vue#13, but the relevant code appears to be in this repository.

When I install atom-ide-definitions, atom-ide-vue, and hyperclick, together, every word in my .vue files becomes underlined and hyperclick-able. Here's a screenshot, where the scoped attribute is underlined (the cursor isn't captured by the screenshot, but it over the word), even though it will not have a definition anywhere in a typical Vue codebase.

Screen Shot 2020-01-06 at 11 05 38 AM

Looking at https://github.com/atom-ide-community/atom-ide-definitions/blob/master/lib/clickProvider.js#L11, the implementation of ClickProvider::getSuggestionForWord seems to return an object for every word that is sent to it, when cmd-hovering (for Mac) over code. Hyperclick will treat every symbol as clickable if getSuggestionForWord always returns a truthy object result, hence the behavior I'm seeing.

My assumption is that the click callback is provided (in the Vue example) but atom-ide-vue via options.clickHandler, but that the return value of the getSuggestionForWord function is not controllable by the Vue package. To me, it seems that the language-level atom-ide plugins need to be able to determine whether or not a token has a definition and only return an truthy result if it does.

@jonboiser jonboiser changed the title getSuggestionForWord method in ClickProvider seems to make every symbol hyperclick-able getSuggestionForWord method in ClickProvider seems to make every word hyperclick-able Jan 6, 2020
@Belar
Copy link
Contributor

Belar commented Jan 25, 2020

Hi, as said in the other issue, it's a good point, only items with definition should be highlighted and clickable.

You are right about getSuggestionForWord, it shouldn't return universal handler. We can first check if definition is available (on cmd + hover), base return on that.

@Belar Belar added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Jan 25, 2020
Belar added a commit that referenced this issue Jan 28, 2020
@Belar Belar closed this as completed in #12 Jan 28, 2020
@appelgriebsch
Copy link
Contributor

🎉 This issue has been resolved in version 0.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants