zls icon indicating copy to clipboard operation
zls copied to clipboard

Only return highlights for symbols in current document

Open gpanders opened this issue 3 years ago • 1 comments

This seems to only occur when highlighting "field access" symbols, e.g. "bar" in a statement such as foo.bar. This is because the symbolReferencesInternal function finds the reference to the field in the container even when the container is not in the current document.

gpanders avatar Aug 10 '22 22:08 gpanders

Alternatively I could try modifying symbolReferencesInternal to have it (optionally) only find symbols within the current document. That is probably “better” in the sense that it does not generate references that only get filtered out later, though it is a larger/more complex change.

gpanders avatar Aug 10 '22 23:08 gpanders

I think this change is fine as-is, thanks for the contribution!

SuperAuguste avatar Aug 11 '22 15:08 SuperAuguste