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

Highlight variable definitions #2

Open
yuyichao opened this issue Mar 31, 2016 · 6 comments
Open

Highlight variable definitions #2

yuyichao opened this issue Mar 31, 2016 · 6 comments

Comments

@yuyichao
Copy link
Contributor

Ref JuliaLang/julia#8723

We should highlight variables introduced with let, global, local or const. We'll need to be careful here to ensure that we handle commas correctly.

@tpapp
Copy link
Collaborator

tpapp commented Dec 26, 2019

Can someone post a screenshot or an example of how this works in some other mode?

Incidentally, I use https://github.com/nschum/highlight-symbol.el/ for visual tracing, eg

highlight

with some hotkeys setup for navigation and toggling highlights. There are other Emacs packages with similar functionality.

@tpapp
Copy link
Collaborator

tpapp commented Mar 24, 2020

@Wilfred, since you opened the original issue JuliaLang/julia#8723, can you please clarify the desired behavior here? Eg in

let x = "foo, bar", y = foo(1, 2)
    x + y
end

would you want to highlight the first x and y, or all occurrences within the let?

@non-Jedi
Copy link
Contributor

non-Jedi commented Mar 24, 2020

Per the emacs manual, it would be traditional to highlight the first x and y but not subsequent occurrences with font-lock-variable-name-face: https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html

@non-Jedi
Copy link
Contributor

I started working on this. Ran into trouble. The problem is that assignment can occur in a lot of contexts in julia, and = means something else entirely in other contexts. For example, how do tell whether (a = ...) is an assignment to a or a named tuple without parsing the whole expression? Any ideas would be helpful.

non-Jedi@0c802f9

@tpapp
Copy link
Collaborator

tpapp commented Apr 1, 2020

I have thought about this and for every regex-based approach I can think of there is some corner case.

I am not sure this functionality is worth implementing what amounts to a subset of the Julia parser. I would be inclined to close it as wontfix, but I can leave it open too.

@non-Jedi
Copy link
Contributor

non-Jedi commented Apr 1, 2020

I'd leave it open for discoverability if it was me. Having just skimmed the indentation code, we already actually implement a surprisingly large subset of the julia parser; if someone wanted to do the work, I don't think it would be a bad thing to have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants