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

Jump to definition doesn't ignore comments in search #117

Open
dkjii-gg opened this issue Jan 21, 2019 · 2 comments
Open

Jump to definition doesn't ignore comments in search #117

dkjii-gg opened this issue Jan 21, 2019 · 2 comments

Comments

@dkjii-gg
Copy link

see https://github.com/dkjii-gg/phpcomplete-test-2, try going to \t\test(), it brings to \f\test because it falls back to vim default tag search

The reason it does that is that when it looks for the match in the file (to get the line), it doesn't verify that it's not part of a comment

Here's a patch that fixes this (kinda), but it does not handle a lot of valid use-cases (and doesn't even exclude multiline comments)

patch.txt

seems like the jumptodef has a lot of edge cases, universal ctags supports the +n field, which adds the line at which the tag appears, maybe using this would fix all these issues and make the code smaller?

@complex857
Copy link
Collaborator

I'll have to see what we could do, but in theory if you have a cursor position, you can ask vim what sort of syntax highlight symbol it has associated to that position. This is what I've used before for comment detection and I've a simplified syntax file as part of the plugin for this.

I'm not against adding support for new ctag features, but the part in the patch is just reading buffers, need to take a closer look at this.

Thank you once again for the awesomely detailed report!

@dkjii-gg
Copy link
Author

Personally I would use the tag.cmd to search for the pattern in the temporary buffer, or just use tag.line if it's available

When I'm free I'll see what i can do and maybe submit a patch. BTW, the patch in the first post doesn't work, because it ignore abstract/final classes

Thanks you for the great plugin :P

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

2 participants